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

# Mixpanel

> Track events, analyze funnels, and understand user behavior with Mixpanel analytics

## At a glance

* **Availability**: Experimental ([how to enable](/cloud/integrations)).
* **Auth**: Basic auth.
* **Connection**: HTTP Basic auth with `MIXPANEL_SERVICE_ACCOUNT_USERNAME` as the username and `MIXPANEL_SERVICE_ACCOUNT_SECRET` as the password.
* **Docs**: [https://developer.mixpanel.com/reference/service-accounts](https://developer.mixpanel.com/reference/service-accounts)

## Credentials

Set these per environment. See [Connect an integration](/cloud/integrations).

| Variable                            | Required | Description                                                                                                                                                                                    |
| ----------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `MIXPANEL_SERVICE_ACCOUNT_USERNAME` | Yes      | Mixpanel service account username (HTTP Basic username for Query and Export APIs) [Docs](https://developer.mixpanel.com/reference/service-accounts).                                           |
| `MIXPANEL_SERVICE_ACCOUNT_SECRET`   | Yes      | Mixpanel service account secret (HTTP Basic password for Query and Export APIs) [Docs](https://developer.mixpanel.com/reference/service-accounts).                                             |
| `MIXPANEL_PROJECT_TOKEN`            | No       | Mixpanel Project Token for event tracking [Docs](https://docs.mixpanel.com/docs/tracking/how-tos/api-credentials).                                                                             |
| `MIXPANEL_API_SECRET`               | No       | Legacy Mixpanel project API secret (deprecated by Mixpanel in favor of service accounts; only used by local file-based tools) [Docs](https://developer.mixpanel.com/reference/authentication). |
| `MIXPANEL_PROJECT_ID`               | Yes      | Mixpanel Project ID (found in project settings; pass it as the project\_id parameter on query tools) [Docs](https://docs.mixpanel.com/docs/admin/organizations-projects/manage-projects).      |

## Setup

# Mixpanel Integration Setup ## Step 1: Create a Service Account 1. Log in to Mixpanel and open Organization Settings > Service Accounts ([https://mixpanel.com/settings/org#serviceaccounts](https://mixpanel.com/settings/org#serviceaccounts)) 2. Create a service account with access to your project (Analyst role or higher is sufficient for queries) 3. Copy the service account **username** and **secret** shown at creation time 4. Add them to your .env file as `MIXPANEL_SERVICE_ACCOUNT_USERNAME` and `MIXPANEL_SERVICE_ACCOUNT_SECRET` ## Step 2: Get Your Project ID 1. In Mixpanel project settings URL, your Project ID is the number in the URL 2. Format: [https://mixpanel.com/project/YOUR\_PROJECT\_ID/settings](https://mixpanel.com/project/YOUR_PROJECT_ID/settings) 3. Copy this ID and add it as `MIXPANEL_PROJECT_ID` in your .env file - query tools require it as the project\_id parameter ## Step 3: (Optional) Get Your Project Token 1. Under Project Settings, find your **Project Token** 2. Add it as `MIXPANEL_PROJECT_TOKEN` - it is only needed for local event-tracking (ingestion), not for queries ## Step 4: Set Up Environment Variables Add these to your `.env` file: `MIXPANEL_SERVICE_ACCOUNT_USERNAME=your_service_account_username MIXPANEL_SERVICE_ACCOUNT_SECRET=your_service_account_secret MIXPANEL_PROJECT_ID=your_project_id_here MIXPANEL_PROJECT_TOKEN=your_project_token_here` ## Step 5: Test the Integration Run the List Cohorts or List Funnels tool with your project\_id to verify the service account works. ## Important Notes - Service accounts authenticate via HTTP Basic auth (username + secret) and are Mixpanel's recommended method for the Query and Export APIs - Every query tool requires the `project_id` parameter when authenticating with a service account - If your project stores data in the EU or India, pass the matching host parameter (eu.mixpanel.com / data-eu.mixpanel.com, or in.mixpanel.com / data-in.mixpanel.com) - **Project Token** is used only for tracking events (ingestion) - Keep credentials secure and never commit them to version control ## Useful Resources - [Mixpanel API Documentation](https://developer.mixpanel.com/reference/overview) - [Service Accounts](https://developer.mixpanel.com/reference/service-accounts) - [Query API Guide](https://developer.mixpanel.com/reference/query-api)

## Tools

| Tool          | Access | Description                                                  |
| ------------- | ------ | ------------------------------------------------------------ |
| Track Event   | Write  | Track a custom event in Mixpanel with properties             |
| Query Events  | Read   | Query and export event data from Mixpanel                    |
| Get Funnel    | Read   | Retrieve funnel analysis data to understand conversion rates |
| List Funnels  | Read   | List saved funnels with their names and funnel IDs           |
| Get Retention | Read   | Analyze user retention cohorts over time                     |
| List Cohorts  | Read   | List all user cohorts defined in your Mixpanel project       |

## Example prompts

* Show me the most important events tracked in my Mixpanel project over the last 7 days and their trends.
* Analyze my key conversion funnels and identify where users are dropping off.
* Give me insights about user retention and cohort behavior over the past month.
