> ## Documentation Index
> [HTML page](https://blode.md/docs/features/analytics)
> [Documentation index](https://blode.md/docs/llms.txt)
> Use the index to discover all available pages before exploring further.

# PostHog analytics

Connect your own PostHog project key in the dashboard to load analytics on every tenant docs page, with an optional EU host and no content wiring.

Edda does not ship a proprietary analytics tool. Instead, we inject the analytics you already trust: PostHog: into every page of your tenant docs. Paste your key into the dashboard, and the script loads on the next request. There is nothing to wire up in your content.

## Add PostHog

1. Open the dashboard, pick your project, and go to **Settings → Analytics**.
2. Fill in:
   - **PostHog**: paste your project API key (starts with `phc_`). Find it in PostHog → Project settings. Personal API keys (`phx_`) are not supported.
   - **PostHog host**: optional. Defaults to `https://us.i.posthog.com`. Use `https://eu.i.posthog.com` if your project lives in the EU cloud.
3. Save. The next request on your tenant domain loads the script.

Leave the project key empty to disable analytics.

## How it works

When tenant analytics are configured, every request through the docs proxy carries a compact, tenant-scoped header that the root layout reads on the server. We inject a small PostHog provider that initializes `posthog-js` with `capture_pageview: false` and emits a `$pageview` event on every client-side navigation.

PostHog only loads when `VERCEL_ENV === "production"`, so local dev previews and preview deployments never pollute your numbers.

> [!INFO]
> PostHog project keys are public client-side tokens: they are designed to be
>   shipped to the browser. Edda treats them as tenant configuration, not secrets,
>   and surfaces them in the dashboard as-is.

## Managing from the CLI

The same config is available through `edda analytics`:

```bash
edda analytics get --project my-docs
edda analytics set posthog phc_abc... --host https://eu.i.posthog.com --project my-docs
edda analytics unset posthog --project my-docs
```

See the [CLI reference](/cli/analytics) for all options.