> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/integrations/catalog/mixpanel.md).

# Mixpanel

Record product events, update profiles, and run Mixpanel analytics reports.

### Connectors

Choose the connector that matches your authentication method. The options below use the names shown in StackAI.

| Connector | Authentication   |
| --------- | ---------------- |
| Mixpanel  | API key or token |

#### Mixpanel

Connect a Mixpanel project to record events and run product analytics reports.

**Set up in Mixpanel**

1. Prepare the Mixpanel account or service that the workflow will access. Grant access to the required resources and operations.
2. **Service Account Secret:** The secret shown when the Mixpanel service account was created.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **Mixpanel**.
2. Enter the credentials and connection details in the fields below.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

**Connection fields**

| StackAI field            | Required                 | What to enter                                                                |
| ------------------------ | ------------------------ | ---------------------------------------------------------------------------- |
| Project Token            | Yes                      | Your Mixpanel project token, used only to record events and profile updates. |
| Service Account Username | Yes                      | The Mixpanel service account username used to run reports.                   |
| Service Account Secret   | Yes                      | The secret shown when the Mixpanel service account was created.              |
| Project ID               | Yes                      | The numeric Mixpanel project ID for reports.                                 |
| Workspace ID             | Optional / as applicable | Optional global Data View workspace ID required by your project.             |
| Data Residency Region    | Optional / as applicable | Choose the Mixpanel region where this project is hosted.                     |

#### Verify the connection

Check that the connection is healthy. Then run a read operation against a resource the connected account can access. A successful connection check confirms authentication; it does not guarantee permission for every action.

If access is denied, check the credential or OAuth permissions, the selected account or environment, and access to the specific resource. Update expired credentials or reconnect after permissions change.

### Use an action

1. Add the required **Mixpanel** action to the workflow.
2. Select a connection when the action requests one.
3. Complete the required fields. Use the reference picker when a value comes from another workflow step.
4. Run the workflow and inspect the action’s output. Check the result before using it in a later step.

### Actions

#### Track event

Record a product event in Mixpanel for a known or anonymous user.

**Inputs**

| Field                | Type     | Required | Description                                                         |
| -------------------- | -------- | -------- | ------------------------------------------------------------------- |
| Event name           | string   | Yes      | The event name as it should appear in Mixpanel.                     |
| Distinct ID          | string   | Yes      | The stable user or device identifier associated with the event.     |
| Event properties     | textarea | No       | Optional event details as a JSON object. Default: {}.               |
| Show advanced fields | boolean  | No       | Reveal an event time and deduplication ID. Default: false.          |
| Occurred at          | datetime | No       | When the event occurred, if it was not just now.                    |
| Deduplication ID     | string   | No       | A unique ID that prevents the same event from being recorded twice. |

**Outputs**

| Field            | Type    | Description                                              |
| ---------------- | ------- | -------------------------------------------------------- |
| Accepted         | boolean | Whether Mixpanel accepted the event payload.             |
| Event name       | string  | The event name Mixpanel received.                        |
| Distinct ID      | string  | The user or device identifier Mixpanel received.         |
| Deduplication ID | string  | The optional ID used to prevent duplicate event records. |

#### Set Profile Properties

Create or overwrite properties on a Mixpanel user profile.

**Inputs**

| Field              | Type     | Required | Description                                     |
| ------------------ | -------- | -------- | ----------------------------------------------- |
| Distinct ID        | string   | Yes      | The Mixpanel user profile to update.            |
| Profile properties | textarea | Yes      | The profile properties to set as a JSON object. |

**Outputs**

| Field              | Type    | Description                                              |
| ------------------ | ------- | -------------------------------------------------------- |
| Accepted           | boolean | Whether Mixpanel accepted the profile update.            |
| Distinct ID        | string  | The profile ID that was updated.                         |
| Updated properties | array   | The names of the profile properties that were submitted. |

#### Run retention query

Measure how often users return after a starting event over a date range.

**Inputs**

| Field                  | Type            | Required | Description                                                                                                                 |
| ---------------------- | --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------- |
| From date              | date            | Yes      | The first date included in the retention report.                                                                            |
| To date                | date            | Yes      | The last date included in the retention report.                                                                             |
| Retention type         | select (string) | Yes      | Whether to measure first-time cohort retention or recurring retention. Available values: Birth, Compounded. Default: birth. |
| Starting event         | string          | No       | The event that places a user into the starting cohort.                                                                      |
| Return event           | string          | No       | The event users should perform again or after joining the cohort.                                                           |
| Time unit              | select (string) | Yes      | How retention periods are grouped. Available values: Day, Week, Month. Default: day.                                        |
| Interval size          | integer         | Yes      | The number of time units in each retention period. Default: 1.                                                              |
| Show advanced fields   | boolean         | No       | Show optional retention filters and breakdown settings. Default: false.                                                     |
| Number of periods      | integer         | No       | The number of retention periods to include in the report. Default: 1.                                                       |
| Starting cohort filter | textarea        | No       | An optional Mixpanel expression that filters the starting cohort.                                                           |
| Return event filter    | textarea        | No       | An optional Mixpanel expression that filters returning events.                                                              |
| Break down by          | string          | No       | A property used to split the retention results into groups.                                                                 |
| Unbounded retention    | boolean         | No       | Count a user as retained in a period if they returned in that or any later period. Default: false.                          |

**Outputs**

| Field             | Type | Description                                    |
| ----------------- | ---- | ---------------------------------------------- |
| Retention cohorts | dict | Retention counts grouped by cohort start date. |
| From date         | date | The first included date.                       |
| To date           | date | The last included date.                        |

#### List saved funnels

List the saved Mixpanel funnels available to report on.

**Inputs**

No input fields are required in this catalog entry.

**Outputs**

| Field   | Type          | Description                                 |
| ------- | ------------- | ------------------------------------------- |
| Funnels | object\_array | The saved funnels with their IDs and names. |

#### Run funnel report

Retrieve conversion results for a saved Mixpanel funnel.

**Inputs**

| Field                | Type            | Required | Description                                                             |
| -------------------- | --------------- | -------- | ----------------------------------------------------------------------- |
| Saved funnel         | select (string) | Yes      | The saved funnel to analyze. Options load from the selected connection. |
| From date            | date            | Yes      | The first date included in the funnel report.                           |
| To date              | date            | Yes      | The last date included in the funnel report.                            |
| Show advanced fields | boolean         | No       | Show optional funnel filters and breakdown settings. Default: false.    |
| Break down by        | string          | No       | A property used to split funnel results into groups.                    |
| Filter               | textarea        | No       | A Mixpanel expression that filters users in the funnel report.          |
| Breakdown limit      | integer         | No       | The maximum number of segmented values to return. Default: 255.         |

**Outputs**

| Field          | Type          | Description                                           |
| -------------- | ------------- | ----------------------------------------------------- |
| Report dates   | string\_array | The dates included in the funnel result.              |
| Funnel results | dict          | Conversion steps and analysis grouped by report date. |

#### Run segmentation query

Analyze event activity over time with optional filters and property breakdowns.

**Inputs**

| Field                | Type            | Required | Description                                                                                                                     |
| -------------------- | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------- |
| Event name           | string          | Yes      | The Mixpanel event to analyze.                                                                                                  |
| From date            | date            | Yes      | The first date included in the segmentation report.                                                                             |
| To date              | date            | Yes      | The last date included in the segmentation report.                                                                              |
| Metric               | select (string) | Yes      | Whether to count all activity, unique users, or average activity. Available values: General, Unique, Average. Default: general. |
| Time unit            | select (string) | Yes      | How event activity is grouped over time. Available values: Minute, Hour, Day, Month. Default: day.                              |
| Show advanced fields | boolean         | No       | Show optional filters and breakdown settings. Default: false.                                                                   |
| Break down by        | string          | No       | A property used to split event activity into groups.                                                                            |
| Filter               | textarea        | No       | A Mixpanel expression that filters events in the report.                                                                        |
| Breakdown limit      | integer         | No       | The maximum number of segmented values to return. Default: 60.                                                                  |

**Outputs**

| Field       | Type    | Description                                      |
| ----------- | ------- | ------------------------------------------------ |
| Dates       | array   | The dates included in the returned values.       |
| Values      | dict    | Event metrics grouped by series and time bucket. |
| Legend size | integer | The number of series represented in the result.  |

### Important behavior

Actions that create, update, send, or delete data can change the connected service. Review their inputs before running them. A retry can repeat an operation; consider this when configuring retries for actions that change data.

The catalog lists the fields and capabilities available in the supplied provider definition. Availability can also depend on your deployment and organization’s Feature Access settings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/integrations/catalog/mixpanel.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
