File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ const nextConfig: NextConfig = {
1616 basePath : process . env . GITHUB_REPOSITORY ? `/${ process . env . GITHUB_REPOSITORY . split ( '/' ) [ 1 ] } ` : '' ,
1717 env : {
1818 NEXT_PUBLIC_APP_VERSION : getGitVersion ( ) ,
19+ NEXT_PUBLIC_GA_MEASUREMENT_ID : 'G-XGDWE4SWF7' ,
1920 } ,
2021} ;
2122
Original file line number Diff line number Diff line change 1919
2020// The layout for the entire app
2121import type { Metadata } from "next" ;
22+ import Script from "next/script" ;
2223import Navigation from "@/components/Navigation" ;
2324import VersionWarningBanner from "@/components/VersionWarningBanner" ;
2425import { CURRENT_APP_VERSION } from "@/constants/version" ;
@@ -49,6 +50,20 @@ export default function RootLayout({
4950 return (
5051 < html lang = "en" >
5152 < body >
53+ < Script
54+ async
55+ src = { `https://www.googletagmanager.com/gtag/js?id=${ process . env . NEXT_PUBLIC_GA_MEASUREMENT_ID } ` }
56+ strategy = "afterInteractive"
57+ />
58+ < Script id = "google-analytics" strategy = "afterInteractive" >
59+ { `
60+ window.dataLayer = window.dataLayer || [];
61+ function gtag(){dataLayer.push(arguments);}
62+ gtag('js', new Date());
63+
64+ gtag('config', '${ process . env . NEXT_PUBLIC_GA_MEASUREMENT_ID } ');
65+ ` }
66+ </ Script >
5267 < VersionWarningBanner />
5368 < Navigation />
5469 < main style = { { paddingLeft : '2.5rem' , paddingRight : '2.5rem' } } >
You can’t perform that action at this time.
0 commit comments