> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.manicule.dev/llms.txt
> Use this file to discover all available pages before exploring further.
> For every page in one file, fetch https://mintlify.manicule.dev/llms-full.txt (large).
> To search and read these docs as tools, connect the MCP server at https://mintlify.manicule.dev/api/mcp.
> Every agent surface: https://mintlify.manicule.dev/.well-known/llms-manifest.json

# PostHog (/integrations/analytics/posthog)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 464 · updated: 2026-07-31 -->
Related: [Analytics integrations](/integrations/analytics/overview.md), [Adobe Analytics](/integrations/analytics/adobe.md), [Amplitude](/integrations/analytics/amplitude.md), [Clarity](/integrations/analytics/clarity.md), [Clearbit](/integrations/analytics/clearbit.md), [Fathom](/integrations/analytics/fathom.md)

> Integrate PostHog with your Mintlify documentation site to track product analytics, feature usage, and user behavior with your API key.

Add the following to your `docs.json` file to send analytics to PostHog.

You only need to include `apiHost` if you are self-hosting PostHog. By default, Mintlify proxies events through `https://ph.mintlify.com` to your PostHog project.

<CodeGroup>
```json title="Analytics options in docs.json"
"integrations": {
    "posthog": {
        "apiKey": "YOUR_POSTHOG_PROJECT_API_KEY",
        "apiHost": "optional",
        "sessionRecording": true
    }
}
```

```json title="Example"
"integrations": {
    "posthog": {
        "apiKey": "phc_TXdpocbYTeZVm5VJmMzHTMrCofBQu3e0kN7HGMNGTVW"
    }
}
```
</CodeGroup>

### Configuration options

<ParamField path="apiKey" type="string" required>Your PostHog project API key. Must start with `phc_`.</ParamField>

<ParamField path="apiHost" type="string">The URL of your PostHog instance. Only required if you are self-hosting PostHog. Defaults to `https://ph.mintlify.com` (Mintlify's PostHog proxy).</ParamField>

<ParamField path="sessionRecording" type="boolean" default="true">Enable or disable session recording. Set to `false` to disable session recordings while keeping analytics enabled.</ParamField>

## Session recordings

Configuring PostHog enables session recordings by default. To disable session recordings while keeping analytics enabled, set `sessionRecording` to `false` in your configuration.

```json title="Disable session recordings"
"integrations": {
    "posthog": {
        "apiKey": "phc_your-key",
        "sessionRecording": false
    }
}
```

You need to add the URL for your docs website to PostHog's "Authorized domains for recordings" before you can receive session recordings. The option to add your URL is in PostHog's project settings.
