chore(analytics): adopt posthog-js defaults 2026-05-30#2788
Conversation
Set the `defaults: "2026-05-30"` config flag on the browser posthog.init call so the app opts into the latest posthog-js default behaviors. This value was introduced in posthog-js 1.378.0, so bump the dependency from ^1.283.0 to ^1.378.0 (lockfile resolves to 1.386.6). Generated-By: PostHog Code Task-Id: 9b346513-66e9-4766-a449-e2c158abf8d5
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
|
Reviews (1): Last reviewed commit: "chore(analytics): adopt posthog-js defau..." | Re-trigger Greptile |
pauldambra
left a comment
There was a problem hiding this comment.
Note
🤖 Automated comment by QA Swarm — not written by a human
QA Swarm review complete. See inline comments.
|
Note 🤖 Automated comment by QA Swarm — not written by a human Multi-perspective review: paul-reviewer, xp-reviewer, security-audit (qa-team skipped — not available on disk) Verdict: 💬 APPROVE WITH NITSNo blockers. The whole change is one Key findings🟡 MEDIUM
🟢 LOW
ConvergenceBoth paul and xp independently flagged (a) the opaque epoch string / version coupling and (b) that the epoch may make neighboring explicit options redundant — highest-confidence items. Reviewer summaries
Automated by QA Swarm — not a human review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 23ecb810d8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Address convergent qa-swarm review feedback (paul + xp): the bare `defaults: "2026-05-30"` reads as an opaque date. Document that it's a named posthog-js defaults epoch, that it requires posthog-js >= 1.378.0 (kept in sync with package.json's floor), and that the explicit options below intentionally override it (posthog-js merges the epoch first, explicit config last). Generated-By: PostHog Code Task-Id: 9b346513-66e9-4766-a449-e2c158abf8d5
The 2026-05-30 defaults epoch sets capture_pageview to "history_change", which auto-captures a pageview on every history change. The app routes via createHashHistory(), so the route lives in the URL hash and $pathname is identical across every screen — automatic pageviews would collapse all routes into one and corrupt route-level analytics. Set capture_pageview: false to opt out. Addresses Codex review finding (P2). Generated-By: PostHog Code Task-Id: 9b346513-66e9-4766-a449-e2c158abf8d5
There was a problem hiding this comment.
Gates denied: this is a dependency version bump (~100 minor versions of posthog-js) which requires human review. Additionally, there is an unresolved inline comment explicitly flagging that session recording correctness needs a manual runtime smoke test before merge, which the automated reviewer deferred to a human.
Problem
The browser SDK was running without the
defaultsconfig flag, so it stayed on legacy posthog-js behavior instead of the current recommended defaults.Changes
defaults: "2026-05-30"on the browserposthog.initcall inposthogAnalyticsImpl.ts, opting into the latest posthog-js default behaviors, with a comment documenting that it's a named epoch (not a date) and requires posthog-js >= 1.378.0.2026-05-30defaults value was introduced in posthog-js 1.378.0, so bump the dependency from^1.283.0to^1.378.0(lockfile now resolves to 1.386.6).capture_pageview: false. The epoch flipscapture_pageviewto"history_change", but this app routes viacreateHashHistory()— the route lives in the URL hash and$pathnameis identical for every screen, so automatic pageviews would collapse all routes into one and corrupt route-level analytics. Opt out and rely on explicit instrumentation. (If route-level pageviews are wanted later, abefore_sendthat rewrites$pathname/$current_urlfrom the hash is the path.)Capture delta from adopting the epoch (for the record):
session_recording.strictMinimumDuration,external_scripts_inject_target: head,persistence_save_debounce_ms: 250,split_storage,detect_google_search_app, and content-masking ignorelist tweaks. No new autocapture/network instrumentation; automatic pageviews explicitly disabled.How did you test this?
pnpm --filter @posthog/ui typecheckpasses (confirmsdefaults: "2026-05-30"andcapture_pageview: falseare valid config in the bumped SDK).Automatic notifications
Created with PostHog Code from a Slack thread