> ## Documentation Index
> Fetch the complete documentation index at: https://adapt.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# PostHog

> Connect PostHog to Adapt to analyze events, insights, funnels, and retention

Connect PostHog to Adapt so it can read your product analytics. Reading data through PostHog's API requires a personal API key.

## Set up credentials

<Steps>
  <Step title="Find your project API key">
    In PostHog, go to **Settings > Project** and copy the **Project API key**.
    This key identifies your project. Note that it is used mainly for event
    ingestion, not for reading data.
  </Step>

  <Step title="Identify your host">
    Your host depends on where your project is hosted: `https://us.i.posthog.com`
    for US Cloud, `https://eu.i.posthog.com` for EU Cloud, or your own domain for
    a self-hosted instance.
  </Step>

  <Step title="Create a personal API key">
    Go to **Settings > Account > Personal API keys** and click
    **Create personal API key**. Give it a label and select the read scopes you
    need, such as **Query Read**. Click **Create key**.
  </Step>

  <Step title="Copy the personal API key">
    Copy the key now (it starts with `phx_`). PostHog shows it only once, so
    store it securely.
  </Step>
</Steps>

<Note>
  To read analytics data (events, insights, funnels, retention), Adapt needs the
  **personal API key**. The project API key on its own is intended for event
  ingestion and cannot read your data, so provide the personal API key even
  though it is listed as optional below.
</Note>

## Connect to Adapt

<Steps>
  <Step title="Open Integrations">
    In Adapt, go to **Settings > Integrations**.
  </Step>

  <Step title="Find PostHog">
    Search for **PostHog** and select it from the catalog.
  </Step>

  <Step title="Start the connection">
    Click **Connect** to open the connection form.
  </Step>

  <Step title="Add your credentials">
    Enter the values you gathered above, then click **Add connection**:

    | Secret Name                | Value                                                                                   |
    | -------------------------- | --------------------------------------------------------------------------------------- |
    | `POSTHOG_PROJECT_API_KEY`  | Your project API key                                                                    |
    | `POSTHOG_HOST`             | Your PostHog host, e.g. [https://us.i.posthog.com](https://us.i.posthog.com) (optional) |
    | `POSTHOG_PERSONAL_API_KEY` | Your personal API key (optional)                                                        |

    You can rename the connection and choose whether it is shared with your
    organization or kept personal to you.
  </Step>

  <Step title="Test the connection">
    Ask Adapt about your top events over the last 7 days.
  </Step>
</Steps>

### Security

* Credentials are encrypted at rest with AES-256
* Scope the personal API key to only the read permissions you need, such as Query Read
* A personal API key grants the same access as your account, so limit its scopes
* The personal API key is shown only once; store it securely and revoke it anytime
* Never share your keys or commit them to source control

## Capabilities

Adapt can read and analyze your PostHog product analytics. Ask questions about
events, insights, funnels, and retention in natural language.

### Examples

```
What were my top 10 events last week?
```

```
Build a funnel from signup to first purchase
```

```
Show 30-day retention for new users
```

```
Which pages get the most pageviews this month?
```
