# Mixpanel

![mixpanel.svg](https://assets.relyanceuat.xyz/images/docs/12884405356045/12883129980429.svg)
Mixpanel is a tool that allows you to analyze how users interact with your Internet-connected product. It's designed to make teams more efficient by allowing everyone to analyze user data in real-time to identify trends, understand user behavior, and make decisions about your product.

In order to integrate Mixpanel with Relyance AI you will need an **API Username**, **API Secret**, and **Project Token**.

#### In Mixpanel:

1. Login to your Mixpanel account.
2. Ensure you are on in the correct project. In the top right-hand side, click the cogwheel and select **Project Settings**.
3. On the **Overview** page scroll down to the **Access Keys** section and copy the **Project Token**.
4. In the top right-hand side, click the cogwheel again and select **Organization Settings**.
5. In the left-hand navigation menu, click **Service Accounts**.
6. Click the **+ Add Service Account** link.
7. Fill out the **Create Service Account** dialog with: **Name**: Provide a meaningful name (e.g. RelyanceScan) **Organization Role**: Admin **Projects**: Select the Project you chose in step 2 **Project Role:** Admin
8. Click **Create**.
9. In the resulting dialog, copy the Username (your **API Username**) and Secret (your **API Secret** ) to be used in Relyance.

![Mixpanel-5.png](https://assets.relyanceuat.xyz/images/docs/12884405356045/12884271653261.png)

![Mixpanel-3.png](https://assets.relyanceuat.xyz/images/docs/12884405356045/12884299791245.png)

![Mixpanel-4.png](https://assets.relyanceuat.xyz/images/docs/12884405356045/12884299678349.png)

#### In the Relyance AI application:

1. Login to your Relyance account.
2. Navigate to the **Settings** Menu in the bottom left-hand side.
3. Select **Integrations**.
4. Click on the **Vendor Integration** tab.
5. Find the **Mixpanel** integration card and click it to open its connections.
6. Under **Authentication Method**, choose **Custom**.
8. If this integration is to process data subject requests, ensure the **Process DSRs** checkbox is selected.
9. Paste the **API Username**, **API Secret**, and **Project Token** into their respective fields.

![Mixpanel-1.png](https://assets.relyanceuat.xyz/images/docs/12884405356045/12883275751565.png)

10. Click **Authenticate**.
11. At this point, you should see the following result on the **Vendor** Integrations page:

![Mixpanel-2.png](https://assets.relyanceuat.xyz/images/docs/12884405356045/12883275747853.png)

12. Congratulations, you are now connected to **Mixpanel**.

<!-- failure-modes:begin (generated from the integration catalog; do not hand-edit) -->

## If the connection reports Connected but returns nothing

These are the ways this integration comes back empty without reporting an error. Generated from the integration catalog, so it tracks what the connection actually asks for.

1. **A feature you enabled returns nothing.** Some scopes belong to a feature rather than to the connection: **Data subject requests** needs `Service Account: Admin`. Turning the feature on after the connection exists does not widen the grant it already holds, so re-authenticate the connection.
2. **A credential rotated at the vendor is not picked up here.** **API Secret** and **Project Token** are stored when you save the connection, so regenerating the value at the vendor breaks the next scan until it is re-pasted here. Recording the expiry on the connection means Relyance warns you before it lapses.

<!-- failure-modes:end -->

<!-- terraform-examples:begin (generated from the integration catalog; do not hand-edit) -->

## Manage this integration with Terraform

Connections for this integration can be managed as code with the [Relyance Terraform provider](https://registry.terraform.io/providers/Relyance/relyance/latest). Non-secret fields go in `auth.params`; secret fields go in `auth.secrets_wo`, which is write-only — never stored in Terraform state. Rotate secrets by bumping `auth.secrets_wo_version`.

```hcl
resource "relyance_integration_connection" "mixpanel" {
  vendor = "mixpanel"
  name   = "<your connection name>"

  auth = {
    method = "api-key"
    params = {
      api_user = "<api_user>"
      data_storage_location = "us"
    }
    # Secret fields are write-only: sent to Relyance, never stored in state.
    secrets_wo = {
      api_secret = var.mixpanel_api_secret
      project_token = var.mixpanel_project_token
    }
    secrets_wo_version = 1
  }

  scans = { "property-inspection" = { enabled = true } }
}
```

<!-- terraform-examples:end -->
