Repository navigation
Description
Summary
A tab that opens on Home sends Google Analytics (GA) the real pad address and title. It happens when the reader moves to a pad inside the app. GA's own history listener sends that page_view. Our redaction runs only in the first gtag('config') call, and only when the first page is a pad.
This issue does three things:
- It stops most of the leak today in GA Admin, with no deploy.
- It records the GA ruling of 2026-11-11 (ruling): GA is off until [Idea]: Launch-legal and listing compliance backlog #241 ships the cookie notice and opt-out.
- It ships the GA-off rebuild (Step 3B).
Benchmark
| Field | Value |
|---|---|
| Metric | (1) page_view hits whose dl holds a pad path, per Home-to-/demo move, count. (2) gtag/js and collect requests on Home and /demo after Step 3B, count. |
| Before | (1) 1, live test on 2026-11-08, n = 1. The maintainer takes the 5-trial Step 1 before trace for (1) only, before the GA Admin change. (2) Both load today: GA is on (live site, 2026-11-11). |
| After | Not measured yet. |
| Condition | A Chrome Guest window with no extensions, DevTools "Preserve log" and "Disable cache", against https://docs.plus at the deployed SHA. |
| How to run | Step 1 items 1-3, 5 trials per side, page_view count. DevTools Network, filters gtag/js and collect. |
| Pass rule | (1) 0 in 5 of 5 trials. (2) 0 gtag/js and 0 collect requests on Home and /demo. |
| Guard | Step 1b runs after the Step 1 before trace (approved 2026-11-11). |
| Owner | Maintainer: Steps 1, 1b and 3B, the traces and GA Admin. Agent in the repo: the privacy.tsx edit. |
| Claim | "docs.plus sends Google no pad address or title: <x> leaking page views per Home-to-pad move → 0." <x> is the Step 1 5-trial before. |
Rows
| Metric | Before | After | Method |
|---|---|---|---|
page_view hits whose dl holds a pad path, per Home-to-/demo move |
1 (live test, 2026-11-08) | Not measured yet | Step 1 trace, 5 trials |
| Stored pad paths in GA | Full history | Not measured yet: deletion request filed, retention 2 months | GA Admin, request date recorded (Step 1b) |
gtag/js and collect requests on Home and /demo |
Both load (GA on) | Not measured yet: 0 and 0 after Step 3B | DevTools Network |
Evidence
All code reads are at 0b302b222, the commit production runs.
- Read from code, 2026-11-11.
apps/webapp/src/components/GoogleAnalytics.tsx:14defines the redacted page fields.:34passes them togtag('config')only whendocumentShellis true at first render. The file has no route-change handler. Its last change is355d640e6(2026-08-25). - Read from code, 2026-11-11.
apps/webapp/src/pages/_app.tsx:195-201holds the onlyrouter.eventshandler, and it only preloads styles. No code sends a manualpage_view. - Read from code, 2026-11-11.
apps/webapp/src/utils/analytics.ts:8-13:trackEventsends no page fields. So GA readspage_locationandpage_titlefrom the live URL anddocument.title. Callers:useSendMessage.ts:119,useInitializeNewDocument.ts:55,pwaInstallStore.ts:73,_app.tsx:143-151(web vitals) andtrackSignUpOnceinanalytics.ts. - Live browser test, 2026-11-08. Load
https://docs.plus/, then runwindow.next.router.push('/house-london')in the console. GA received onepage_viewwithdl=https://docs.plus/house-london. On a direct pad load, ahistory.pushStateto?h=…sent no hit. - GA reports, 28 days to 2026-11-08. 3,207
page_view, 2,452scroll, 1,088user_engagement, 198form_startand 29click. GA sendslink_urlwithclick, andform_destinationwith form events (GA help, answer 9216061). - GA Admin, read 2026-11-08. The property change history showed no change in the 30 days before. No change is recorded since.
- Live site, 2026-11-11. The production
_appchunk loads GA with the same config shape. So GA is on. - Rule on [Idea]: Launch-legal and listing compliance backlog #241. Phase 4 says: do not switch on GA in a production build before the cookie notice and the opt-out control exist. GA is on, and neither exists.
Risk
- Pad titles and
?h=heading trails are text that users wrote. Every Home-to-pad move sends them to Google, under the GA property's retention. clickand form events can also carry link targets and form URLs from inside pads.privacy.tsx:46-49tells readers that GA counts page views only. The data GA receives is wider than that.
Steps
Step 1 — GA Admin: turn off the history listener and the content events
Owner: maintainer, GA Admin console (Editor role). Deploy: none. Run it before the Step 3B deploy.
- Open a fresh Chrome Guest window with no extensions, so no ad blocker hides GA hits. Open DevTools → Network. Tick "Preserve log" and "Disable cache". Type
collect?v=2in the filter box. - Record the "before" trace, 5 times. Open
https://docs.plus/. In the Console, runwindow.next.router.push('/demo'). Wait 10 s. Switch to another tab and back, which flushes queued hits. Close the window between trials. - Open each
collectrequest → Payload. GA batches events into one POST; each payload line is one event with its ownen=. Record counts only, per trial. Count theen=page_viewhits after the Home one, and the hits whosedlholds/demo. GA batches hits, so one trial can miss or merge them; 5 trials show the spread. - In GA: Admin → Property → Data collection and modification → Data streams → the web stream.
- Under Events, click the gear on "Enhanced measurement". Take a screenshot of the panel and of Page views → "Show advanced settings". Crop out the account header. Keep it for rollback.
- In Page views → "Show advanced settings", untick "Page changes based on browser history events". Leave "Page views" on.
- Turn off Scrolls, Outbound clicks, Site search, Form interactions, Video engagement and File downloads. Click Save.
- On the stream page, under Events, open "Redact data". Keep email redaction on. Turn on "Redact URL query parameters". Add each key and press Enter after each:
h,id,msg_id,chatroom,open_heading_chat,notification_id,act,c_id,m_id,mode,code,error,error_code,error_description. Save.- The pad keys come from
packages/pad-url/src/padUrlCore.ts:63-86and:170-186.notification_idcomes fromapps/webapp/src/hooks/useNotificationClickBridge.ts:13. The sign-in return can addcodeanderror_codeon Home.
- The pad keys come from
- Wait 10 minutes. Run the Step 1 checks under Verify.
- Comment on this issue with the date and the change type from Admin → Property change history. Do not paste the account name.
This is a partial stop. In a Home-start tab, user_engagement, send_message, create_document and sign_up still carry the live URL and title. GA cannot turn off user_engagement. Step 3B closes the rest.
Step 1b — GA Admin: delete the stored pad paths
Owner: maintainer, GA Admin console. Deploy: none.
Approved 2026-11-11 (ruling). Run it after the Step 1 before trace. A data deletion request cannot be undone, and that is intended.
- Admin → Property → Data collection and modification → Data deletion requests. Request deletion of
page_location,page_titleandpage_referrerfor the full date range. - Admin → Property → Data collection and modification → Data retention. Set event data retention to 2 months.
- Comment here with the request date and the retention value. Do not paste the account name.
The steps above stop new leaks. This step removes the pad paths and titles that GA already holds.
Step 3A — moved to #241
Step 3A (the code fix and its Cypress check) moved to #241. It is a precondition for turning GA back on. It does not run in v2.3.6.
Step 3B — Turn GA off until the #241 cookie notice exists (ruled B)
Owner: maintainer, SSH as the deploy user (the env file owner; no sudo needed). Deploy: one forced production deploy, outside planned events.
The host env file is the ENV_SOURCE path at .github/workflows/prod.docs.plus.yml:82. Edit that file, not .env.production: scripts/ci/prepare-deploy-env.sh:10 rebuilds .env.production on every run.
- Back up the file owner-only:
F=/opt/projects/prod.docs.plus/.env; install -m 600 "$F" "$F.bak-ga-$(date +%F)". Delete the backup once every Step 3B check passes (Make the production env files readable by their owner only #742). - Empty the ID:
sed -i 's/^NEXT_PUBLIC_GA_ID=.*/NEXT_PUBLIC_GA_ID=/' "$F". - Check without printing the ID:
grep -c '^NEXT_PUBLIC_GA_ID=$' "$F"prints1.- 3a. Owner: maintainer, SSH as the deploy user. If Move the production runner to its systemd unit and its own root, and remove the stage runner #743 step 4 has not run, restart the runner before the dispatch, so it reloads
.env. The runner loadedENV_SOURCEinto its own environment at start, and compose prefers shell values over--env-file. So a stale runner can bake the old ID into the build. After Move the production runner to its systemd unit and its own root, and remove the stage runner #743, the app env is no longer in the runner's environment. Agtag/jsrequest after the deploy means the runner env was stale.- Restart only with no job in progress. Set up the
pm2()shim from Move the production runner to its systemd unit and its own root, and remove the stage runner #743 step 1. Runpm2 restart prod.docs.plus-runner. - Pass:
pgrep -af '[/]opt/projects/prod.docs.plus/bin/Runner.Listener'shows one listener with a new pid.
- Restart only with no job in progress. Set up the
- 3a. Owner: maintainer, SSH as the deploy user. If Move the production runner to its systemd unit and its own root, and remove the stage runner #743 step 4 has not run, restart the runner before the dispatch, so it reloads
- From a repo checkout:
gh workflow run prod.docs.plus.yml --repo docs-plus/docs.plus --ref main -f force_deploy=true.NEXT_PUBLIC_*values are build args (docker-compose.prod.yml:512,apps/webapp/docker/Dockerfile.bun:143,166), so the webapp image rebuilds. GoogleAnalytics.tsx:20then renders nothing, andtrackEventfinds nogtag.- Owner: agent in the repo. Make the privacy page match: remove the GA bullet at
apps/webapp/src/pages/privacy.tsx:46-49, through thetech-writerskill. Land thisprivacy.tsxedit first. Collect real-user Web Vitals through a first-party beacon to the REST API #731 rebases on it. - Step 3A now lives in the [Idea]: Launch-legal and listing compliance backlog #241 work (maintainer comment on [Idea]: Launch-legal and listing compliance backlog #241). Its code fix and its Cypress check are preconditions for turning GA back on.
Verify
Run each browser check in the Step 1 Guest window set-up.
Step 1 (GA Admin).
| Check | Before | After |
|---|---|---|
Open https://docs.plus/, run window.next.router.push('/demo'), wait 10 s, flush |
One en=page_view with dl=https://docs.plus/demo |
No en=page_view, en=scroll, en=click or en=form_start after the Home view |
Open https://docs.plus/demo directly; click a TOC heading; open and close a heading chat |
One page_view with dl=https://docs.plus/(document) |
The same: exactly one |
Open https://docs.plus/?error_code=test |
dl holds error_code=test |
dl shows (redacted) or no query |
Expected residue after Step 1: in the Home-start tab, en=user_engagement still carries dl=https://docs.plus/demo.
Step 3A (code fix). Its checks moved to #241 with Step 3A.
Step 3B (GA off), live after the deploy.
- Load
https://docs.plus/andhttps://docs.plus/demo. Pass: the filtergtag/jsshows no request, and the filtercollectshows none. - Do not use
curl … | grep googletagmanager. The Pages Router injects anafterInteractivescript on the client only, so the server HTML never holds it, even with GA on.
Rollback
- Step 1: re-tick the options from the Step 1 screenshot, and remove the redaction keys. The leak returns at once.
- Step 3A: moved to [Idea]: Launch-legal and listing compliance backlog #241; no rollback here.
- Step 3B: while the backup exists,
install -m 600 "$F.bak-ga-<date>" "$F". After it is deleted, restore the ID line from the Back up the production stores off-host, and drill a restore #748 step 12 password-manager copy. Then run the same forced deploy.
Acceptance criteria
- Step 1 is done, and its date and change type are in a comment here.
- Every Step 1 check passes, with the expected residue only.
- Step 1b ran after the Step 1 before trace, and its request date is in a comment here.
- The 2026-11-11 ruling is linked on [Idea]: Launch-legal and listing compliance backlog #241.
- No
gtag/jsand nocollectrequest on Home or on a pad, and the privacy page no longer names GA. - The
.envbackup copy is deleted. - The Benchmark After values are posted here.
Decisions
- Keep GA on with the code fix (A), or turn GA off until the [Idea]: Launch-legal and listing compliance backlog #241 cookie notice and opt-out exist (B)? Ruled 2026-11-11: B (ruling). GA stays off until [Idea]: Launch-legal and listing compliance backlog #241 ships the cookie notice and opt-out. The reasons recorded before the ruling:
- B follows the rule already recorded on [Idea]: Launch-legal and listing compliance backlog #241, and it removes the leak at its source. It costs one env line and one rebuild.
- Collect real-user Web Vitals through a first-party beacon to the REST API #731 already plans web vitals through a first-party beacon, so B loses no performance data.
- One Lighthouse run on 2026-11-11 showed 141 ms of
gtag.jsscript bootup on Home, with no device or throttle recorded. B removes that cost. It is not re-taken (review, 2026-11-16). - B loses GA visitor counts. Supabase still counts sign-ups and sessions.
- Clients on an old cached bundle keep loading
gtag.jsuntil their service worker updates (apps/webapp/next.config.js:42setsskipWaiting: false). Step 1 covers them meanwhile.
The test GA ID question (old Decision 2) moved to #241 with Step 3A.
Related
- [Idea]: Launch-legal and listing compliance backlog #241: launch-legal backlog; holds the GA rule and the cookie notice work.
- Collect real-user Web Vitals through a first-party beacon to the REST API #731: first-party web vitals; also edits
privacy.tsx, and rebases on the Step 3B edit. - Make the production env files readable by their owner only #742: env files owner-only; the Step 3B backup follows its mode rule.
- Move the production runner to its systemd unit and its own root, and remove the stage runner #743: moves the runner out of the app env root, so Step 3B cannot read a stale ID.
- Back up the production stores off-host, and drill a restore #748: step 15 also edits
privacy.tsx; this issue lands first.
Activity
HMarzban commentedon Nov 11, 2026
Maintainer ruling, 2026-11-11
NEXT_PUBLIC_GA_IDand rebuild. It stays off until [Idea]: Launch-legal and listing compliance backlog #241 ships the cookie notice and opt-out. This stops the pad-title leak at its source. Collect real-user Web Vitals through a first-party beacon to the REST API #731 replaces the web-vitals data.page_location,page_titleandpage_referrerover the full range. Then the maintainer sets data retention to 2 months. This is irreversible, and it is intended: no benchmark needs the stored paths, because every before comes from live traces.HMarzban commentedon Nov 14, 2026
Moved to v2.3.7 at the v2.3.6 release audit. The GA ruling is posted. The 5-trial before trace, the GA Admin steps and the GA-off deploy have no posted result.
HMarzban commentedon Nov 16, 2026
Review, 2026-11-16 (maintainer approved).
gtag/jsand 0collectrequests on Home and/demo" as the Step 3B check.HMarzban commentedon Nov 24, 2026
Measured, 2026-11-24: Step 1 (n = 5 before & after), Step 1b, and Step 3B host prep
Step 1 — Live Chromium traces (Playwright Chromium
159.0.8154.6, fresh context per trial)Notes/release-2.3.7/bench/741/ga-trace.mjs(Homehttps://docs.plus/→window.next.router.push('/demo')→ wait 10 s → visibility flush,n = 5trials per side).2026-11-24T17:00Z):en=page_viewwithdl=https://docs.plus/demoafter push: 5 of 5 trials (1per trial, median1, range1–1).https://docs.plus/demo:1page_view, redacted (dl=https://docs.plus/(document),dt=(document)).2026-11-24):__ccd_em_page_viewremoved from livegtag/js); live__ccd_em_*tags at check:__ccd_em_download,__ccd_em_form,__ccd_em_outbound_click,__ccd_em_scroll,__ccd_em_site_search,__ccd_em_video.h,id,msg_id,chatroom,open_heading_chat,notification_id,act,c_id,m_id,mode,code,error,error_code,error_description) — verified live in__ccd_auto_redact.2026-11-24T17:31Z):en=page_viewwithdl=https://docs.plus/demoafter push: 0 of 5 trials (0per trial,afterPushEvents: []in all 5 trials).https://docs.plus/demo:1page_view, redacted (dl=https://docs.plus/(document),dt=(document)).?h=…):dl=https://docs.plus/?h=(redacted).Step 1b — GA Admin deletion & retention (
2026-11-24)2026-11-24coveringpage_location,page_title, andpage_referreracross the full date range (Jan 3, 2005 – Nov 23, 2026, all values; statusPreview active — In grace period).2 months.Step 3B — Host prep completed (
2026-11-24).envowner-only (install -m 600,.env.bak-ga-2026-11-24), emptiedNEXT_PUBLIC_GA_ID=(grep -c=1), restartedprod.docs.plus-runner, and verifiedNEXT_PUBLIC_GA_IDis absent from/proc/<Runner.Listener>/environ.apps/webapp/src/pages/privacy.tsxupdated locally (removed GA bullet and "and Analytics"; uncommitted, pending maintainer push).2026-11-25 05:00Zforce_deploy, verify0gtag/jsand0collectrequests on Home and/demo, delete.env.bak-ga-2026-11-24, landprivacy.tsx, and link the ruling on [Idea]: Launch-legal and listing compliance backlog #241.