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

# Mixpanel Setup

> Connect Mixpanel to UserJourneys with a Service Account and cohort webhook sync.

## Create your Service Account

<Steps>
  <Step title="Open Project Settings">
    Go to your Mixpanel project, click the **gear icon** in the bottom-left, then select **Project Settings**.
  </Step>

  <Step title="Go to Service Accounts">
    In the Project Settings page, click the **Service Accounts** tab on the right side.
  </Step>

  <Step title="Create a new Service Account">
    Click **Create Service Account**.
  </Step>

  <Step title="Configure the account">
    * Give it a name (e.g. "UserJourneys Export")
    * Set the role to **Analyst**
  </Step>

  <Step title="Copy your credentials">
    Click **Create**. You'll see a **username** and **secret**.

    <Warning>
      Copy both immediately — the secret won't be shown again.
    </Warning>
  </Step>

  <Step title="Paste into UserJourneys">
    Go back to UserJourneys, paste the username and secret into the Mixpanel
    connection form, and click **Connect**. UserJourneys detects your project
    automatically — no project ID or region to enter. If the service account can
    access more than one project, you'll be asked to pick which one to connect.
  </Step>
</Steps>

## Sync cohorts to UserJourneys

Cohort sync is optional and set up separately from connecting your account. It
lets Mixpanel push cohort membership to UserJourneys for use in Study Launch
Rules.

<Steps>
  <Step title="Generate the webhook secret">
    In the Mixpanel connection settings, expand **Cohort sync (optional)** and
    click **Set up cohort sync**. UserJourneys shows the webhook URL, the Basic
    Auth username, and a one-time secret.

    <Warning>
      Copy the secret immediately — it's shown only once. If you lose it, use
      **Regenerate secret**; regenerating invalidates the previous secret until you
      update it in Mixpanel.
    </Warning>
  </Step>

  <Step title="Create a webhook destination in Mixpanel">
    In Mixpanel, open the cohort sync/integrations area and create a custom
    webhook destination. Paste the UserJourneys webhook URL as the destination
    URL, enable Basic Auth, and paste the displayed username and secret.
  </Step>

  <Step title="Select cohorts to sync">
    For each Mixpanel cohort you want to use for Study Launch Rules, sync or
    export that cohort to the UserJourneys webhook destination.
  </Step>

  <Step title="Include identity properties">
    Include `mixpanel_distinct_id`. If your app user id differs from Mixpanel
    distinct id, also include that app user id as `reference_id`.
  </Step>
</Steps>

<Check>
  Saved cohorts can now appear as UserJourneys Audiences and can be connected to
  Studies through [Study Launch Rules](/interviews/targeting-rules).
</Check>
