Repository navigation
Add PostHog and GA4 for logged-out visitors outside the EEA/UK - #2540
Draft
alexleventer wants to merge 3 commits into
Draft
alexleventer wants to merge 3 commits into
alexleventer wants to merge 3 commits into
Conversation
Ports landing's posthog-consent.js to Mintlify as one self-contained file: it loads the vendored PostHog bundle from fly.io, asks fly.io/api/consent-scope for the EEA/UK and logged-in checks, and shows the same banner. Pageviews are captured on client-side route changes. A Legal footer adds a Cookie preferences link to reopen the banner. Refs superfly/docs-tracking#304 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
- A stored Reject now holds outside the EEA/UK too (the footer link is shown to everyone). - Read consent when posthog.js loads, so an Accept clicked before then isn't lost. - Switch PostHog to persistent storage on Accept; Mintlify's client-side nav kept the whole session on a memory-only id. - Only send the catch-up $pageview if PostHog was opted out. - 'Cookie preferences' falls through to the Privacy Policy when the banner can't open. - Drop GTM: ui-ex removed it for double-reporting conversions to GA4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the EEA/UK The banner on docs kept its own consent record, separate from fly.io's, while the cookies it governs are shared on .fly.io. Rather than sync the two, docs shows no banner: EEA/UK visitors get Plausible only, and the banner stays on fly.io. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
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.
Part of superfly/docs-tracking#304. Depends on superfly/ui-ex#5903. #security approved it (thread); merge that first. Until it ships, this script fails closed and loads nothing.
Adds PostHog and GA4 to docs.fly.io for logged-out visitors outside the EEA/UK. There is no consent banner on docs:
A docs banner would keep its own consent record (per-origin localStorage) while PostHog and GA4 cookies are shared on
.fly.io, so the two sites' choices would disagree. If EEA docs data matters later, the follow-up is a shared.fly.ioconsent cookie that docs reads, so docs can honor an Accept made on fly.io.What
fly-analytics.jsdoes:fly.io/static/javascripts/posthog.jsitself, so it doesn't depend onauth-nav.js.https://fly.io/api/consent-scopewith credentials. It only loads anything when the answer is "not EEA/UK, logged out". Fetch failures (Mintlify previews,mint dev, network errors) load nothing.capture_pageview: "history_change", because Mintlify navigates client-side. Internal referrers are rewritten to$direct, as on landing and ui-ex.analytics.fly.ioproxy, same as fly.io. No GTM, because ui-ex dropped it for double-reporting conversions to GA4.docs.jsongets a Legal footer linking the Privacy Policy.Not tested in a browser yet: the CORS change has to be live first. To check after it ships, load docs.fly.io logged out from outside the EEA/UK and confirm posthog.fly.io requests and
$pageviewon navigation. Logged in, or through an EEA edge, there should be none.Open: GA4 counts a
page_viewper full load. Unless the GA4 stream's "page changes based on browser history events" setting is on, client-side docs navigations are undercounted in GA4.Plausible is unchanged. CSP directives for Mintlify are still a separate open item.
🤖 Generated with Claude Code