PostHog
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.
"integrations": {
"posthog": {
"apiKey": "YOUR_POSTHOG_PROJECT_API_KEY",
"apiHost": "optional",
"sessionRecording": true
}
}"integrations": {
"posthog": {
"apiKey": "phc_TXdpocbYTeZVm5VJmMzHTMrCofBQu3e0kN7HGMNGTVW"
}
}Configuration options
Section titled “Configuration options”apiKey(string, required) — Your PostHog project API key. Must start withphc_.
This key is a client-side token meant to be public. It's the same key your browser sends with every analytics event. It's safe to commit to your documentation repository.
-
apiHost(string) — The URL of your PostHog instance. Only required if you are self-hosting PostHog. Defaults tohttps://ph.mintlify.com(Mintlify's PostHog proxy). -
sessionRecording(boolean) — Enable or disable session recording. Set tofalseto disable session recordings while keeping analytics enabled.
Session recordings
Section titled “Session recordings”Configuring PostHog enables session recordings by default. To disable session recordings while keeping analytics enabled, set sessionRecording to false in your configuration.
"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.