Skip to content

Remove the cookie consent banner (feature-flagged off) - #84

Merged
lksbrssr merged 1 commit into
mainfrom
chore/remove-cookie-banner
Jul 24, 2026
Merged

Remove the cookie consent banner (feature-flagged off)#84
lksbrssr merged 1 commit into
mainfrom
chore/remove-cookie-banner

Conversation

@lksbrssr

Copy link
Copy Markdown
Collaborator

What this does

Removes the analytics cookie consent banner from the site by gating the whole consent flow behind a new NEXT_PUBLIC_COOKIE_CONSENT feature flag that is off by default.

With the flag off (the new default):

  • ❌ No consent banner is shown to any visitor.
  • ❌ The footer "Cookie settings" link is hidden.
  • ❌ The geo region-detection middleware no-ops — no pl-consent-region cookie is set.
  • ✅ Google Analytics loads directly whenever NEXT_PUBLIC_GA_ID is set.

Why a flag instead of a delete

All the existing consent components (CookieConsent, CookieSettingsLink, the region middleware logic) are kept intact. That makes bringing the banner back trivial — see the companion PR — or just set NEXT_PUBLIC_COOKIE_CONSENT=on in the environment.

⚠️ Heads up (legal)

With the banner off, analytics loads for everyone, including EU/EEA/UK visitors, without prior consent. That's the intended "no banner" behaviour, but if the site serves those regions you'll likely want to flip the flag back on (companion PR) before shipping to production.

Files changed

  • src/lib/cookie-consent.ts — new flag helper (default off)
  • src/app/layout.tsx — banner vs. direct GA based on the flag
  • src/components/SiteFooter.tsx — hide "Cookie settings" link when off
  • src/middleware.ts — skip region detection when off
  • .env.example / README.md — document NEXT_PUBLIC_COOKIE_CONSENT

Gate the cookie-consent banner, its footer 'Cookie settings' link, and the
geo region-detection middleware behind a new NEXT_PUBLIC_COOKIE_CONSENT flag.

The flag is OFF by default, so:
- no consent banner is shown to visitors,
- the footer 'Cookie settings' link is hidden,
- the region middleware no-ops (no pl-consent-region cookie is set),
- Google Analytics loads directly whenever NEXT_PUBLIC_GA_ID is set.

All the existing consent components are kept intact, so re-enabling is a
one-line change (see companion PR) or simply setting NEXT_PUBLIC_COOKIE_CONSENT=on.
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
plrd.org Ready Ready Preview, Comment Jul 24, 2026 10:06am

Request Review

@lksbrssr
lksbrssr merged commit e96df3a into main Jul 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant