Skip to content

Commit af248be

Browse files
Integrate Google Analytics 4 (GA4) foundation for traffic tracking
1 parent 664edef commit af248be

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

app/layout.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,19 @@ export default function RootLayout({ children }: RootLayoutProps) {
7979
crossOrigin="anonymous"
8080
strategy="afterInteractive"
8181
/>
82+
{/* Google Analytics 4 */}
83+
<Script
84+
src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"
85+
strategy="afterInteractive"
86+
/>
87+
<Script id="google-analytics" strategy="afterInteractive">
88+
{`
89+
window.dataLayer = window.dataLayer || [];
90+
function gtag(){dataLayer.push(arguments);}
91+
gtag('js', new Date());
92+
gtag('config', 'G-XXXXXXXXXX');
93+
`}
94+
</Script>
8295
</head>
8396
<body className="bg-white text-gray-900 antialiased">
8497
<div className="min-h-screen flex flex-col">

0 commit comments

Comments
 (0)