[← All connectors](/connect/browse)

Analytics

# PostHog

Use PostHog with AI apps and agents through Vercel Connect. Follow a complete setup guide for secure runtime access.

[Create Connector](https://vercel.com/d?to=%2F%5Bteam%5D%2F~%2Fconnect%3Fcreate%3Dposthog&title=Vercel+Connect)

1.  ## Install the skill

    ```
    $ npx skills add vercel/vercel-plugin --skill vercel-connect
    ```

2.  ## Connect to PostHog

    Via CLI[Vercel Dashboard(opens in new tab)](https://vercel.com/d?to=%2F%5Bteam%5D%2F~%2Fconnect%3Fcreate%3Dposthog&title=Vercel+Connect)

    ```
    $ vercel connect create posthog --name acme-posthog
    ```

3.  ## Use its data in [agents(opens in new tab)](https://github.com/vercel-labs/eve-slack-agent-template) and [apps(opens in new tab)](https://github.com/vercel-labs/nextjs-linear-connect-template)

    ```
    import { getToken } from '@vercel/connect';

    const userId = 'user_123';

    const token = await getToken('posthog/acme-posthog', {
      subject: { type: 'user', id: userId },
    });
    ```

## Use PostHog in apps and agents

Analyze product usage, experiments, and insights.

## Why use Vercel Connect with PostHog?

- ### Credentials on demand

    Request PostHog credentials only when your application or agent needs them instead of copying secrets into application code.

- ### Access for the right subject

    Request user-authorized PostHog access so actions follow the identity and permissions of the person using your application.

- ### Centralized credential management

    Manage PostHog credentials in one place and retrieve them through a consistent runtime API.

- ### Vercel-native controls

    Bind connections to the projects and environments that need them while Vercel OIDC authenticates each runtime request.

## Use PostHog with your stack

Follow a complete setup for the Connect SDK or a supported agent framework.

Add PostHog to an existing Vercel application with the [Connect SDK](/docs/connect/ts-sdk-reference).

1.  ### Install the Connect SDK

    ```
    npm install @vercel/connect
    ```

2.  ### Create the PostHog connector

    Run these commands from the project that will use the connection.

    ```
    vercel link
    vercel connect create posthog --name acme-posthog
    vercel env pull
    ```

3.  ### Request PostHog credentials

    app/api/route.ts

    const userId = 'user_123';

## More connectors like PostHog

- [Dovetail](/connect/dovetail)
- [![](/static/connex/g2.svg)G2](/connect/g2)
- [![](/static/connex/local-falcon.svg)Local Falcon](/connect/local-falcon)
- [![](/static/connex/mixpanel.svg)Mixpanel](/connect/mixpanel)

[Browse all connectors](/connect/browse)