File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import type { Metadata } from "next" ;
22import { Geist } from "next/font/google" ;
33import { Source_Serif_4 } from "next/font/google" ;
4+ import Script from "next/script" ;
45import Header from "@/components/Header" ;
56import Footer from "@/components/Footer" ;
67import Providers from "@/components/Providers" ;
78import "./globals.css" ;
89
10+ const GA4_MEASUREMENT_ID = "G-ZWZML12R4X" ;
11+
912const geistSans = Geist ( {
1013 variable : "--font-geist-sans" ,
1114 subsets : [ "latin" ] ,
@@ -53,6 +56,18 @@ export default function RootLayout({
5356 < body
5457 className = { `${ geistSans . variable } ${ sourceSerif . variable } bg-background text-foreground antialiased` }
5558 >
59+ < Script
60+ src = { `https://www.googletagmanager.com/gtag/js?id=${ GA4_MEASUREMENT_ID } ` }
61+ strategy = "afterInteractive"
62+ />
63+ < Script id = "ga4-init" strategy = "afterInteractive" >
64+ { `
65+ window.dataLayer = window.dataLayer || [];
66+ function gtag(){dataLayer.push(arguments);}
67+ gtag('js', new Date());
68+ gtag('config', '${ GA4_MEASUREMENT_ID } ');
69+ ` }
70+ </ Script >
5671 < Providers >
5772 < div className = "flex min-h-screen flex-col" >
5873 < Header />
You can’t perform that action at this time.
0 commit comments