Skip to content

feat: capture anonymous homepage page_view analytics#522

Merged
Ehesp merged 1 commit into
mainfrom
feat/homepage-posthog-analytics
Jul 7, 2026
Merged

feat: capture anonymous homepage page_view analytics#522
Ehesp merged 1 commit into
mainfrom
feat/homepage-posthog-analytics

Conversation

@claude

@claude claude Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Requested by Elliot Hesp · Slack thread

Summary

Before: The marketing homepage (/) recorded no analytics. Only served docs pages fired PostHog docs:page_view events, so we had no visibility into homepage traffic.

After: Loading the homepage fires an anonymous homepage:page_view PostHog event, using the identical anonymity model as the docs pages.

How: The homepage is served by the same Pages Router getServerSideProps catch-all in app/src/pages/[[...path]].tsx; the empty-path (kind: "home") branch previously returned early without any capture. It now calls the shared getPostHogClient()?.capture(...) with the same cookieless daily-rotating visitorId(ip, userAgent, ...) distinctId, $process_person_profile: false, $raw_user_agent, and the EU host / disableGeoip config used by docs:page_view. No new dependencies, no client-side JS, no cookies, no unhashed IP or PII. Event disabled automatically when POSTHOG_KEY is unset (helper returns null).

Scope

  • app/ (hosted site, MCP, Ask AI)
  • packages/cli/
  • packages/mdx-bundler/
  • docs/ (product documentation)
  • Repo / CI / other

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactor / chore

Test plan

  • bunx @biomejs/biome check passes on the changed file
  • bunx tsc --noEmit introduces no new type errors (pre-existing image-asset import errors are unrelated and present on main)
  • Tested locally (bun dev, CLI command, or other relevant command)
  • Updated docs/ (if user-facing)
  • Verified on a docs.page URL or local preview (if rendering/routing changed)

Notes for reviewers

Reuses the existing getPostHogClient, readVisitorHeaders, visitorId, and incomingHttpHeadersToWebHeaders helpers already imported in the file — no new imports or dependencies. The capture mirrors the docs:page_view site exactly for anonymity (cookieless daily-rotating visitor hash, no person profile, EU host).


Generated by Claude Code

The marketing homepage now fires an anonymous PostHog page_view event
mirroring the served docs pages: a cookieless daily-rotating visitor
hash as the distinctId, no person profile, and the EU host.
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@railway-app railway-app Bot temporarily deployed to docs.page / docs.page-pr-522 July 7, 2026 11:03 Destroyed
@railway-app

railway-app Bot commented Jul 7, 2026

Copy link
Copy Markdown

🚅 Deployed to the docs.page-pr-522 environment in docs.page

Service Status Web Updated (UTC)
docs.page ✅ Success (View Logs) Web Jul 7, 2026 at 11:04 am

@Ehesp Ehesp marked this pull request as ready for review July 7, 2026 11:51
@cursor

cursor Bot commented Jul 7, 2026

Copy link
Copy Markdown

Bugbot is not enabled for this team, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@Ehesp Ehesp merged commit aa07b93 into main Jul 7, 2026
3 checks passed
@Ehesp Ehesp deleted the feat/homepage-posthog-analytics branch July 7, 2026 11:51
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.

3 participants