diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 46afc1e1..e01b0c4a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -34,6 +34,9 @@ jobs: run: npm ci - name: Build site + env: + # Google Analytics 4 measurement ID; public (it ships in every page), so not a secret. + PUBLIC_GA_ID: G-C902XCTMKD run: npm run build - name: Deploy to Cloudflare Pages diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index 02d73b97..3b7b780f 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -44,6 +44,8 @@ const cleanPath = Astro.url.pathname.replace(/\.html$/, '').replace(/\/index$/, const canonical = new URL(cleanPath, Astro.site).toString(); // Shared social card (logo lockup on the dark brand background) until pages get their own. const ogImage = new URL('/og-default.png', Astro.site).toString(); +// Google Analytics 4 measurement ID (G-XXXXXXXXXX), set at build time. No ID, no tag. +const gaId = import.meta.env.PUBLIC_GA_ID; --- @@ -107,6 +109,18 @@ const ogImage = new URL('/og-default.png', Astro.site).toString(); {jsonLd.length > 0 && } + + {gaId && ( + <> + + + > + )}
Skip to content