From 2aca0d13f384e1c251e5a8c8b3495bfc09a854b9 Mon Sep 17 00:00:00 2001 From: lksbrssr Date: Tue, 28 Jul 2026 11:42:30 +0200 Subject: [PATCH] Turn cookie banner off by default (keep analytics running) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flip COOKIE_CONSENT_ENABLED to default OFF: no consent banner and no footer 'Cookie settings' link, but Google Analytics still loads directly (cookies are still set) whenever NEXT_PUBLIC_GA_ID is present. The consent flow is left fully intact — set NEXT_PUBLIC_COOKIE_CONSENT=on (env var) to bring the banner back, or revert this one-line default flip. --- .env.example | 9 +++++---- README.md | 2 +- src/lib/cookie-consent.ts | 9 +++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index 4ccec424..3b223be9 100644 --- a/.env.example +++ b/.env.example @@ -17,10 +17,11 @@ NEXT_PUBLIC_ADMIN_DID=did:plc:pgwr6hkosgznfl5nz7egajei # Leave empty to disable Google Analytics. NEXT_PUBLIC_ prefix exposes it to the client. NEXT_PUBLIC_GA_ID= -# Analytics cookie-consent banner. ON by default: the consent banner + footer -# "Cookie settings" link are shown and analytics only loads after the visitor -# agrees. Set to "off" to hide the banner and load analytics directly. -NEXT_PUBLIC_COOKIE_CONSENT=on +# Analytics cookie-consent banner. OFF by default: no banner is shown and +# analytics loads directly (cookies still set) when NEXT_PUBLIC_GA_ID is set. +# Set to "on" to show the consent banner + footer "Cookie settings" link and +# gate analytics on the visitor's choice (recommended for EU/UK). +NEXT_PUBLIC_COOKIE_CONSENT=off # GraphQL indexer URL for org.plresearch.* records # Default: https://api.hi.gainforest.app/graphql diff --git a/README.md b/README.md index 75bbb716..f67bc7a3 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ These files are edited directly as JSON and consumed by hardcoded FA2 sub-pages | `COOKIE_SECRET` | Yes | 32+ character secret for encrypting session cookies | | `PUBLIC_URL` | No | Production URL (empty defaults to localhost) | | `NEXT_PUBLIC_GA_ID` | No | Google Analytics 4 Measurement ID (empty disables analytics) | -| `NEXT_PUBLIC_COOKIE_CONSENT` | No | `off` hides the analytics consent banner + footer link and loads analytics directly; anything else (default) shows the consent banner | +| `NEXT_PUBLIC_COOKIE_CONSENT` | No | `on` shows the analytics consent banner + footer link and gates analytics on consent; anything else (default) hides the banner and loads analytics directly (cookies still set) | ## Deployment diff --git a/src/lib/cookie-consent.ts b/src/lib/cookie-consent.ts index ed616f0c..ae40ed4d 100644 --- a/src/lib/cookie-consent.ts +++ b/src/lib/cookie-consent.ts @@ -1,8 +1,9 @@ // Feature flag for the analytics cookie-consent banner + footer "Cookie // settings" link. // -// ON by default: the consent banner is shown and Google Analytics only loads -// after the visitor agrees. Set NEXT_PUBLIC_COOKIE_CONSENT=off to hide the -// banner and load analytics directly. +// OFF by default: no consent banner is shown and Google Analytics loads +// directly (cookies still set) whenever NEXT_PUBLIC_GA_ID is present. Set +// NEXT_PUBLIC_COOKIE_CONSENT=on to bring the consent banner back and gate +// analytics on the visitor's choice. export const COOKIE_CONSENT_ENABLED = - process.env.NEXT_PUBLIC_COOKIE_CONSENT !== 'off' + process.env.NEXT_PUBLIC_COOKIE_CONSENT === 'on'