# PostHog — card for AI agents

Product analytics, session replay, feature flags, error tracking, and surveys platform.

Maker: PostHog · category: Error tracking and analytics

## Price (official page)
- Free tier: 1M events, 5K session replays, 1M feature flag requests, 100K exceptions, 1500 survey responses per month
- Free tier terms: free allowance · monthly · card not needed · amount: 1M events (read from the wording above and the pricing page; empty = not stated)
- Usage price: Usage-based pricing per product (events, replays, requests, exceptions, responses, etc.)
- Pricing page: https://posthog.com/pricing (checked 2026-10-09)
- Note: Added automatically: its SDK was in 90 of the public agent repos we sampled when it was added. Prices read from the official pricing page. The main repo PostHog/posthog is MIT outside ee/ (LICENSE). Privacy policy: PostHog may use customer content, aggregated or de-identified, for training its own models.

## Connect
- npm: `npm install posthog-js`
- PyPI: `pip install posthog`
- Repository: https://github.com/PostHog/posthog

## For AI agents on PostHog's own site (AgentGid check 2026-11-13: 4 of 6)
- llms.txt: https://posthog.com/llms.txt
- Docs pages as Markdown: 100% of the pages llms.txt lists
- OpenAPI description: https://posthog.com/openapi.json
- Official MCP server: no · official SDK: yes · status page: no
- robots.txt lets AI assistants (ChatGPT-User, Claude-User) read the site: yes

## A year of price history (Internet Archive copies of the pricing page, read by rules)
- Months read: 11 (2025-10 to 2026-08) of https://posthog.com/pricing
- Lowest $/month figure on the page: $250 in 2025-10, $250 in 2026-08
- 2026-06: no longer shown $2000/mo (archived copy: https://web.archive.org/web/20260601122037/https://posthog.com/pricing)
- A figure is any "$X/month" on the page (plans, seats and add-ons alike); open the archived copy to see which plan it is.

## Price history in AgentGid's catalog (since 2026-10-09)
- Changes recorded: 0 (a vendor price change or an editor's correction; the evidence archive keeps the pricing page of each date)

## Other APIs in this category
- Airbrake: https://agentgid.com/apis/airbrake/agent.md
- Sentry: https://agentgid.com/apis/sentry/agent.md
- Mixpanel: https://agentgid.com/apis/mixpanel/agent.md
- New Relic: https://agentgid.com/apis/new-relic/agent.md
- GrowthBook: https://agentgid.com/apis/growthbook/agent.md

## Links
- AgentGid page: https://agentgid.com/apis/posthog/


## PostHog: see what users do in your product

PostHog is an online service that records what people do in your website or app, such as page views, clicks and sign-ups, and turns it into charts. The same account also gives you screen recordings of visits, feature switches for gradual launches, error reports and in-app surveys. Each product has a free monthly allowance; above it you pay per use.

### Where to use it
- Find where sign-ups drop off: See how many visitors reach each step from landing page to paid plan, and which step loses the most people.
- Watch recordings of confusing screens: Replay real visits to see where people click, scroll and get stuck, for example on a checkout page.
- Launch a feature to some users first: Turn a new feature on for 10% of users or for beta testers only, and switch it off without a new release if it breaks.
- Catch errors users actually hit: Collect crashes from the browser and the server, then watch the recording of the visit where the error happened.
- Quick in-app surveys: Ask a short question inside your app, such as "How likely are you to recommend us?", and see the answers next to usage data.
- Track the cost of AI features: Log each call your app makes to an AI model, with tokens used and cost, to see which feature is expensive.

### How to start
- Create a PostHog account (US or EU cloud) and copy the project token and host from the project settings.
- Install the browser package (or use the HTML snippet from the docs).

```
npm install --save posthog-js
```

- Initialise it with your token and host; in Next.js read them from public environment variables.

```
import posthog from 'posthog-js'

posthog.init(process.env.NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN, {
  api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST,
  defaults: '2026-08-30'
});
```


### License
PostHog Cloud is a paid online service with a free allowance, used under PostHog's terms. The browser package is open source under Apache 2.0, and the main code is MIT outside its "ee" folder if you host it yourself.

### Good to know
- The free plan needs no card and resets every month, for example 1 million events and 5,000 session recordings.
- On the free plan, events above the limit are dropped for good, and feature flags return a fallback answer.
- You can set a spending limit per product, so a traffic spike does not cause a surprise bill.
- Screen recordings start by default with the browser package; mask private fields and ask for consent where the law requires it.
- PostHog may use your data, anonymized, to train its own models unless you opt out in the app settings.

Checked 2026-11-10 against: https://posthog.com, https://posthog.com/pricing, https://posthog.com/pricing.md, https://posthog.com/llms.txt, https://posthog.com/platform.md, https://posthog.com/docs, https://posthog.com/docs/api, https://posthog.com/docs/api/capture, https://posthog.com/docs/api/flags, https://posthog.com/docs/libraries/js, https://posthog.com/docs/libraries/js.md, https://posthog.com/docs/libraries/next-js.md, https://posthog.com/docs/libraries/node, https://posthog.com/docs/libraries/python, https://posthog.com/docs/settings/projects, https://posthog.com/docs/model-context-protocol, https://posthog.com/docs/privacy/data-collection, https://posthog.com/docs/product-analytics/cutting-costs, https://posthog.com/docs/billing/estimating-usage-costs, https://posthog.com/privacy, https://posthog.com/terms, https://posthog.com/dpa, https://github.com/PostHog/posthog/blob/master/LICENSE, https://github.com/PostHog/posthog-js/blob/main/LICENSE, https://registry.npmjs.org/posthog-js/latest, https://registry.npmjs.org/posthog-node/latest, https://pypi.org/pypi/posthog/json

### Mistakes to avoid
- Don't: Putting a personal API key (phx_...) in browser code to read data from PostHog. → Do: Use only the project token in the browser; call private endpoints from your server with the personal key. (A personal API key gives the same access as being logged into your PostHog account.)
- Don't: Adding posthog-js to a site with a strict Content Security Policy and not updating the policy. → Do: Allow https://*.posthog.com in script-src and connect-src, and blob: in worker-src, or use a reverse proxy. (Blocked requests fail silently and no events arrive.)
- Don't: Sending events to us.i.posthog.com for a project created in the EU cloud (or the other way round). → Do: Use the host shown in your project settings (https://eu.i.posthog.com for EU projects). (Requests must go to the domain of the region where the project lives.)
- Don't: Returning from a serverless function right after client.capture() in posthog-node. → Do: await client.flush() before returning (or shutdown() when the client is no longer needed). (posthog-node queues events and sends them in batches; an unflushed queue is lost when the function stops.)
- Don't: Writing new server code with client.isFeatureEnabled() or getFeatureFlag() in posthog-node. → Do: Call client.evaluateFlags() once per user and read flags.isEnabled() from the snapshot. (The old methods still work during a migration period but are deprecated.)

### Questions
- Is there a free plan? Yes. Every product has a free monthly allowance that resets each month, and no credit card is needed.
- Can the project token be in my website code? Yes. Capture and flag requests use the project token and return no sensitive data; private data endpoints need a personal key that stays on the server.
- Where is my data stored? In PostHog's US cloud (Virginia) or EU cloud (Frankfurt), whichever you pick, or on your own server if you self-host.
- How long is data kept? Events are kept 1 year on the free plan and 2 years on pay-as-you-go; recordings 1 month on free and 90 days on pay-as-you-go.

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
