> For the complete documentation index, see [llms.txt](https://notara-1.gitbook.io/notara-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notara-1.gitbook.io/notara-docs/connectors/posthog.md).

# PostHog

Query analytics insights, feature flags, cohorts, and raw event data from PostHog.

## What It Enables

| Tool                 | Capability | Description                                                                  |
| -------------------- | ---------- | ---------------------------------------------------------------------------- |
| `list_insights`      | `read`     | List saved insights (charts) in the project                                  |
| `get_insight`        | `read`     | Get one saved insight including its cached result data                       |
| `list_feature_flags` | `read`     | List feature flags with their rollout filters and active state               |
| `run_query`          | `read`     | Run an ad-hoc HogQL (SQL) query against event data                           |
| `list_events`        | `read`     | List recent raw events, filterable by event name, distinct ID, or date range |
| `list_cohorts`       | `read`     | List saved user segments with member counts                                  |

All tools are read-only. `run_query` accepts only SELECT statements — PostHog rejects writes.

## Setup

**Required:** PostHog personal API key and project ID.

**Where to find it:** PostHog → **Settings → Personal API keys**. Your project ID is the number in the app URL: `/project/<id>`.

1. In the Notara dashboard, go to **Tools**.
2. Click the **PostHog** tile.
3. In PostHog, go to **Settings → Personal API keys** and create a new key.
4. Copy your project ID from the URL.
5. Paste the API key and project ID into the connector fields and click **Verify & Save**.

Your API key is encrypted at rest with AES-256-GCM.

## Example Prompts

> "What does the 'Signup funnel' insight show for the last 30 days?"

> "Is the new-dashboard feature flag active, and what percentage of users see it?"

> "How many pageview events arrived in the last 7 days, broken down by path?"
