Skip to content

Website: cookieless PostHog visit counts - #1401

Merged
nedtwigg merged 3 commits into
mainfrom
website-posthog
Oct 28, 2026
Merged

nedtwigg merged 3 commits into
mainfrom
website-posthog

Conversation

@nedtwigg

Copy link
Copy Markdown
Member

Counts visits to dormouse.sh with PostHog (US Cloud) in cookieless mode, so there's no consent banner.

  • What is sent:

    Autocapture, session replay, heatmaps, surveys, feature flags and identify are all off (person_profiles: "never").

  • Storage: nothing is kept in cookies, localStorage, sessionStorage or IndexedDB. posthog-js's one unavoidable localStorage check at init writes a test value and removes it at once. The test pins that this is the only write, and Privacy says so.

  • Where it runs:

    • only on the dormouse.sh hostname, so previews send nothing
    • never under Global Privacy Control or Do Not Track
    • posthog-js (slim, never loads a remote script) sits in its own lazy chunk that loads at the first event
  • First-party proxy: requests go through dormouse.sh/ingest. A Pages advanced-mode _worker.js is limited to /ingest/* by _routes.json, and every other request is the static site, as before. It follows PostHog's Cloudflare guide: drops cookies and authorization, and forwards the visitor's IP as X-Forwarded-For so unique-visitor hashing works.

  • Never in shipped code: outbound-lint gains an analytics SDK form that no class admits, with self-test cases. FAIL IF S280 (security-local.md) keeps analytics out of everything Dormouse ships.

  • Privacy names PostHog as a processor and says what it receives, how it counts unique visitors, that it does no location lookup, and that GPC and DNT turn it off. The legal basis is legitimate interest.

  • Specs: website-docs.md → new "Visit analytics" section, and pricing.md's ref rule now says the pageview carries the ref.

Before merge: in PostHog, go to Settings → Project → Web analytics and turn on Enable cookieless tracking. Without it, PostHog drops every event.

🤖 Generated with Claude Code

nedtwigg and others added 3 commits October 28, 2026 02:16
PostHog in cookieless mode on the marketing site only: a pageview per path
(the Hosted page's carries the visit's ref), a Hosted plan click, and a
completed tutorial. Slim no-external posthog-js, imported on the first event,
only on dormouse.sh, and never under Global Privacy Control or Do Not Track.
A Pages advanced-mode Worker, limited to /ingest by _routes.json, forwards to
PostHog's US hosts with the visitor address and without cookies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
website-docs.md gains a Visit analytics contract; pricing.md's ref rule says
the pageview carries it; security-local.md's Network policy gains S280 (no
analytics SDK ships in Dormouse). Privacy names PostHog as a processor, says
what it receives and how it counts without storage, and that GPC and DNT turn
it off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 55340ac
Status: ✅  Deploy successful!
Preview URL: https://318cba29.mouseterm.pages.dev
Branch Preview URL: https://website-posthog.mouseterm.pages.dev

View logs

@dormouse-bot dormouse-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I found nothing to change in the diff. I'm holding the approval only because the description's Before merge step (PostHog → Settings → Project → Web analytics → Enable cookieless tracking) is a setting nobody outside the project can check. If that step is done, this is ready.

@nedtwigg

Copy link
Copy Markdown
Member Author

The project owner confirmed that Enable cookieless tracking is on in the PostHog project (Settings → Project → Web analytics).

@dormouse-bot dormouse-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for confirming cookieless tracking is on. That was the only thing holding this, so it's ready.

@nedtwigg
nedtwigg merged commit 7a80230 into main Oct 28, 2026
14 checks passed
@nedtwigg
nedtwigg deleted the website-posthog branch October 28, 2026 09:49
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