Skip to content

Commit

Permalink
added analytics details
Browse files Browse the repository at this point in the history
  • Loading branch information
ashura-code committed Jan 3, 2024
1 parent e456d72 commit 4f3cea0
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Poppins } from 'next/font/google';
import './globals.css';
import Navbar from '@/comps/navbar';
import Footer from '@/comps/Footer';
import Script from 'next/script';

const inter = Poppins({
subsets: ['latin'],
Expand All @@ -26,12 +27,28 @@ export default function RootLayout({
<link rel="icon" type="image/x-icon" href="favicon.svg" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<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}`}
/>

<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>

<body className={inter.className}>
<Navbar />
{children}
<div className=' my-14'></div>
<Footer/>
<div className=" my-14"></div>
<Footer />
</body>
</html>
);
Expand Down

0 comments on commit 4f3cea0

Please sign in to comment.