Mixpanel API

Ingest data from Mixpanel to your spreadsheet using the Mixpanel Python Client.

Sample sheet: https://app.quadratichq.com/file/0baf7fc1-9a01-411b-8b9d-b9e00725240e

Insights report

All Mixpanel reports can be queried for your analysis. Make sure you start by getting the appropriate authentication.

Enter your service account username and password in the Python tab on the right of this page: https://developer.mixpanel.com/reference/insights-query.

To retrieve or create a service account you'll need to visit your organization settings to get one set up: https://mixpanel.com/settings/org#serviceaccounts

import requests

# Get insights report data
url = "https://mixpanel.com/api/query/insights?project_id=<your_project_id>"

# Get your_auth here by entering your creds: https://developer.mixpanel.com/reference/insights-query
headers = {
    "accept": "application/json",
    "authorization": "Basic <your_auth>"
}

# Query the API
response = requests.get(url, headers=headers)

# Print response
print(response.text)

Once your auth is set up, you can follow the same pattern for querying funnel, retention, segmentation, and other reports.

Follow the Mixpanel docs: https://developer.mixpanel.com/reference/query-api

Update users

Writing to Mixpanel is quite easy using the Mixpanel Python client. The Mixpanel Python client is built specifically for updating your Mixpanel data.

import micropip
await micropip.install('mixpanel')

from mixpanel import Mixpanel
mp = Mixpanel("YOUR_TOKEN_HERE")

# Update a user
DISTINCT_ID = 'ID_GOES_HERE'
mp.people_set(DISTINCT_ID, {'$first_name' : 'fakeName', 'favorite pizza': 'margherita'})

'Update user'

Find more options for analytics in the Mixpanel docs.

Need help making this connection? Feel free to reach out to support@quadratichq.com for help.

Quadratic logo

The spreadsheet with AI.

Use Quadratic for free