> For the complete documentation index, see [llms.txt](https://help.usejimo.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.usejimo.com/docs/integrations/posthog.md).

# PostHog

Send Jimo experience events to PostHog, and PostHog events to Jimo for targeting and triggers.

The PostHog integration works in both directions. Jimo sends experience events to PostHog for your dashboards, and PostHog events come into Jimo to target and trigger experiences.

## What it does

| Direction       | What it sends                                                      | What you do with it                                      |
| --------------- | ------------------------------------------------------------------ | -------------------------------------------------------- |
| Jimo to PostHog | Experience events: tour, survey, checklist, banner and hint events | Dashboards and funnels in PostHog                        |
| PostHog to Jimo | The PostHog events your app tracks                                 | Audiences in Who, segments, and the **On event** trigger |

Each direction is a separate option in the integration settings. Turn on only the ones you need.

<figure><img src="https://2794860263-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKzAcDWQbK1gKbpra7bkb%2Fuploads%2FNYjtt7lOvsUOrwOcnU2S%2FF2-52b-analytics-flow-posthog.png?alt=media&amp;token=dac36c3f-b483-4c32-aca7-30ba1f394ef7" alt="Jimo sends experience events to PostHog when Jimo to PostHog is on; PostHog events reach Jimo through one jimo.push line when PostHog to Jimo is on, for Who, segments and the On event trigger"><figcaption></figcaption></figure>

## Before you start

* The PostHog JavaScript SDK loaded and used in your app. Jimo sends its events through it.
* For PostHog to Jimo, a developer adds one line to the function your app already uses to track PostHog events.
* A Jimo role with access to the Integrations settings. See [Integration setup](/docs/integrations/integration-setup.md).

## Connect

In [Settings > Integrations](https://i.usejimo.com/settings/integrations), hover the PostHog card and click **Enable**.

<div align="left"><figure><img src="https://i.gyazo.com/f1bb540f65d08f523e217dc01cb5144f.png" alt="PostHog card in Settings > Integrations" width="375"><figcaption></figcaption></figure></div>

### Send Jimo events to PostHog

Turn on the option **Jimo → PostHog** in the integration settings.

<figure><img src="https://2794860263-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKzAcDWQbK1gKbpra7bkb%2Fuploads%2FeE5RbmP1309MBV5nLbW5%2Fimage.png?alt=media&amp;token=ae6caa19-9e97-4326-8f05-fa5dc570b535" alt="Jimo to PostHog option turned on"><figcaption></figcaption></figure>

The events and their properties are listed in [Events for analytics integrations](/docs/integrations/events-for-analytics-integrations.md).

<figure><img src="https://i.gyazo.com/811976a55c16613715e7a35024bb4732.png" alt="A PostHog dashboard built on Jimo events"><figcaption></figcaption></figure>

### Send PostHog events to Jimo

{% stepper %}
{% step %}

### Turn on the option

Turn on **PostHog → Jimo** in the integration settings.

<figure><img src="https://2794860263-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKzAcDWQbK1gKbpra7bkb%2Fuploads%2FK9rUOEwNHk5q2WDroIfI%2Fimage.png?alt=media&amp;token=bbede2c2-628b-49c3-af42-facd818a2e6a" alt="PostHog to Jimo option turned on"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Add the Jimo call to your tracking function

Most apps track PostHog events through one shared function. Add the Jimo call next to the PostHog call, so every event reaches both tools.

```javascript
// Your shared tracking function
const captureEvent = (name, properties) => {
  posthog.capture(name, properties); // You should have this already

  window.jimo.push(["do", "posthog:capture", [name, properties]]);
};

// Example
captureEvent("purchase", { amount: 199 });
```

{% endstep %}
{% endstepper %}

## What flows

| Direction       | What arrives                                                                                                                                                                        | Where you see it                                                                                                               |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| Jimo to PostHog | The events listed in [Events for analytics integrations](/docs/integrations/events-for-analytics-integrations.md), named **Jimo Tour Started**, **Jimo Survey Completed** and so on | In PostHog, with your other events                                                                                             |
| PostHog to Jimo | The events your tracking function passes to `jimo.push`, from the day you add the call                                                                                              | Listed in [Success Tracker > Events](/docs/analyze/success-tracker/events.md), and available in Who, segments and **On event** |

## Use PostHog data in Jimo

* **Target:** build an audience on PostHog events in [Who](/docs/publish/target-right-people-who.md), or save it as a [segment](/docs/analyze/users-and-segments/audience/segments/create-a-segment.md).

<figure><img src="https://i.gyazo.com/164199d1e6b8c27127216a6a35809460.png" alt="Audience built on PostHog events"><figcaption></figcaption></figure>

* **Trigger:** show an experience right after a PostHog event. In the experience's settings, set **Show on** to **On event** and select the PostHog event. See [Show on](/docs/publish/trigger-on-the-right-spot-show-on.md#on-event).

## Verify

* **Jimo to PostHog:** complete a tour or a survey yourself, then look for the matching **Jimo Tour Completed** or **Jimo Survey Completed** event in PostHog.
* **PostHog to Jimo:** fire a tracked event in your app, then check that it is listed in [Success Tracker > Events](/docs/analyze/success-tracker/events.md). The list shows each event once, with its **Source** and when it was **Last received at**, not a history over time: to follow an event over time, create a feature usage [tracker](/docs/analyze/success-tracker/trackers.md).

<figure><img src="https://2794860263-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKzAcDWQbK1gKbpra7bkb%2Fuploads%2FHQ6OzATEzsI5Ysw2PSZd%2FF2-03-incoming-event.png?alt=media&amp;token=cb7ffdec-4caf-4022-aa84-a47bec0e0c71" alt="Success Tracker > Events, with the columns Name, Source, Created at and Last received at. The row of an event received from Segment is outlined, and A marks its Source."><figcaption></figcaption></figure>

## Limits

#### Jimo to PostHog only sends experience events

The events listed in [Events for analytics integrations](/docs/integrations/events-for-analytics-integrations.md). Changelog posts and resource center interactions are not in that list.

#### PostHog to Jimo starts at setup

Only events sent after you add the Jimo call reach Jimo. Past PostHog events are not imported.

## Related

* [Events for analytics integrations](/docs/integrations/events-for-analytics-integrations.md)
* [Integrations](/docs/integrations/integrations-list.md)
* [Attributes and events](/docs/getting-started/install-jimo/attributes-and-events.md)
