# Send data from PostHog to Avo Inspector

## Use Avo Inspector as a PostHog destination

If you are already sending your data to PostHog you can stream it to Avo Inspector without adding any code to your codebase.

PostHog has an official plugin maintained by PostHog that sends data directly to Avo Inspector. If you are using PostHog you can set it up within a few minutes.

> The Plugin is a side effect of Avo Inspector analyzing your events and keeping your PostHog events stream unchanged.

After connecting the PostHog plugin to a source the event schemas of all events seen in PostHog will automatically be sent to Avo Inspector and you'll be able to monitor the quality of your tracking implementation without any changes in your code!

> 💡 Inspector only receives your event schema, no actual data will be sent to Avo.

> ℹ️ Remember that production data takes up to 2 hours to appear in Inspector dashboard, while development data is available without any delay.

## Guide to connect PostHog and Avo Inspector

#### Step 1. Set up your Avo source

An Avo Source is the first thing you need to connect your PostHog data to Avo Inspector.

Open `Sources` in the Avo sidebar or `Manage Sources` in Inspector tab

![Navigation to Inspector sources screen in Avo](https://www.avo.app/docs/images/workspace/nav-inspector-sources-highlighted.png)

If you already have the source, open it in the dashboard. If you don’t have the source corresponding to your app, [add a new one](https://www.avo.app/docs/inspector/configuring-inspector-sources.md).

![Image of the Add Source button in Avo](https://www.avo.app/docs/images/add-source.png)

In the source details, go to "Inspector Setup" and there you’ll see options to integrate Inspector. Pick PostHog to see the integration guide.

![Source settings in Avo](https://www.avo.app/docs/images/guide-posthog-to-inspector/source-setup.png)

Copy the API key, you will need to use it in PostHog for the next step.

#### Step 2. Enable Avo Inspector plugin in PostHog

- Open PostHog and log in into your workspace

- Pick `Plugins` in the sidebar

- Search for `Avo Inspector` in the search box

![PostHog navigation to the Plugin menu](https://www.avo.app/docs/images/guide-posthog-to-inspector/avo-plugin.png)

Enable the plugin and paste the API key

Save it by pressing `Save` button under the code editor.

![PostHog insert avo API key](https://www.avo.app/docs/images/guide-posthog-to-inspector/insert-api-key.png)

#### Step 3. Test your PostHog plugin integration on Dev.

You can test the production PostHog Plugin in the same way, but keep in mind that the production data shows with a ~2 hours delay in Inspector dashboard, while development and staging data is shown without delay.

Monitor the logs for Avo Inspector plugin in PostHog and verify events are being sent to Avo Inspector.

![PostHog plugin logs](https://www.avo.app/docs/images/guide-posthog-to-inspector/logs.png)

Then navigate to Avo, pick `Inspector` in the sidebar and pick Development environment

![Environment picker in Inspector](https://www.avo.app/docs/images/guide-segment-to-inspector/inspector-development-env.png)

You’ll see the event in your dashboard under the source from where you got the snippet from.

![Source overview in Inspector](https://www.avo.app/docs/images/guide-segment-to-inspector/source-in-inspector.png)

This means that the PostHog plugin is working 🎉

## Error response from API

The calls to the API are fire and forget, so the API tries to return 200 if it can.
The API will accept multiple events in a batch, and returns a 200 with `{"ok": true}` if all the events managed to get processed.

If any of the events were invalid or if the API failed to decode them, it will return a 200 response, with
`{"ok": false, "errors": [{"message": <Error message>, "json": <jsonString>}]}` which contains the Json for each event that failed.
