Skip to content

chore(analytics): add PostHog to the docs site via posthog-docusaurus - #1749

Merged
yujonglee-berri merged 2 commits into
mainfrom
litellm_posthog_docusaurus_plugin
Sep 26, 2026
Merged

yujonglee-berri merged 2 commits into
mainfrom
litellm_posthog_docusaurus_plugin

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Carries #1746 by @misbahsy forward (his commit is kept on this branch) and swaps the hand-rolled snippet plugin for the official posthog-docusaurus plugin, per https://posthog.com/docs/libraries/docusaurus. The fork branch behind #1746 does not accept pushes from here, so this PR supersedes it.

['posthog-docusaurus', { apiKey, appUrl: 'https://us.i.posthog.com', enableInDevelopment: false, ...posthogInitOptions }]

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 to a/button clicks). Every extra option is forwarded to posthog.init through JSON.stringify, which is fine here since none of them are functions.

The one deliberate change is capture_pageview: true instead of 'history_change'. The plugin ships a client module that calls posthog.capture('$pageview') in onRouteUpdate on every path change, so keeping the SDK's own SPA tracking on would have counted each navigation twice. Docusaurus also appends id: "default" to the forwarded options; posthog-js ignores unknown keys.

Verified with npm run build: the generated index.html contains a single posthog.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

misbahsy and others added 2 commits September 25, 2026 19:53
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>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@vercel

vercel Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
litellm Ready Ready Preview Sep 26, 2026 3:50am UTC

Request Review

@yujonglee-berri
yujonglee-berri merged commit 7538a67 into main Sep 26, 2026
4 checks passed
@yujonglee-berri
yujonglee-berri deleted the litellm_posthog_docusaurus_plugin branch September 26, 2026 03:53

This branch was successfully deployed

1 active deployment
Preview — 27e56b7d Deployed Sep 26, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants