File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import "@/styles/reset.css";
1010import "@/styles/global.scss" ;
1111import { Header } from "@/shared/components/Header" ;
1212import { Footer } from "@/shared/components/Footer" ;
13+ import Script from "next/script" ;
1314
1415export const metadata : Metadata = {
1516 title : "Permit" ,
@@ -21,8 +22,28 @@ export default function RootLayout({
2122} : Readonly < {
2223 children : React . ReactNode ;
2324} > ) {
25+ const isProd = process . env . NODE_ENV === "production" ;
26+
2427 return (
2528 < html lang = "ko" >
29+ < head >
30+ { isProd && (
31+ < >
32+ < Script
33+ src = "https://www.googletagmanager.com/gtag/js?id=G-R0HMHE4ZHF"
34+ strategy = "afterInteractive"
35+ />
36+ < Script id = "gtag-init" strategy = "afterInteractive" >
37+ { `
38+ window.dataLayer = window.dataLayer || [];
39+ function gtag(){dataLayer.push(arguments);}
40+ gtag('js', new Date());
41+ gtag('config', 'G-R0HMHE4ZHF');
42+ ` }
43+ </ Script >
44+ </ >
45+ ) }
46+ </ head >
2647 < body >
2748 < GlobalErrorBoundary >
2849 < QueryClientProviders >
You can’t perform that action at this time.
0 commit comments