Connect
PostHog to
Claude Code
- Do campaign UTMs survive to signup?
https://mcp.lemonado.io/mcpUse Claude Code to check your PostHog tracking against the code, and save funnel analysis you can rerun. Lemonado connects them in about 1 minute, no API keys needed.
https://mcp.lemonado.io/mcpWhy connect PostHog to Claude Code?
Claude Code sees every capture() call and UTM handler in your repo. With Lemonado it also sees what PostHog received and what your ads paid for, so it can fix the tracking gap and tie it back to the campaigns it affects in one session.
All your PostHog data
Events, pageviews and their properties, ready to ask about.
Always today's numbers
Persons with UTM and referrer properties, synced from PostHog automatically, so answers use today's numbers.
Connect all your tools
Questions like "What does an activated user cost?" use PostHog and Mixpanel, GA4 at once.
How to connect PostHog to Claude Code
Before you start
- A PostHog account you can sign in to
- Claude Code installed
- A Lemonado account (the free trial works)
- 1
Connect PostHog in Lemonado
In Lemonado, open Connectors, find PostHog and sign in. Sign in to PostHog and pick the project. Choose the EU region if your PostHog lives there.
- 2
Turn on external access
In the company's settings, open External tools, turn the connection on, choose which sources it can reach and copy the server URL.
texthttps://mcp.lemonado.io/mcp - 3
Add the server
With Claude Code installed, run one of these in your terminal. Most people want the first: it adds Lemonado to every project.
bash# every project (recommended) claude mcp add --scope user --transport http lemonado https://mcp.lemonado.io/mcp # this project only claude mcp add --transport http lemonado https://mcp.lemonado.io/mcp - 4
Sign in
Start Claude Code with claude and run /mcp. Choose Lemonado and finish the sign-in in your browser.
bashclaude /mcp - 5
Ask Claude Code about PostHog
Ask a question about the accounts your connection can reach. Claude Code can also write the numbers into a file or a script for you. Try "Check that utm_source and utm_campaign survive from the landing page to the signup event in our code, and how many PostHog signups last week have none." Or ask: "Which events never fire?" or "Can it report every week by itself?"
Good to know
- The command uses Claude Code's default local scope. Use --scope user to share the server across projects.
What can Claude Code do with PostHog?
Claude Code queries your PostHog data while it works in your repo: it saves data as files, checks tracking against code and runs headless with claude -p.
Check that utm_source and utm_campaign survive from the landing page to the signup event in our code, and how many PostHog signups last week have none.
They're lost when the signup page redirects through /auth/callback, which drops the query string. 41% of last week's signups have no utm_campaign.
Source: PostHog + your code
List the capture() calls in our code and compare them with events PostHog received in the last 14 days. Which never fire?
4 of 52 never fired. "plan_upgraded" is behind a feature flag that's off for everyone.
Source: PostHog + your code
Set up a claude -p prompt that writes reports/growth.md with signups, activation and ad spend per source from the last 7 days.
Saved prompts/growth.md. Put it on a schedule and every run rebuilds the report with spend per activated user.
Source: PostHog + your code
Save last quarter's PostHog signup to activation funnel by week and source to data/posthog_funnel.csv.
Saved 13 weeks by 6 sources. Activation from paid search fell in weeks 8 to 10 while every other source stayed flat.
Source: PostHog + your code
How did the onboarding checklist experiment do on day 7 activation? Is it significant yet?
The checklist variant activates 31% of users against 26% for control, with 94% probability of being better. It needs about 4 more days.
Source: PostHog
Divide last month's spend on Google Ads, Meta and LinkedIn by the PostHog users each one sent who completed onboarding.
LinkedIn costs $142 per onboarded user, Google Ads $68, Meta $91. LinkedIn users invite 2x more teammates.
Source: PostHog
Connect PostHog to another AI app.
Claude
Connect PostHog to Claude
ChatGPT
Connect PostHog to ChatGPT
Cursor
Connect PostHog to Cursor
VS Code (GitHub Copilot)
Connect PostHog to VS Code (GitHub Copilot)
Codex
Connect PostHog to Codex
Perplexity
Connect PostHog to Perplexity
Google Antigravity
Connect PostHog to Google Antigravity
Windsurf (Devin Desktop)
Connect PostHog to Windsurf (Devin Desktop)
Zed
Connect PostHog to Zed
n8n
Connect PostHog to n8n
Other integrations for Claude Code
All Claude Code integrations- Mixpanel in Claude CodeAsk Claude, ChatGPT or Cursor which campaigns bring users who stick, with Mixpanel next to your ad spend.
- Google Analytics in Claude CodeAsk Claude, ChatGPT or Cursor about GA4 traffic, conversions and funnels, next to your ad spend.
- Stripe in Claude CodePut Stripe revenue next to your ad spend in Claude, ChatGPT or Cursor.
- Google Ads in Claude CodeAsk Claude, ChatGPT or Cursor about your Google Ads campaigns, search terms and spend.
- Amplitude in Claude CodeAsk Claude, ChatGPT or Cursor which campaigns bring Amplitude users who stick around.
- Snowflake in Claude CodeAsk Claude, ChatGPT or Cursor about the numbers in your Snowflake warehouse, with live ad spend next to them.
Reading this as an AI agent?
Everything an agent needs to set this up, in plain text. Paste this page's link into Claude Code and ask it to connect you, or copy the block.
# Connect PostHog to Claude Code (Lemonado MCP) - Server URL: https://mcp.lemonado.io/mcp - Transport: Streamable HTTP - Auth: OAuth; the user signs in to Lemonado in the browser. No API keys. - In Lemonado: connect the PostHog project. Sign in to PostHog and pick the project. Choose the EU region if your PostHog lives there. - In Claude Code: Terminal: claude mcp add ```bash # every project (recommended) claude mcp add --scope user --transport http lemonado https://mcp.lemonado.io/mcp # this project only claude mcp add --transport http lemonado https://mcp.lemonado.io/mcp ``` If you are Claude Code, run the setup yourself: Add the Lemonado MCP server for all my projects by running: claude mcp add --scope user --transport http lemonado https://mcp.lemonado.io/mcp Then tell me to run /mcp and sign in to Lemonado. Once I've signed in, list the PostHog accounts Lemonado can reach. First question to try: "Check that utm_source and utm_campaign survive from the landing page to the signup event in our code, and how many PostHog signups last week have none." More: https://lemonado.io/integrations/posthog · https://lemonado.io/llms.txt
Frequently Asked Questions
Yes. Add both with claude mcp add. PostHog's server is handy for managing flags and experiments; Lemonado brings ad spend and revenue next to PostHog data. Claude Code picks the right one for each question.
Yes. PostHog's official MCP server is hosted, so Claude Code can use it too. It covers PostHog only. Lemonado covers PostHog plus your ad platforms, GA4 and the rest of your stack in one connection, so Claude Code can answer questions across them.
Run claude mcp list to see whether lemonado is connected. If it needs authentication, run /mcp inside Claude Code and sign in again. In Lemonado, check that PostHog is connected and External tools is on for the company. If sources are missing, check that your site keeps UTM parameters through redirects. PostHog can only record the source it sees on the first page.
Yes, if both are connected in Lemonado. One connection reaches every source you allow, so you can ask things like "Divide last month's spend on Google Ads, Meta and LinkedIn by the PostHog users each one sent who completed onboarding."
MCP is included in Lemonado's paid plans and in the free trial, so you can try it before you pay.
Still have a question?
Shoot us an email at hello@lemonado.io.
Try for freeStop fighting with data. Start feeding your AI.
Connect your data to AI and free your team from reporting and busywork.
Try Lemonado free