Skip to content

Commit

Permalink
adding google analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
almithani committed Nov 19, 2024
1 parent 823a121 commit 4f8adf1
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
import '@/styles/globals.css'
import type { AppProps } from 'next/app'
import Script from 'next/script';

export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
//return <Component {...pageProps} />
return (
<>
{/* Google Analytics Script */}
<Script
src={`https://www.googletagmanager.com/gtag/js?id=G-WXX5WPLBE4`}
strategy="afterInteractive"
/>
<Script id="google-analytics" strategy="afterInteractive">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-WXX5WPLBE4');
`}
</Script>
<Component {...pageProps} />
</>
);
}

0 comments on commit 4f8adf1

Please sign in to comment.