PostHog logo Guide · Analytics

How to add PostHog analytics with Claude Code

PostHog scores 5/5 on our Claude Code fit scale: official Anthropic-marketplace plugin with MCP server + 161 skills. These steps use only PostHog’s and Anthropic’s official instructions; each step links its source.

  1. 1

    Have Claude Code and a PostHog account ready

    You need Claude Code installed and an account with PostHog (posthog.com). Some tools only need the account when the agent first calls a live tool.

    Source: https://code.claude.com/docs/en/mcp

  2. 2

    Install the official PostHog plugin

    Run this in Claude Code (or your terminal, as the source shows):

    /plugin install posthog@claude-plugins-official

    Source: https://code.claude.com/docs/en/discover-plugins

  3. 3

    No marketplace setup needed

    This plugin is in Anthropic’s official marketplace (claude-plugins-official), which Claude Code adds automatically the first time you start an interactive session.

    Source: https://code.claude.com/docs/en/plugins/anthropic-marketplaces

  4. 4

    Connect and verify

    Run /mcp inside a Claude Code session to see connected servers, check status and complete sign-in where the server uses OAuth.

    Source: https://code.claude.com/docs/en/mcp

  5. 5

    Let the skills do the SDK work

    The plugin bundles 161 skills that Claude loads when relevant, or you can call one directly with /skill-name.

    adding-warehouse-person-propertiesanalyzing-expensive-usersanalyzing-experiment-session-replaysanalyzing-task-runsassessing-heatmapsauditing-endpointsauditing-experiments-flagsauditing-warehouse-source-healthauditing-warehouse-view-healthauthoring-data-quality-checksauthoring-error-tracking-alertsauthoring-log-alertsauthoring-scoutsbuilding-a-dashboardbuilding-canvasesbuilding-html-canvasesbuilding-loopsbuilding-react-quill-canvasesbuilding-workflowschecking-deploy-timingchecking-member-accesschoosing-trend-or-slope-viewcleaning-up-stale-feature-flagscomposing-grid-canvases

    Source: https://code.claude.com/docs/en/skills

Official PostHog docs for AI agents

Then just ask

Example prompt (our suggestion, not from vendor docs):

“Help me add PostHog analytics in this project. Follow the PostHog skills, keep secrets in environment variables, and show me the plan before changing files.”

Comparisons

More guides