We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents fdbb71b + a2c4d4c commit c97044fCopy full SHA for c97044f
src/app/components/GoogleAnalytics.tsx
@@ -8,10 +8,21 @@ const GoogleAnalytics = () => {
8
}
9
10
return (
11
- <Script
12
- strategy="afterInteractive" // Load the script after interactive content is available
13
- src={`https://www.googletagmanager.com/gtag/js?id=${GA_TRACKING_ID}`}
14
- />
+ <>
+ <Script
+ strategy="afterInteractive"
+ src={`https://www.googletagmanager.com/gtag/js?id=${GA_TRACKING_ID}`}
15
+ />
16
+ <Script id="gtag" strategy="afterInteractive">
17
+ {`
18
+ window.dataLayer = window.dataLayer || [];
19
+ function gtag(){dataLayer.push(arguments);}
20
+ gtag('js', new Date());
21
+ gtag('config', '${GA_TRACKING_ID}');
22
+ `}
23
+ </Script>
24
+ </>
25
+
26
);
27
};
28
0 commit comments