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

# PostHog App

> Install the official PostHog app to send payment, subscription, refund, and dispute events from Dodo Payments to PostHog. Connect with your API credentials and choose the events.

## What the PostHog app does

The PostHog app sends events from your business to your PostHog project. Each event has a name like `dodo_payment_succeeded`. You can use the events in funnels, cohorts, and dashboards.

## Before you start

* You are an owner or an admin of the Dodo Payments business.
* You have a PostHog project and its API credentials. In the Connect dialog, select **Where do I find this?** to see where to find each value.

## Install, connect, and configure

**1. Install the app**

Open **Apps**, then **Explore**. Open **PostHog** (publisher **Dodo Payments**) and select **Install**.

![The PostHog app page in the marketplace with the Official badge and the Install button](https://mintcdn.com/dodopayments/kJYllb8bAFUjIS_F/images/app-marketplace/merchant/15-posthog-app-page.png?fit=max\&auto=format\&n=kJYllb8bAFUjIS_F\&q=85\&s=9be73ff475bb63a813cb56fd0ec39d24)

**2. Connect PostHog**

Select **Connect**. Enter the hostname and the Project Token of PostHog, then select **Connect**. Dodo Payments tests the credentials.

![The Connect PostHog dialog with the Project Token field](https://mintcdn.com/dodopayments/kJYllb8bAFUjIS_F/images/app-marketplace/merchant/16-posthog-connect-dialog.png?fit=max\&auto=format\&n=kJYllb8bAFUjIS_F\&q=85\&s=7767d106bc33de73a33bdc4e09801b05)

If PostHog refuses the key, the dialog says "The API key is not correct. Enter a correct key and try again." If the test could not run, a warning tells you that Dodo Payments could not check the key.

**3. Choose the events**

Open the **Configure** tab, set the options, and select **Save**.

![The Configure tab of the PostHog app with the event switches, the distinct ID setting, and the filters](https://mintcdn.com/dodopayments/clOL2gp3BmPo5w6L/images/app-marketplace/merchant/17-posthog-configure.png?fit=max\&auto=format\&n=clOL2gp3BmPo5w6L\&q=85\&s=396d7e449619b97776000a96eb607ea2)

## Settings

| Setting | What it does | Default |
| - | - | - |
| Send payment events | Send payment events. | On |
| Send subscription events | Send subscription events. | On |
| Send refund events | Send refund events. | Off |
| Send dispute events | Send dispute events. | Off |
| PostHog distinct ID | The value that identifies the person: **Customer email**, **Dodo customer ID**, or **Metadata key**. | Customer email |
| Metadata key for the distinct ID | The customer metadata key to use when you select **Metadata key**. | Empty |
| Products, Currencies | Send events only for the products or currencies that you pick. | All |
| Minimum amount | Skip events with a smaller amount. | No minimum |

## What is sent and when

Dodo Payments sends one PostHog event for each Dodo Payments event, after the event happens. The event name starts with `dodo_`. The event properties do not contain card data, the address, or the customer name. The distinct ID is the value that you select, so the customer email goes to PostHog if you keep the default.

Amounts go out in the major unit with the currency code. If Dodo Payments sends an event again after an error, PostHog counts it one time. If the customer has no value for the distinct ID that you select, Dodo Payments skips the event.

## Test the app

**1. Use test mode**

Install and connect the app in test mode. Turn on **Send payment events**.

**2. Make a test payment**

Create a test payment.

**3. Check PostHog**

Open the activity view of your PostHog project. A `dodo_payment_succeeded` event appears.

## Troubleshooting

| Problem | What to do |
| - | - |
| "The API key is not correct" | Copy the key again from PostHog. Check that it belongs to the right project. |
| The warning "Dodo Payments could not check this key" | The connection is saved. If no events arrive, select **Update connection** and enter the key again. |
| **Connection needs attention** | PostHog stopped accepting the key. Select **Reconnect** and enter a new key. |
| No events arrive | Check that the event switch is on, that the filters do not skip the event, and that the customer has a value for the distinct ID. |

## Disconnect and uninstall

Turn off the events on the **Configure** tab to stop sending data. Uninstall the app to delete the connection. See [Manage and uninstall](https://docs.dodopayments.com/features/app-marketplace/manage-and-uninstall.md).


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