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

# Posthog

> Connect Traceloop to Posthog to combine LLM insights with your product analytics

Connecting Traceloop to Posthog can be done by following these steps:

<Steps>
  <Step title="Get the needed data from Posthog">
    Go to your Posthog instance settings and get the following data:

    * API URL (should be something like `https://us.i.posthog.com`)
    * Project API key (should be in the format `phc_-<key>`)
  </Step>

  <Step title="Set up the Integration within Traceloop">
    Go to the [integrations page](https://app.traceloop.com/settings/integrations) within Traceloop and click on the Posthog card.

    <Frame>
      <img className="block dark:hidden" src="https://mintcdn.com/enrolla/pLLlNcf8Qyyp9R0l/img/traceloop-integrations/integrations-light.png?fit=max&auto=format&n=pLLlNcf8Qyyp9R0l&q=85&s=35ac5fe45caf3c3530228c0a3b0bff35" width="2570" height="1536" data-path="img/traceloop-integrations/integrations-light.png" />

      <img className="hidden dark:block" src="https://mintcdn.com/enrolla/pLLlNcf8Qyyp9R0l/img/traceloop-integrations/integrations-dark.png?fit=max&auto=format&n=pLLlNcf8Qyyp9R0l&q=85&s=23c023f1759a68c3fd35cf8d58b5e4e2" width="2570" height="1536" data-path="img/traceloop-integrations/integrations-dark.png" />
    </Frame>
  </Step>

  <Step title="Fill in the form">
    Fill in the data you got from Posthog. Choose the environment you want to connect to Posthog and click on "Enable".

    <Frame>
      <img className="block dark:hidden" src="https://mintcdn.com/enrolla/GspX1ocwd1gETLy0/img/traceloop-integrations/posthog-light.png?fit=max&auto=format&n=GspX1ocwd1gETLy0&q=85&s=a1fb090cc7ba9861de483fbfb2f415fd" width="3024" height="1807" data-path="img/traceloop-integrations/posthog-light.png" />

      <img className="hidden dark:block" src="https://mintcdn.com/enrolla/GspX1ocwd1gETLy0/img/traceloop-integrations/posthog-dark.png?fit=max&auto=format&n=GspX1ocwd1gETLy0&q=85&s=cbb35b1346f438ac29dc3166ceb62228" width="3005" height="1801" data-path="img/traceloop-integrations/posthog-dark.png" />
    </Frame>
  </Step>
</Steps>

**That's it!**

Go to your Posthog instance, click "Activity" and search for events named `traceloop span`.

You can then create a new dashboard from the "LLM Metrics - Traceloop" template to visualize the data.

<Frame>
  <img src="https://mintcdn.com/enrolla/GspX1ocwd1gETLy0/img/traceloop-integrations/posthog-result.png?fit=max&auto=format&n=GspX1ocwd1gETLy0&q=85&s=a7ac3ec7d419d08964c981d15789798c" width="1619" height="1062" data-path="img/traceloop-integrations/posthog-result.png" />
</Frame>
