chore(analytics): add PostHog to the docs site via posthog-docusaurus - #1749
Merged
Merged
Conversation
Loads PostHog on production builds only, using the same project as the Webflow marketing site so a visitor moving between www.litellm.ai and docs.litellm.ai is one person and one journey. Scoped to analytics and nothing else: session replay, heatmap capture, surveys and $pageleave are all off, so the docs pull four non-blocking requests and neither the rrweb nor the surveys bundle is downloaded. Autocapture is limited to clicks on links and buttons, which records outbound demo clicks with their href. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
Carries #1746 by @misbahsy forward (his commit is kept on this branch) and swaps the hand-rolled snippet plugin for the official
posthog-docusaurusplugin, per https://posthog.com/docs/libraries/docusaurus. The fork branch behind #1746 does not accept pushes from here, so this PR supersedes it.Behaviour is the same as #1746: production builds only, same project token, and the same analytics-only config (no replay, heatmaps, surveys, or
$pageleave; autocapture narrowed toa/buttonclicks). Every extra option is forwarded toposthog.initthroughJSON.stringify, which is fine here since none of them are functions.The one deliberate change is
capture_pageview: trueinstead of'history_change'. The plugin ships a client module that callsposthog.capture('$pageview')inonRouteUpdateon every path change, so keeping the SDK's own SPA tracking on would have counted each navigation twice. Docusaurus also appendsid: "default"to the forwarded options; posthog-js ignores unknown keys.Verified with
npm run build: the generatedindex.htmlcontains a singleposthog.init(...)with exactly the intended options.Link to Devin session: https://app.devin.ai/sessions/eaee417f4e0040d6a9d6a15faa663d63
Open in Devin Desktop: https://app.devin.ai/desktop/session/eaee417f4e0040d6a9d6a15faa663d63?variant=devin
Requested by: @yujonglee-berri