Skip to content

fix(analytics): switch session replay off for every visitor - #701

Merged
elfensky merged 3 commits into
developfrom
fix/replay-off-without-consent
Dec 4, 2026
Merged

elfensky merged 3 commits into
developfrom
fix/replay-off-without-consent

Conversation

@elfensky

@elfensky elfensky commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Refs #617

Phase 1 stopgap of the unified privacy design: session replay is off for every visitor. Cookieless Umami page counting stays. No consent UI. PR #654 (feat/night-privacy-consent) is untouched; it is reworked against the design later.

What changed

  • src/app/layout.jsx renders only the Umami tracker (/stats.js). RecorderScript (session replay and click/scroll heatmaps) and its test are deleted.
  • The recorder relay is removed: the /recorder.js route and its test, the /api/record and /api/websites/:id/recorder rewrites, and the recorder\.js entry in the page Cache-Control rule (next.config.mjs). A tab that loaded the recorder before the deploy now gets 404 on upload, so it cannot send data until its version reload. The consent work can restore the relay from git.
  • /legal, "Session Recording Protocols": says replay is off, the terminal creates no session recordings and no heatmaps, and earlier recordings fall under Data Retention Protocols. "Last updated" moves to December 2026, as the page's Amendments clause promises. No other legal text changes.
  • The /legal opt-out confirmation now reads "Opted out. This browser now transmits no analytics." The old "from the next page load" was there only because a running recorder could not be stopped. The Umami tracker reads umami.disabled before each send (checked in the production /stats.js).
  • Docs: /docs/infrastructure (analytics proxy, env table, cache table), .planning/codebase/STACK.md, .planning/codebase/INTEGRATIONS.md, .planning/architecture/helldivers-bot-api.md, the AnalyticsOptOut and proxyUmamiScript JSDoc, and a CHANGELOG.md line under Unreleased → Fixed.

Not in this PR: UserSection.jsx still calls umami.identify(userId, { provider }) for signed-in users. The analytics standard puts identity in Tier 2 (consent required). With replay off, it no longer links recordings to an account, but it still links page views to one.

Checks (on e094cc10)

Check Result
npm run lint exit 0. Changed files: 0 errors, 1 warning (dom-no-dangerously-set-innerhtml in layout.jsx, also on develop)
npm run typecheck exit 0
npm run test:unit 204 files, 2155 tests passed (the deleted route test held 6)
npm run build exit 0 (dummy POSTGRES_URL, UPDATE_KEY, UPDATE_INTERVAL, and a dummy UMAMI_SITE_ID, so the production analytics branch renders)
Build output .next/static files that name recorder.js: 0. public/sw.js mentions of recorder: 0. .next/routes-manifest.json rewrites: only /api/send
GitHub checks 6/6 passed: Test & Build, Visual Regression, Review Dependencies, CodeQL, Analyze (actions), Analyze (javascript-typescript)

Runtime checks on f3cf758d (the last code change; e094cc10 changes text only), built app with a throwaway Postgres:

Check Result
Served HTML /, /legal, /archives, /docs: HTTP 200, /stats.js present, no recorder.js or api/record
Removed paths GET /recorder.js, GET /api/record, POST /api/record, GET /api/websites/x/recorder: all 404
Browser, fresh profile, no opt-out flag / and /legal: /stats.js requested once, no recorder script, recorder config or /api/record
Baseline: production helldivers.bot/legal (current main) same check: /recorder.js, /api/websites/<id>/recorder and two /api/record posts

Personal data

Personal data: gdpr:art-6:para-1:pt-a (replay has no consent basis yet, so it stops), gdpr:art-5:para-1:pt-c (data minimisation), gdpr:art-5:para-1:pt-a and gdpr:art-13:para-1:pt-c (the /legal notice states the processing as it is). Each was read with get_clause (GDPR 2026.2) and supports the change. DPOLens has no ePrivacy pack, so Art. 10/2 WVP (consent to read from or store on the device) was not checked through DPOLens.

Reaching production

  1. Merge this PR into develop (rebase).
  2. Version cut PR into develop, then the release PR develop → main and a vX.Y.Z tag. The tag builds the production image; Arcane Git Sync rolls it out.

Until the release, production keeps recording. Switching replay and heatmaps off for the site in the Umami admin stops it at once: the recorder fetches its config from Umami before it records. Recordings made so far stay in Umami with no expiry until they are deleted there. Staging shows no difference: it loads no Umami scripts at all.

Council review

Seat Round 1 Round 2 Round 3
Claude Opus 5.5 8/10, 2 P2, 2 P3 9/10, 1 P3 10/10, no findings
GPT Sol 6.2 8/10, 1 P1 9/10, 2 P2 10/10, no findings
Mistral Large 4 9/10, 1 P3 10/10, no findings 10/10, no findings
  • Fixed: stale tabs could upload through /api/record (P1/P2) and the relay kept "for later" (P3), in f3cf758d. The /legal wording and the opt-out confirmation (2 P2), in e094cc10.
  • Declined: drop export on readOptOut (its test imports it). A pin test for "no recorder" (the consent work re-adds it on purpose). Inline the proxyUmamiScript parameter (smaller diff to keep it).
  • Operator steps, not code: switch replay off in the Umami admin; decide on deleting the existing recordings.

Verdict: approved at e094cc1

🤖 Generated with Claude Code

elfensky and others added 3 commits December 2, 2026 15:21
The layout loaded the Umami recorder (session replay and heatmaps) for
every visitor who had not opted out, without consent. The analytics
standard allows replay only with consent (Tier 2), and the site has no
consent UI yet. No page loads the recorder now. Cookieless Umami page
counting stays.

- layout.jsx renders only /stats.js; RecorderScript and its test go.
- /legal says replay is off; its "last updated" date moves to
  December 2026.
- The /recorder.js relay and the recorder rewrites stay for the consent
  work (phase 3 of the unified privacy design).

Refs #617

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A tab that loaded the recorder before the deploy kept posting replay
data through the /api/record rewrite until its version reload, and a
tab without localStorage never reloads. Nothing on the site needs the
relay now, so /recorder.js, /api/record and
/api/websites/:id/recorder go. The consent work can restore them from
git.

Docs (/docs/infrastructure, .planning/codebase, the API architecture
note) and the changelog line follow.

Refs #617

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
/legal said the terminal "records no visits", which reads as if page
counting stopped too. It now says it creates no session recordings.

The opt-out confirmation said it applies "from the next page load".
That delay existed only because a running recorder could not be
stopped. The tracker checks the flag before each send, so the opt-out
now acts at once.

Refs #617

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@elfensky
elfensky merged commit edf1dd0 into develop Dec 4, 2026
6 checks passed
@elfensky
elfensky deleted the fix/replay-off-without-consent branch December 4, 2026 11:09
This was referenced Dec 4, 2026
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