fix(site): replace GA4 with PostHog cookieless analytics#894
Merged
Conversation
GA4 Consent Mode v2 (all consent denied) relies on behavioral modeling that requires some users to accept cookies via a consent banner. Since the site has no consent banner, GA has zero sample data to model from, producing wildly deflated numbers (e.g., Netlify reports ~4300 hits while GA reports ~70 for the same blog post). PostHog's cookieless_mode: 'always' uses server-side hashing with no cookies/localStorage/sessionStorage, giving accurate counts without any consent mechanism. Closes #893 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
✅ Deploy Preview for vjs10-site ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📦 Bundle Size Report🎨 @videojs/html(no changes) Presets (7)
Media (4)
Players (3)
Skins (15)
UI Components (21)
Sizes are marginal over the root entry point. ⚛️ @videojs/react(no changes) Presets (7)
Media (3)
Skins (14)
UI Components (17)
Sizes are marginal over the root entry point. 🧩 @videojs/core(no changes) Entries (5)
🏷️ @videojs/element(no changes) Entries (2)
📦 @videojs/store(no changes) Entries (3)
🔧 @videojs/utils(no changes) Entries (10)
📦 @videojs/spf(no changes) Entries (3)
ℹ️ How to interpretAll sizes are standalone totals (minified + brotli).
Run |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Without the host header, PostHog receives the Netlify domain as the Host header and rejects the request with a 400. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The trailing-slash edge function was intercepting `/ph/e/` with a 301 redirect before the Netlify proxy could handle it, causing a 400 from PostHog on the redirected request. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PostHog's /privacy is their corporate policy, not a data-handling guide for customers' end-users. Remove the link rather than point to an irrelevant page — legal can add one back if needed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
cookieless_mode: 'always'(server-side hashing, no cookies/localStorage/sessionStorage)/ph/*→ PostHog)Closes #893
Context
GA4 Consent Mode v2 (all consent denied) relies on behavioral modeling that requires some users to accept cookies via a consent banner. Since the site has no consent banner and isn't planning on one, GA has zero sample data to model from, producing wildly deflated numbers (Netlify reports ~4300 hits on a blog post while GA reports ~70).
PostHog's
cookieless_mode: 'always'uses server-side hashing (hash(team_id, daily_salt, ip, ua, hostname)) with no client-side storage, giving accurate pageview counts without any consent mechanism.Changes
site/src/components/Posthog.astrorequestIdleCallbacksite/src/layouts/Base.astrosite/netlify.toml/ph/*through to PostHogsite/src/content/pages/privacy.mdxSetup required
Test plan
pnpm build:sitepassespnpm dev)🤖 Generated with Claude Code