Skip to content

privacy(feat): split the consent gate by what each provider stores - #400

Merged
Ducksss merged 1 commit into
devfrom
claude/ungate-cookieless-analytics
Jul 28, 2026
Merged

Ducksss merged 1 commit into
devfrom
claude/ungate-cookieless-analytics

Conversation

@Ducksss

@Ducksss Ducksss commented Jul 28, 2026

Copy link
Copy Markdown
Owner

The consent gate shipped all-or-nothing, which cost measurement it did not need to.

Vercel Analytics and Speed Insights are cookieless — no cookies, no identifier, nothing written to the device. They carry no consent requirement, so gating them blinded Core Web Vitals on every visitor who hadn't clicked Accept, for zero privacy gain. That's the data this repo's own perf guardrails depend on.

Two tiers, split on what the provider writes to the device

Provider Loads Why
Vercel Analytics, Speed Insights Always Cookieless, stores no identifier
Google Analytics 4 After opt-in Sets its own _ga cookies, auto-collects page views
PostHog After opt-in Persists pc_distinct_id in localStorage

trackEvent mirrors the same split — the Vercel call is unconditional, GA4 and PostHog stay behind analyticsAllowed(). Event names and fields are unchanged and remain the enumerated vocabulary, never free text.

Preview routes are untouched. AnalyticsShell still returns null before either tier, so an embedded iframe mounts nothing at all — pinned by the existing templates.e2e assertion.

Docs corrected, not just extended

/privacy claimed "nothing on this list loads until you accept," which this change makes false. It now states the split per provider with an "Always on, stores nothing" / "Needs your consent" marker. contributing.mdx documents the rule for adding a provider: the test is not whether the data feels sensitive, it's whether it writes to the device.

Verification

lint clean · tsc clean · 379 int tests · e2e: consent 9/9 (including a new spec pinning that Web Vitals still measure before a choice is made), frontend 50/50 with the landing baselines unchanged, a11y 10/10, templates 90/90.

No visual re-baselining needed — scripts aren't rendered, and the banner behaviour is unchanged.

The gate was all-or-nothing, which cost measurement it did not need to. Vercel
Analytics and Speed Insights are cookieless and store no identifier, so they
carry no consent requirement — gating them blinded Core Web Vitals on every
visitor who had not clicked Accept, for no privacy gain. That is exactly the
data this repo's perf guardrails depend on.

Two tiers now, split on whether the provider writes to the visitor's device:

- Vercel Analytics + Speed Insights mount for everyone. No cookies, no id.
- GA4 (own _ga cookies, own auto-collected page views) and PostHog (persists
  pc_distinct_id) wait for an explicit opt-in, as before.

trackEvent mirrors the same split: the Vercel call is unconditional, GA4 and
PostHog stay behind analyticsAllowed(). Event names and fields are unchanged and
remain the enumerated vocabulary, never free text.

Preview routes are untouched — AnalyticsShell still returns null before either
tier, so an embedded iframe mounts nothing at all.

/privacy now states the split per provider with an "Always on, stores nothing"
or "Needs your consent" marker rather than claiming nothing loads until you
accept, and contributing.mdx documents the rule for adding a provider: the test
is not whether the data feels sensitive, it is whether it writes to the device.

Verified: lint clean, tsc clean, 379 int tests, and e2e — consent 9/9 (including
a new spec pinning that Web Vitals still measure pre-consent), frontend 50/50
with landing baselines unchanged, a11y 10/10, templates 90/90.

Co-Authored-By: Claude Opus 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 28, 2026 10:41
@vercel

vercel Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
payload-components Ready Ready Preview, Comment Jul 28, 2026 10:45am
payload-components-97bf Ready Ready Preview, Comment Jul 28, 2026 10:45am

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Ducksss, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 375c08d5-6b85-46e9-90ec-3b27e01dbcf1

📥 Commits

Reviewing files that changed from the base of the PR and between d5f9918 and 382007f.

📒 Files selected for processing (6)
  • content/docs/contributing.mdx
  • src/app/privacy/page.tsx
  • src/components/site/AnalyticsShell.tsx
  • src/components/site/ConsentSettings.tsx
  • src/lib/analytics.ts
  • tests/e2e/consent.e2e.spec.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/ungate-cookieless-analytics

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Ducksss
Ducksss merged commit 5d45658 into dev Jul 28, 2026
12 checks passed
Ducksss added a commit that referenced this pull request Jul 28, 2026
Both axe suites deliberately skip granting consent so the undecided consent
banner — sitewide chrome — is held to the same accessibility bar. That only
works if axe waits for it, and it wasn't: the banner is client-rendered and
lands 100-200ms AFTER document.fonts.ready, which is the point both suites
analysed at. Measured per route, it was absent at fonts.ready on /, /components
and /templates, and present on a warm /templates/<slug> — so the coverage the
comments claimed was really down to how warm the server was, and inconsistent
between routes in the same run.

Both suites now wait for [data-consent-banner] (the hook consent.e2e.spec.ts
already uses) before analysing. The wait doubles as an assertion that the
banner is on those routes at all; it passes on every route in both suites,
which is what makes the stated scope real rather than incidental. The template
preview routes are exempt because AnalyticsShell returns null there, an
exemption templates.e2e.spec.ts already pins.

No violations surfaced once the banner was reliably in scope, including against
the per-provider banner #400 reshaped — but that is now a checked fact rather
than a coin toss.

Co-authored-by: Claude Opus 5 <[email protected]>
Ducksss added a commit that referenced this pull request Jul 29, 2026
…r adoption, template a11y (#409)

Brings main level with dev (137 commits). Headline items:

- the component wall no longer crops blocks: per-breakpoint zoom pins the twins'
  inner layout width at 1280px (#392), and the 640-1023px band gets a 256px frame
  plus a widened fade (#399). Production was cutting content-quote,
  content-feature-media and content-feature-split by 88/79/78px on a tablet;
  measured on the live site, not inferred. Three viewport tests now assert the fit
  so a curated-at-one-width regression cannot recur silently.
- prettier is adopted: config matched to the house style (#402), the tree
  formatted, and format:check gated in test:release and the CI lint step (#408).
- template a11y and layout fixes (#394, #398, #404), consent gate split by
  provider (#400), axe now waits for the consent banner (#405), CodeQL
  double-escaping fix (#391).

Tree is identical to dev by construction: branched from dev, reparented onto main,
so the diff is exactly the main..dev delta with no squash-divergence conflicts.
@Ducksss
Ducksss deleted the claude/ungate-cookieless-analytics branch August 3, 2026 08:49

This branch was successfully deployed

2 active deployments
Preview – payload-components — 382007f4 Deployed Jul 28, 2026 by vercel[bot]
Preview – payload-components-97bf — 382007f4 Deployed Jul 28, 2026 by vercel[bot]
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.

2 participants