Repository navigation
Add PostHog and GA4 behind the consent banner - #2540
Draft
alexleventer wants to merge 1 commit into
Draft
alexleventer wants to merge 1 commit into
alexleventer wants to merge 1 commit 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. |
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, which is waiting on #security. Until that ships, this script fails closed and loads nothing.
What it does (
fly-analytics.js, a port of landing'sposthog-consent.js):fly.io/static/javascripts/posthog.jsitself, so it doesn't depend onauth-nav.jsor any other file. It touches nothingauth-nav.jsuses.https://fly.io/api/consent-scopewith credentials. Logged-in visitors get no tracking at all. If the fetch fails, as on Mintlify previews,mint devor network errors, nothing loads.styles.csswith dark mode support.capture_pageview: "history_change", because Mintlify navigates client-side.analytics.fly.ioproxy, same as fly.io.docs.jsongets a Legal footer with Privacy Policy and a "Cookie preferences" link that reopens the banner.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 and confirm posthog.fly.io requests and
$pageviewon navigation. Logged in, there should be none. Through an EEA edge, the banner should show.Plausible is unchanged. CSP directives for Mintlify are still a separate open item.
🤖 Generated with Claude Code