Skip to content

Site-wide GDPR cookie consent banner with shared consent cookie - #1340

Merged
daveearley merged 1 commit into
developfrom
feature/cookie-consent
Sep 6, 2026
Merged

Site-wide GDPR cookie consent banner with shared consent cookie#1340
daveearley merged 1 commit into
developfrom
feature/cookie-consent

Conversation

@daveearley

Copy link
Copy Markdown
Contributor

Summary

Replaces the binary Accept/Decline banner (shown only on event pages) with a site-wide cookie consent banner offering Essential / Analytics / Advertising choices via a "More choices" panel. Enabled with VITE_COOKIE_CONSENT_ENABLED=true; self-hosted installs see no change unless they opt in.

Consent is stored in a hi_cookie_consent cookie (analytics=1&advertising=0) that the marketing site writes with the same contract on .hi.events, so a choice made on hi.events carries into app.hi.events (VITE_COOKIE_CONSENT_DOMAIN).

Changes

  • New utilites/cookieConsent.ts + useCookieConsent hook replace trackingPixels/consent.ts; the old hi_tracking_consent cookie is not migrated (visitors are asked once more)
  • server.js emits the Google Consent Mode v2 default from the stored cookie before any gtag snippet (default-denied + wait_for_update when absent)
  • Organizer tracking pixels are filtered by category (GA4 → analytics; Facebook / TikTok / GTM → advertising). With the banner disabled they load ungated, as before the per-page banner existed
  • Revoking a granted category reloads the page; a Cookie settings link beside the Powered-by footer reopens the banner pre-filled
  • Banner and link are suppressed inside embedded widgets (iframes) and on /widget routes
  • Google Ads conversion tracking (VITE_GOOGLE_ADS_CONVERSION_ID / _LABELS) fired from trackEvent
  • GA4 plugin cleanup no longer deletes the non-configurable global gtag (threw on effect teardown once the head declares it)
  • Removed the orphan EventHomepage/Footer component
  • Env vars documented in frontend/.env.example, passed through the all-in-one image; 11 new strings translated in all locales

Deploy notes (cloud)

VITE_COOKIE_CONSENT_ENABLED=true
VITE_COOKIE_CONSENT_DOMAIN=.hi.events
VITE_GOOGLE_ADS_CONVERSION_ID=AW-…
VITE_GOOGLE_ADS_CONVERSION_LABELS=signup_completed:…

The domain var is required on cloud, otherwise the site's .hi.events cookie and a host-only app cookie coexist.

Test plan

  • Production SSR build (client + server) passes
  • tsc --noEmit clean on touched files; messages:extract --clean reports 0 missing
  • E2E: new cookie-consent.spec.ts + free-checkout smoke pass against the dev stack (consent cookie seeded in default storage state so existing specs never see the overlay)
  • Manual: banner in dashboard and on public event pages; More choices saves analytics=0&advertising=1 and pushes a matching consent update; GA4 pixel withheld while Facebook loads; Cookie settings reopens pre-filled; revoking Advertising reloads with no fbevents.js; banner-off path loads pixels immediately
  • curl with/without the cookie shows the server-emitted consent default in the expected order

🤖 Generated with Claude Code

Replace the binary event-page consent banner with a site-wide banner offering
Essential / Analytics / Advertising choices, enabled via VITE_COOKIE_CONSENT_ENABLED.
Consent is stored in a hi_cookie_consent cookie shared with the marketing site on
.hi.events (VITE_COOKIE_CONSENT_DOMAIN), and Google Consent Mode v2 defaults are
emitted server-side from that cookie before any gtag snippet loads.

- Organizer tracking pixels are filtered by consent category; they load ungated
  when the banner is disabled (self-hosted default)
- Revoking a granted category reloads the page; a Cookie settings link on public
  pages reopens the banner
- Banner and link are suppressed inside embedded widgets and on /widget routes
- Google Ads conversion tracking via VITE_GOOGLE_ADS_CONVERSION_ID/_LABELS
- Remove the GA4 plugin's delete of the non-configurable global gtag
- Document new env vars, pass them through the all-in-one image, add E2E spec
@railway-app

railway-app Bot commented Sep 6, 2026

Copy link
Copy Markdown

🚅 Deployed to the Hi.Events-pr-1340 environment in Hi.Events

Service Status Web Updated
Hi.Events Frontend ✅ Success (View Logs) Web Sep 6, 2026 at 4:49 pm UTC
Hi.Events API ✅ Success (View Logs) Web Sep 6, 2026 at 4:48 pm UTC
3 services not affected by this PR
  • Maildev
  • Hi.Events Queue Worker
  • Hi.Events Scheduler

@railway-app
railway-app Bot temporarily deployed to Hi.Events / Hi.Events-pr-1340 September 6, 2026 16:46 Destroyed
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

✅ E2E · smoke

✅ Passed ❌ Failed ⚠️ Flaky ⏭️ Skipped ⏱️ Duration
25 0 0 0 1m 3s

View run

@daveearley
daveearley merged commit 919aed8 into develop Sep 6, 2026
5 checks passed
@daveearley
daveearley deleted the feature/cookie-consent branch September 6, 2026 16:51
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant