> For the complete documentation index, see [llms.txt](https://notara.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.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?"


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://notara.gitbook.io/notara-docs/connectors/posthog.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
