Repository navigation
privacy(fix): delete GA's cookies when consent is withdrawn - #415
Conversation
Found by checking the live site rather than the code: after resetting consent to a first-visit state, GA4 correctly did not load — but `_ga` and `_ga_EMGRZ0H9R9` were still sitting in the browser from the earlier opt-in. Withdrawal stopped collection and cleared our own pc_distinct_id, but never touched GA's cookies, so the visitor stayed identifiable to Google on their next visit. That is the cookie analogue of the stale-identifier bug fixed earlier, and under GDPR withdrawal should remove the identifiers rather than merely stop processing. clearAnalyticsCookies() expires the `_ga` / `_ga_*` pair (plus legacy `_gid` / `_gat*`) on both denial paths: explicit withdrawal and a GPC/DNT signal arriving after an opt-in. A cookie can only be removed by re-setting it with a matching domain and path, and script cannot read which domain a cookie came from — GA writes `_ga` on the registrable domain — so each plausible domain is tried and the misses are inert. It runs before the existing reload so the tag cannot re-set them on the way out. The spec seeds the cookies by hand instead of waiting for a real googletagmanager fetch, which keeps it deterministic rather than network-flaky, and asserts an unrelated cookie on the same domain survives so the sweep cannot grow into deleting everything. /privacy and contributing.mdx now say withdrawal deletes rather than just stops. Verified: lint clean, tsc clean, 379 int tests, consent + a11y e2e 20/20. Co-Authored-By: Claude Opus 5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 40 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
format:check gates on prettier as of #402/#408, and `pnpm lint` does not cover it — so the privacy page landed unformatted. Reformatted. The intro also still claimed "Nothing loads until you accept", which the cookieless split made false: Vercel Analytics and Speed Insights load for everyone. Now scoped to "nothing that stores anything on your device". Co-Authored-By: Claude Opus 5 <[email protected]>
Found by checking the live site, not the code. After resetting consent to a first-visit state, GA4 correctly did not load — but
_gaand_ga_EMGRZ0H9R9were still sitting in the browser from the earlier opt-in.Withdrawal stopped collection and cleared our own
pc_distinct_id, but never touched GA's cookies. So the visitor stayed identifiable to Google on their next visit. That's the cookie analogue of the stale-identifier bug fixed earlier — and under GDPR, withdrawal should remove identifiers, not just stop processing.The fix
clearAnalyticsCookies()expires the_ga/_ga_*pair (plus legacy_gid/_gat*) on both denial paths: explicit withdrawal, and a GPC/DNT signal arriving after an opt-in.Two details worth knowing:
_gaon the registrable domain. So each plausible domain is tried; the misses are inert.Testing
The spec seeds the cookies by hand rather than waiting for a real
googletagmanagerfetch — that keeps it deterministic instead of network-flaky, and it still pins the logic that matters.It also asserts an unrelated cookie on the same domain survives, so the sweep can't quietly grow into deleting everything.
Docs
/privacyandcontributing.mdxnow say withdrawal deletes what the opt-in created, rather than implying it only stops collection.Verification
lint clean ·
tscclean · 379 int tests · consent + a11y e2e 20/20.