Skip to content

Commit 2206856

Browse files
authored
Integrate Google Analytics into layout (#204)
Added Google Analytics scripts to layout.
1 parent 4f8522a commit 2206856

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

app/layout.jsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Footer from '@/components/footer'
44
import Header from '@/components/header'
55
import AuthProvider from '@/context/session-provider'
66
import { Analytics } from '@vercel/analytics/next'
7+
import Script from 'next/script'
78

89
const inter = Inter({ subsets: ['latin'] })
910

@@ -23,9 +24,23 @@ export default function RootLayout({ children }) {
2324
<AuthProvider>
2425
<Header />
2526
{children}
26-
<Analytics />
2727
<Footer />
28+
<Analytics />
2829
</AuthProvider>
30+
31+
{/* Google Analytics */}
32+
<Script
33+
src="https://www.googletagmanager.com/gtag/js?id=G-FRS93SLW90"
34+
strategy="afterInteractive"
35+
/>
36+
<Script id="google-analytics" strategy="afterInteractive">
37+
{`
38+
window.dataLayer = window.dataLayer || [];
39+
function gtag(){dataLayer.push(arguments);}
40+
gtag('js', new Date());
41+
gtag('config', 'G-FRS93SLW90');
42+
`}
43+
</Script>
2944
</body>
3045
</html>
3146
)

0 commit comments

Comments
 (0)