Repository navigation
fix(analytics): capture Web Vitals with PostHog - #146
Draft
posthog-eu[bot] wants to merge 1 commit into
Draft
posthog-eu[bot] wants to merge 1 commit into
posthog-eu[bot] wants to merge 1 commit into
Conversation
The PostHog init call did not set capture_performance, so the app sent pageviews but no $web_vitals events. Web Vitals capture stays behind the existing analytics consent gate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Generated-By: PostHog Desktop Task-Id: bfcfecf2-24f9-45fd-a574-ca677b4cf975
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
posthog.initcall insrc/lib/analytics.tsdoes not setcapture_performance. Thus the SDK does not send$web_vitalsevents.Origin
signals-scout-generalChanges
posthog-jsWeb Vitals capture in the existing init call:capture_exceptions: true, + capture_performance: { web_vitals: true },/ingest/static/…. The existing proxy already sendsstatic/*requests to the PostHog assets host, so no proxy change is necessary.before_sendfilter also applies to$web_vitalsevents.Note
The consent banner and the privacy page say "pageviews, feature usage, and browser errors" ("for example" on the privacy page). Web Vitals are page-load timings in the same consented analytics scope. This PR does not change that text. Please decide if the text must name performance measurement.
Verification
bun run format:check,bun run lint, andbun run typecheckpass.bun run test:unit: 20 tests in 5 files fail. The same 20 tests also fail onmainwithout this change. They are PDF and export tests that need the ICC and font assets (bun run setup:icc), which the sandbox does not have.$web_vitalsevents arrive in PostHog and that the Web Analytics health check resolves.Agent context
git log -Ssearch was not possible in the partial clone.Created with PostHog Desktop from this inbox report.
🤖 Generated with Claude Code