Skip to content

Commit

Permalink
added analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
ezhillragesh committed Jan 7, 2024
1 parent 0c03c26 commit c9fd060
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ export default function RootLayout({
<link rel="preconnect" href="https://api.github.com" />

<Script
strategy="lazyOnload"
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS}`}
/>
strategy="lazyOnload"
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.GOOGLE_ANALYTICS}`}
/>

<Script strategy="lazyOnload">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS}', {
page_path: window.location.pathname,
});
`}
</Script>
<Script id="ga-script" strategy="lazyOnload">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${process.env.GOOGLE_ANALYTICS}', {
page_path: window.location.pathname,
});
`}
</Script>

<body className={inter.className}>
<Navbar />
Expand Down

0 comments on commit c9fd060

Please sign in to comment.