diff --git a/public/analytics.js b/public/analytics.js new file mode 100644 index 0000000..f8a93a1 --- /dev/null +++ b/public/analytics.js @@ -0,0 +1,10 @@ +// File: /public/analytics.js + +window.dataLayer = window.dataLayer || []; +function gtag() { + dataLayer.push(arguments); +} +gtag('js', new Date()); + +// Replace 'YOUR_NEXT_PUBLIC_GTAG_ID' with your actual GTAG ID environment variable or hard code the ID +gtag('config', 'G-E08GE9HLQC'); diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 214d3bf..cef6c19 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -50,15 +50,7 @@ export default function MyApp({ Component, pageProps, router }: AppProps) { src={`https://www.googletagmanager.com/gtag/js?id=${process.env.NEXT_PUBLIC_GTAG_ID}`} strategy="afterInteractive" // Loads the script after the page becomes interactive /> - - +