changed google method f4ceea85
Steve · 2023-03-02 11:28 2 file(s) · +11 −5
src/components/BaseHead.astro +0 −3
2 2
import type { SiteMeta } from "@/data/siteMeta";
3 3
import siteConfig from "@/site-config";
4 4
import "../styles/global.css";
5 -
import { GoogleAnalytics } from "astro-google-analytics";
6 5
7 6
type Props = SiteMeta;
8 7
17 16
<meta charset="utf-8" />
18 17
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no" />
19 18
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
20 -
21 -
<GoogleAnalytics id="G-QT67QEFLTG" />
22 19
23 20
<!-- Icons / Favicon -->
24 21
<link rel="icon" href="/favicon.ico" sizes="any" />
src/layouts/Base.astro +11 −2
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";
9 8
10 9
interface Props {
11 10
	meta: SiteMeta;
18 17
19 18
<html lang={siteConfig.lang}>
20 19
	<head>
21 -
    <GoogleAnalytics id="G-QT67QEFLTG" />
20 +
		<!-- Google tag (gtag.js) -->
21 +
		<script async src="https://www.googletagmanager.com/gtag/js?id=G-QT67QEFLTG"></script>
22 +
		<script>
23 +
			window.dataLayer = window.dataLayer || [];
24 +
			function gtag() {
25 +
				dataLayer.push(arguments);
26 +
			}
27 +
			gtag("js", new Date());
28 +
29 +
			gtag("config", "G-QT67QEFLTG");
30 +
		</script>
22 31
		<BaseHead title={title} description={description} ogImage={ogImage} articleDate={articleDate} />
23 32
		<script define:vars={{ siteConfig }}>
24 33
			const root = document.documentElement;