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

# PostHog

> PostHog is a product analytics app for querying events, trends, funnels, persons, feature flags, session recordings, experiments and surveys via your connected account.

Use PostHog when a workflow needs product analytics. Run a HogQL query, pull event trends or funnel conversion, read saved insights and dashboards, look up persons, or list feature flags, session recordings, experiments, surveys and error-tracking issues, then pass the results to an AI step or a report.

## Configuration

| Option | Required | Description |
| - | - | - |
| Name | No | Label for the step in the workflow canvas. |
| Authentication | Yes | The connected PostHog account to use for this step. |
| Action | Yes | The PostHog action to perform (for example List projects, Run HogQL query, Get event trends, Get funnel conversion). |
| Arguments | Yes | Per-action form fields generated from the action's schema. Each text field has an **Insert Variable** button for injecting `{{placeholder}}` values. A **Raw JSON** tab is available for advanced usage. |
| When the step fails | No | Controls whether the workflow should **Terminate Workflow** or **Continue** if this step fails. |

Before you configure this step, connect PostHog in **Integrations** for your workspace with your API key. If no active connection is available, the step shows a warning with a link to **Integrations** instead of the account selector.

## Arguments form

When you select an action, the **Arguments** section renders a form driven by the action's input schema. Fields that refer to existing records include dropdown pickers.

Switch to the **Raw JSON** tab when you prefer to write the full arguments object by hand. Changes in either tab stay in sync.

## Common actions

| Action | Description |
| - | - |
| **List projects** | Lists the projects in your PostHog organization with their ids, so later steps know which project to read. |
| **Run HogQL query** | Runs a query (for example a HogQL SQL query over events or persons) in a PostHog project and returns the result rows. |
| **Get event trends** | Returns counts over time for one or more events in a PostHog project, with optional breakdowns, comparisons and date range. |
| **Get funnel conversion** | Returns conversion through a multi-step funnel of events in a PostHog project, with optional breakdowns and date range. |
| **List saved insights** | Lists the saved insights in a PostHog project. |
| **Get insight results** | Gets one saved insight with its latest results. |
| **List dashboards** | Lists the dashboards in a PostHog project. |
| **Get dashboard results** | Runs the insights on a dashboard and returns their results. |
| **List event definitions** | Lists the events tracked in a PostHog project with their volume and last seen time. |
| **Find persons by distinct ID** | Looks up persons and their properties by distinct ID. |
| **Get person** | Gets one person and their properties by ID. |
| **List feature flags** | Lists the feature flags in a PostHog project with their keys, status and rollout. |
| **Get feature flag** | Gets one feature flag with its filters, rollout percentage and status. |
| **List session recordings** | Lists session recordings in a PostHog project with their duration, activity and person. |
| **List experiments** | Lists the experiments in a PostHog project with their status and metrics. |
| **List surveys** | Lists the surveys in a PostHog project. |
| **Get survey responses** | Lists the responses to one survey in a PostHog project. |
| **List error-tracking issues** | Lists the error-tracking issues in a PostHog project. |
| **List annotations** | Lists annotations (dated notes such as releases) in a PostHog project. |
| **Get web vitals** | Gets web vitals for one page path in a PostHog project. |
| **Capture event** | Sends one analytics event to a PostHog project using its project API key. |

Destructive actions, such as deleting records, are not available in the workflow action picker.

## Output

This step stores the PostHog response as the step output. The shape of the response depends on the action.

Use the full output reference in later steps:

```text theme={null}
{{STEP_IDENTIFIER.output}}
```

## Example

1. Open **Integrations** and connect PostHog if you have not already done that.
2. Add a **PostHog** step to your workflow.
3. Select a connected account in **Authentication**.
4. Choose **List projects** in **Action**.
5. Fill in the required fields. Use **Insert Variable** to reference an earlier step's output for any field value.
6. Click **Run** in the step header to test the action, then review the returned payload in **Output**.

## Use cases

### Weekly product metrics digest

1. Get event trends
2. Get funnel conversion
3. List saved insights

### Investigate a user

1. Find persons by distinct ID
2. Get person
3. List session recordings

### Review feature flags and experiments

1. List feature flags
2. Get feature flag
3. List experiments

## Notes

* This step depends on a connected PostHog integration in your workspace.
* The workflow action picker shows a curated set of actions. Agents with the PostHog tool can use more of them.

## Using PostHog as an Agent Tool

You can also add PostHog as a tool in the **Agent Editor**. Open the agent, click **Add tool**, and select **PostHog**. In the tool settings panel, choose the connected account the agent should use. The agent calls PostHog actions when they are relevant to the conversation.

See also: [Integrations](https://docs.fetchhive.com/workspace/integrations.md), [Creating and Editing](https://docs.fetchhive.com/workflows/creating-and-editing.md), and [Testing and Iteration](https://docs.fetchhive.com/workflows/testing-and-iteration.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.