Mixpanel

Learn how to use Mixpanel with Composio

Overview

SLUG: MIXPANEL

Description

Mixpanel is a product analytics platform tracking user interactions and engagement, providing cohort analysis, funnels, and A/B testing to improve user experiences

Authentication Details

region
stringRequired
username
stringRequired
password
stringRequired

Connecting to Mixpanel

Create an auth config

Use the dashboard to create an auth config for the Mixpanel toolkit. This allows you to connect multiple Mixpanel accounts to Composio for agents to use.

1

Select App

Navigate to Mixpanel.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Mixpanel Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using Basic Auth

1from composio import Composio
2from composio.types import auth_scheme
3
4# Replace these with your actual values
5mixpanel_auth_config_id = "ac_YOUR_MIXPANEL_CONFIG_ID"
6user_id = "user@example.com"
7username = "your_mixpanel_username"
8password = "your_mixpanel_password"
9
10composio = Composio()
11
12# Create a new connected account for Mixpanel using Basic Auth
13connection_request = composio.connected_accounts.initiate(
14 user_id=user_id,
15 auth_config_id=mixpanel_auth_config_id,
16 config=auth_scheme.basic_auth(
17 username=username,
18 password=password
19 )
20)
21
22# Basic authentication is immediate - no redirect needed
23print(f"Successfully connected Mixpanel for user {user_id}")
24
25# You can verify the connection using:
26# connected_account = composio.connected_accounts.get(user_id=user_id, app_id="MIXPANEL")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Mixpanel toolkit’s playground

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["MIXPANEL"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Get Aggregate Event Counts

Description

Get aggregate event counts over time. supports different types of aggregation: general, unique, average, sum.

Action Parameters

event
string
events
array
from_date
stringRequired
interval
integer
project_id
integerRequired
to_date
stringRequired
type
stringDefaults to general
unit
stringDefaults to day
where
string
workspace_id
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get All Projects

Description

Get all projects associated with the authenticated mixpanel account. returns project details including name, permissions, role, domain, and other configuration details.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Execute JQL Query

Description

Execute a custom jql (javascript query language) query against mixpanel's query api. key constraints: - 60 queries/hour, max 5 concurrent queries. - 2-minute execution timeout. - 5 gb data processing limit, 2 gb output limit. - no remote network requests (xmlhttprequest) are allowed inside the jql script.

Action Parameters

params
object
project_id
integerRequired
script
stringRequired
workspace_id
integer

Action Response

data
Required
error
string
successful
booleanRequired

Tool Name: List Saved Cohorts

Description

Get list of all cohorts in a mixpanel project. returns cohort details including name, id, count, description, creation date, and visibility. the query api has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

Action Parameters

project_id
integerRequired
workspace_id
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Saved Funnels

Description

Get the names and funnel ids of your funnels. the query api has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

Action Parameters

project_id
integerRequired
workspace_id
integer

Action Response

data
arrayRequired
error
string
successful
booleanRequired

Tool Name: Get Profile Event Activity

Description

Get event activity feed for specified users from mixpanel query api. the query api has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

Action Parameters

distinct_ids
arrayRequired
from_date
stringRequired
project_id
integerRequired
to_date
stringRequired
workspace_id
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Query Saved Funnel

Description

Get data for a funnel. the query api has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

Action Parameters

from_date
stringRequired
funnel_id
integerRequired
interval
integerDefaults to 1
length
integer
length_unit
string
limit
integerDefaults to 255
on
string
project_id
integerRequired
to_date
stringRequired
unit
string
where
string
workspace_id
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Query Saved Insight

Description

Get data from your insights reports. the query api has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

Action Parameters

bookmark_id
integerRequired
project_id
integerRequired
workspace_id
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Query Profiles

Description

Query user or group profile data from mixpanel. returns list of profiles that match specified parameters. the query api has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

Action Parameters

as_of_timestamp
integer
behaviors
integer
data_group_id
string
distinct_id
string
distinct_ids
array
filter_by_cohort
object
include_all_users
booleanDefaults to True
output_properties
array
page
integer
project_id
integerRequired
session_id
string
where
string
workspace_id
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Query Retention Report

Description

Get cohort analysis data. the query api has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

Action Parameters

born_event
string
born_where
string
event
string
from_date
stringRequired
interval
integerDefaults to 1
interval_count
integerDefaults to 1
limit
integer
on
string
project_id
integerRequired
retention_type
stringDefaults to birth
to_date
stringRequired
unbounded_retention
boolean
unit
stringDefaults to day
where
string
workspace_id
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Query Segmentation Report

Description

Get data for an event, segmented and filtered by properties. the query api has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

Action Parameters

event
stringRequired
from_date
stringRequired
interval
integer
limit
integerDefaults to 60
on
string
project_id
integerRequired
to_date
stringRequired
type
stringDefaults to general
unit
stringDefaults to day
where
string
workspace_id
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Aggregated Event Property Values

Description

Get unique, total, or average data for a single event and property over days, weeks, or months. the query api has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

Action Parameters

event
stringRequired
format
stringDefaults to json
from_date
string
interval
integer
limit
integerDefaults to 255
name
stringRequired
project_id
integerRequired
to_date
string
type
stringRequired
unit
stringRequired
values
array
workspace_id
integer

Action Response

data
objectRequired
error
string
legend_size
integerRequired
successful
booleanRequired

Tool Name: Get Aggregate Events

Description

Get aggregate event counts over time. supports different types of aggregation: general, unique, average, sum.

Action Parameters

event
string
events
array
from_date
stringRequired
interval
integer
limit
integer
project_id
integerRequired
to_date
stringRequired
type
stringDefaults to general
unit
stringDefaults to day
where
string
workspace_id
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Query Frequency Report

Description

Get data about how frequently users are performing events. the query api has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries. example response with unit="day" and addiction unit="hour": { "2012-01-01": [305, 107, 60, 41, ...], # users who did event in 1+ hours, 2+ hours, etc. "2012-01-02": [495, 204, 117, 77, ...], "2012-01-03": [671, 324, 176, 122, ...] }

Action Parameters

addiction_unit
stringRequired
event
string
from_date
stringRequired
limit
integer
on
string
project_id
integerRequired
to_date
stringRequired
unit
stringRequired
where
string
workspace_id
integer

Action Response

computed_at
stringRequired
data
objectRequired
error
string
metadata
objectRequired
successful
booleanRequired

Tool Name: Query Numeric Average Report

Description

Averages an expression for events per unit time. the query api has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries. example response: { "status": "ok", "results": { "2024-01-01": 25.5, "2024-01-02": 32.75, "2024-01-03": 28.25 } }

Action Parameters

event
stringRequired
from_date
stringRequired
on
stringRequired
project_id
integerRequired
to_date
stringRequired
unit
stringDefaults to day
where
string
workspace_id
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Query Numeric Segmentation Report

Description

Get data for an event, segmented and filtered by properties, with values placed into numeric buckets. the query api has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

Action Parameters

event
stringRequired
from_date
stringRequired
on
stringRequired
project_id
integerRequired
to_date
stringRequired
type
stringDefaults to day
unit
stringDefaults to day
where
string
workspace_id
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Query Numeric Sum Report

Description

Sums an expression for events per unit time. the query api has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries. example response: { "status": "ok", "computed at": "2024-01-20t12:00:00", "results": { "2024-01-01": 150.5, "2024-01-02": 245.75, "2024-01-03": 198.25 } }

Action Parameters

event
stringRequired
from_date
stringRequired
on
stringRequired
project_id
integerRequired
to_date
stringRequired
unit
stringDefaults to day
where
string
workspace_id
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Today’s Top Events

Description

Get the top events for today, with their counts and the normalized percent change from yesterday. the query api has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

Action Parameters

limit
integerDefaults to 100
project_id
integerRequired
type
stringRequired
workspace_id
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Top Events

Description

Get a list of the most common events over the last 31 days. the query api has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

Action Parameters

limit
integerDefaults to 255
project_id
integerRequired
type
stringRequired
workspace_id
integer

Action Response

data
arrayRequired
error
string
successful
booleanRequired

Tool Name: Get Top Event Properties

Description

Get the top property names for an event. the query api has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

Action Parameters

event
stringRequired
limit
integerDefaults to 10
project_id
integerRequired
workspace_id
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Top Event Property Values

Description

Get the top values for a property. the query api has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

Action Parameters

event
stringRequired
limit
integerDefaults to 255
name
stringRequired
project_id
integerRequired
workspace_id
integer

Action Response

data
arrayRequired
error
string
successful
booleanRequired