feat: PostHog on the docs, through a same-site /relay proxy - #67
Merged
Merged
Conversation
Loads PostHog (project "t1", id 624862) from a head script and sends it through /relay, a Netlify proxy to PostHog, so ad blockers see a request to docs.t1protocol.com. The same proxy serves t1protocol.com, which Firebase Hosting cannot proxy itself. Skipped on localhost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ Deploy Preview for t1docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Why: the t1 docs had only Google Analytics, which ad blockers drop, and nothing we could use for session replay or error tracking.
What: loads PostHog (new project "t1", id 624862, shared with t1protocol.com) through a same-site
/relayNetlify proxy. The landing page reuses that proxy, because Firebase Hosting cannot proxy itself.Changes
docusaurus.config.mjs: aheadTagsscript that loads the PostHog snippet withapi_host: location.origin + "/relay"(so deploy previews use their own relay), captures page views on client-side navigation, and captures exceptions. It doesn't run on localhost.netlify.toml:/relay/static/*proxies tous-assets.i.posthog.comand/relay/*tous.i.posthog.com, the same rules amplifi's app uses.How to test
On the deploy preview, open DevTools → Network:
/relay/static/array.jsand/relay/e/should return 200, with nothing going toposthog.com. Events appear in https://us.posthog.com/project/624862 with the preview's$host.yarn buildpasses, andbuild/index.htmlcontains the snippet.User prompts
🤖 Generated with Claude Code