AnalyticsPostHog
Analytics

PostHog

Track product analytics events on your documentation site with PostHog.

PostHog captures product analytics events so you can understand how readers interact with your documentation. Enable the integration to send page views and events to your PostHog project.

Prerequisites

  • A PostHog account with a project created

  • Your PostHog project API key (starts with phc_)

  • Publishing access to your documentation project

Configure from the Editor

Open Site Config

In the Editor, click Site Config in the top toolbar.

Navigate to Integrations

Select Integrations from the left sidebar.

Enable PostHog

Select PostHog and enter your project API key. Optionally update the API host if you use a self-hosted or EU instance.

Publish

Click Publish to deploy the integration to your live site.

Configure via documentation.json

Add the posthog key under integrations in your documentation.json:

{
  "integrations": {
    "posthog": {
      "apiKey": "phc_your_project_key",
      "apiHost": "https://us.i.posthog.com"
    }
  }
}
PropertyTypeRequiredDescription
apiKeystringYesYour PostHog project API key (starts with phc_)
apiHoststringNoYour PostHog instance URL (defaults to https://us.i.posthog.com)

Where to find your API key

  1. Sign in to PostHog.

  2. Go to Project SettingsProject API Key.

  3. Copy the API key (format: phc_...).

If you use PostHog Cloud EU, set apiHost to https://eu.i.posthog.com. For self-hosted instances, use your own PostHog domain.

What's next