switched to google analytics 3a8fc247
Steve · 2023-03-02 10:04 4 file(s) · +9 −6
package-lock.json +6 −0
12 12
				"@astrojs/rss": "^2.0.0",
13 13
				"@vercel/analytics": "^0.1.10",
14 14
				"astro": "2.0.2",
15 +
				"astro-google-analytics": "^1.0.3",
15 16
				"satori": "0.1.2",
16 17
				"satori-html": "^0.3.2",
17 18
				"sharp": "^0.31.3"
2319 2320
			"funding": {
2320 2321
				"url": "https://github.com/sponsors/ota-meshi"
2321 2322
			}
2323 +
		},
2324 +
		"node_modules/astro-google-analytics": {
2325 +
			"version": "1.0.3",
2326 +
			"resolved": "https://registry.npmjs.org/astro-google-analytics/-/astro-google-analytics-1.0.3.tgz",
2327 +
			"integrity": "sha512-5bD7jA15yxVaUFVVEFG6KKMphYJ4AKP4+HSqCVBpTBnqh8LL0giTdAHpG9KJs3JaFbGQUTWP5Pqt8+twz7f55Q=="
2322 2328
		},
2323 2329
		"node_modules/astro/node_modules/es-module-lexer": {
2324 2330
			"version": "1.1.1",
package.json +1 −0
49 49
		"@astrojs/rss": "^2.0.0",
50 50
		"@vercel/analytics": "^0.1.10",
51 51
		"astro": "2.0.2",
52 +
		"astro-google-analytics": "^1.0.3",
52 53
		"satori": "0.1.2",
53 54
		"satori-html": "^0.3.2",
54 55
		"sharp": "^0.31.3"
src/components/BaseHead.astro +0 −3
11 11
const siteTitle = `${title} ${titleSeparator} ${siteConfig.title}`;
12 12
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
13 13
const socialImageURL = new URL(ogImage ? ogImage : "/social-card.png", Astro.url).href;
14 -
import { inject } from '@vercel/analytics';
15 -
16 -
inject();
17 14
18 15
---
19 16
<meta charset="utf-8" />
src/layouts/Base.astro +2 −3
5 5
import Footer from "@/components/layout/Footer";
6 6
import SkipLink from "@/components/SkipLink";
7 7
import siteConfig from "@/site-config";
8 +
import { GoogleAnalytics } from "astro-google-analytics"
8 9
9 10
interface Props {
10 11
	meta: SiteMeta;
17 18
18 19
<html lang={siteConfig.lang}>
19 20
	<head>
20 -
		<BaseHead title={title} description={description} ogImage={ogImage} articleDate={articleDate} />
21 -
		<script define:vars={{ siteConfig }}>
22 -
			const root = document.documentElement;
21 +
		<BaseHead title={title} description={description} ogImage={ogImage} articleDate={articleDate} /> <GoogleAnalytics id="G-QT67QEFLTG" /> <script define:vars={{ siteConfig }}> const root = document.documentElement;
23 22
			const colorThemeMetaTag = document.querySelector("meta[name='theme-color']");
24 23
25 24
			// get user preference of dark mode, 1st local storage, 2nd browser