From 4ac88e51aea2704900d539b3622050541e4a69fb Mon Sep 17 00:00:00 2001 From: Hank Pilot Date: Tue, 16 Jun 2026 16:39:39 +0000 Subject: [PATCH] PILOT-27: GDPR-compliant cookie consent banner + gate analytics behind consent - Consent banner injected into BaseHead (every page), Accept/Reject options - GA4 loads dynamically only after user accepts (no unconditional gtag script) - PostHog gates behind consent via consent-check.ts shared module - 'Cookie Preferences' link in footer (opens banner again) - Consent stored in localStorage pilot_consent key - Matches existing documented policy in cookies.astro and privacy.astro Build verified: 301 pages built, zero errors. --- package-lock.json | 7 +- src/components/BaseHead.astro | 169 +++++++++++++++++++++++++++++++++- src/components/Footer.astro | 15 +++ src/scripts/analytics.ts | 16 +++- src/scripts/consent-check.ts | 50 ++++++++++ 5 files changed, 244 insertions(+), 13 deletions(-) create mode 100644 src/scripts/consent-check.ts diff --git a/package-lock.json b/package-lock.json index 48d0263..8c765a0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1057,7 +1057,6 @@ "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.1.tgz", "integrity": "sha512-gLyJlPHPZYdAk1JENA9LeHejZe1Ti77/pTeFm/nMXmQH/HFZlcS/O2XJB+L8fkbrNSqhdtlvjBVjxwUYanNH5Q==", "license": "Apache-2.0", - "peer": true, "engines": { "node": ">=8.0.0" } @@ -1884,7 +1883,6 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-25.5.0.tgz", "integrity": "sha512-jp2P3tQMSxWugkCUKLRPVUpGaL5MVFwF8RDuSRztfwgN1wmqJeMSbKlnEtQqU8UrhTmzEmZdu2I6v2dpp7XIxw==", "license": "MIT", - "peer": true, "dependencies": { "undici-types": "~7.18.0" } @@ -2870,8 +2868,7 @@ "version": "0.0.1581282", "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1581282.tgz", "integrity": "sha512-nv7iKtNZQshSW2hKzYNr46nM/Cfh5SEvE2oV0/SEGgc9XupIY5ggf84Cz8eJIkBce7S3bmTAauFD6aysMpnqsQ==", - "license": "BSD-3-Clause", - "peer": true + "license": "BSD-3-Clause" }, "node_modules/diff": { "version": "8.0.3", @@ -5365,7 +5362,6 @@ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.59.0.tgz", "integrity": "sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg==", "license": "MIT", - "peer": true, "dependencies": { "@types/estree": "1.0.8" }, @@ -6908,7 +6904,6 @@ "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", "license": "MIT", - "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index 43cfe1f..3f3551d 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -45,7 +45,140 @@ const { bytes are unchanged. --> + + + + + + + - + +