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

# Connect PostHog

> Connect PostHog so Glassray pulls your LLM observability traces on a sync cadence.

Glassray connects to PostHog as a **pull** integration: you provide a personal API key, region, and project, and Glassray fetches new traces on a sync cadence. It reads your **LLM observability** (`$ai_*`) events, so your app needs to be sending them with the [PostHog AI SDK](https://posthog.com/docs/ai-observability). It's one of four [trace integrations](/traces) - the others are [Langfuse](/langfuse), [LangSmith](/langsmith), and [OpenTelemetry](/otlp-ingestion).

## Connect

<Steps>
  <Step title="Open Sources" icon="plug">
    In the dashboard, go to **Settings → Sources** and add **PostHog**.
  </Step>

  <Step title="Create a personal API key" icon="key">
    In PostHog, go to **Settings → Personal API keys** and create a new key. When selecting scopes, search for **query** and set the **Query** scope to **Read** (`query:read`).

    <Frame>
      <img src="https://mintcdn.com/glassray/4nWE83tf6ozUuO4G/images/posthog-query-scope.png?fit=max&auto=format&n=4nWE83tf6ozUuO4G&q=85&s=3a4f9b5d77d4c497ec281f564768a4d1" alt="PostHog scope picker - search for query and select Read" width="1008" height="386" data-path="images/posthog-query-scope.png" />
    </Frame>

    Paste the key into Glassray and choose your **region** (US or EU). If you're self-hosted, enter your **host URL** instead.
  </Step>

  <Step title="Enter your project ID" icon="folder">
    Enter the PostHog **project ID** to pull traces from. You can find it in PostHog under **Settings → General**.
  </Step>

  <Step title="Glassray verifies and syncs" icon="circle-check">
    Glassray verifies the credentials and starts pulling new traces on a cadence.
  </Step>
</Steps>

<Info>
  Your PostHog credentials are stored in **WorkOS Vault**, never in Glassray's database. The connected source row only holds a reference to the vaulted secret.
</Info>

## Filtering

A source can carry an optional **filter** so only the runs you care about are pulled - narrow by trace name and scope. Filtering is applied at ingest, and changes are go-forward (re-sync to apply a new filter). See [Traces](/traces).

<Tip>
  Prefer to push instead of pull? Use [OpenTelemetry](/otlp-ingestion). Once traces land, head to [Flows](/flows) or [Ask Glassray](/ask-glassray).
</Tip>
