|
| 1 | +--- |
| 2 | +title: PostHog Destination |
| 3 | +rewrite: true |
| 4 | +--- |
| 5 | +[PostHog](https://posthog.com/?utm_source=segmentio&utm_medium=docs&utm_campaign=partners) is self-hosted, open-source analytics product. Get the same powerful features as other product analytics software but keep full control over your data. |
| 6 | + |
| 7 | +This destination is maintained by PostHog. For any issues with the destination, [contact the PostHog Support team ](mailto:[email protected]). |
| 8 | + |
| 9 | +## Getting Started |
| 10 | + |
| 11 | +{% include content/connection-modes.md %} |
| 12 | + |
| 13 | +1. From the Destinations catalog page in the Segment App, click **Add Destination**. |
| 14 | +2. Search for "PostHog" in the Destinations Catalog, and select the PostHog destination. |
| 15 | +3. Choose which Source should send data to the PostHog destination. |
| 16 | +4. Go to your [PostHog set up page](https://app.posthog.com/setup), and find and copy the **API key**. |
| 17 | +5. Enter the PostHog API Key that you copied in the PostHog destination settings in Segment. |
| 18 | + |
| 19 | +> note "" |
| 20 | +> **Note**: If you're hosting your own PostHog instance, add the URL of your instance without the trailing slash in the **PostHog instance** setting. For example, `https://posthog-example.herokuapp.com` |
| 21 | +
|
| 22 | +## Page |
| 23 | + |
| 24 | +If you aren't familiar with the Segment Spec, take a look at the [Page method documentation](https://segment.com/docs/connections/spec/page/) to learn about what it does. An example call would look like: |
| 25 | + |
| 26 | +```js |
| 27 | +analytics.page() |
| 28 | +``` |
| 29 | + |
| 30 | +Segment sends Page calls to PostHog as a `$pageview`. |
| 31 | + |
| 32 | + |
| 33 | +## Screen |
| 34 | + |
| 35 | +If you aren't familiar with the Segment Spec, take a look at the [Screen method documentation](https://segment.com/docs/connections/spec/screen/) to learn about what it does. An example call would look like: |
| 36 | + |
| 37 | +```obj |
| 38 | +[[SEGAnalytics sharedAnalytics] screen:@"Home"]; |
| 39 | +``` |
| 40 | + |
| 41 | +Segment sends Screen calls to PostHog as a `$screen` event. |
| 42 | + |
| 43 | + |
| 44 | +## Identify |
| 45 | + |
| 46 | +If you aren't familiar with the Segment Spec, take a look at the [Identify method documentation](https://segment.com/docs/connections/spec/identify/) to learn about what it does. An example call would look like: |
| 47 | + |
| 48 | +```js |
| 49 | +analytics.identify('userId123', { |
| 50 | + |
| 51 | +}); |
| 52 | +``` |
| 53 | + |
| 54 | +Segment sends Identify calls to PostHog as an `identify` event. Data from Identify calls appears in PostHog under the **People** tab. |
| 55 | + |
| 56 | + |
| 57 | +## Track |
| 58 | + |
| 59 | +If you aren't familiar with the Segment Spec, take a look at the [Track method documentation](https://segment.com/docs/connections/spec/track/) to learn about what it does. An example call would look like: |
| 60 | + |
| 61 | +```js |
| 62 | +analytics.track('Login Button Clicked') |
| 63 | +``` |
| 64 | + |
| 65 | +Segment sends Track calls to PostHog as a `track` event. |
| 66 | + |
| 67 | +## Alias |
| 68 | + |
| 69 | +If you aren't familiar with the Segment Spec, take a look at the [Alias method documentation](https://segment.com/docs/connections/spec/alias/) to learn about what it does. An example call would look like: |
| 70 | + |
| 71 | +```js |
| 72 | +analytics.alias('507f191e81') |
| 73 | +``` |
| 74 | + |
| 75 | +Segment sends Alias calls to PostHog as an `alias` event. |
0 commit comments