feat(marketing): region-aware cookie banner

KI
18h ago
+538-140

Summary

  • The proxy sets a paradev-consent-region cookie from x-vercel-ip-country: opt-in for the EU, the EEA and the UK (one constant in consent-region.ts), opt-out elsewhere. An unknown country is opt-in in production. Pages stay static.
  • canTrack() in consent.ts is the one consent check: opt-in regions track only after Accept, other regions unless declined.
  • PostHog init, the Google Ads tag, the Reddit pixel and the external tracking script load only when canTrack() is true, and start on Accept without a reload.
  • Banner: Accept / Decline in opt-in regions, Accept / Opt-out elsewhere, with new copy. A "Cookie settings" footer link reopens it.
  • Privacy policy section 9 and the subprocessor list describe the analytics and ad measurement cookies.

Testing

  • bun test (marketing): consent function (region × stored choice) and proxy region cookie.
  • Typecheck, lint, check:i18n.
  • Dev server + headless Chrome over CDP with the country header forced: opt-in fresh visit loads no tracker and sets no tracker cookie until Accept; opt-out region loads trackers, and none load after Opt-out and reload; CH gets opt-out; footer link reopens the banner.

Summary by cubic

Makes the cookie consent region-aware: visitors in the EU, EEA, and UK must opt in to analytics and ad tracking, while visitors elsewhere are tracked by default unless they opt out.

  • The proxy sets a paradev-consent-region cookie from x-vercel-ip-country; unknown countries default to opt-in in production.
  • canTrack() in consent.ts is now the single consent check for PostHog, Google Ads, the Reddit pixel, and external tracking.
  • Trackers load only when consent allows and start immediately on Accept, without a page reload.
  • The banner shows Accept/Decline in opt-in regions and Accept/Opt-out elsewhere; a "Cookie settings" footer link reopens it.
  • Privacy policy and subprocessor list now describe the analytics and ad measurement cookies.

Summary by CodeRabbit

  • New Features
    • Added a cookie settings option in the website footer, letting you revisit your consent choices.
    • Cookie consent now reflects regional requirements: in the EU, EEA, and UK, analytics and advertising measurement cookies are used only after acceptance; elsewhere, they’re used unless you opt out.
    • Advertising measurement tracking now respects your consent choices.
  • Documentation
    • Updated the privacy and subprocessor notices to describe cookie use and advertising measurement providers.
  • Translations
    • Updated cookie consent messages and added cookie settings and decline labels across supported languages.