Integrating with Mixpanel
This guide shows you how to integrate Superline Agent Detection with Mixpanel to distinguish between human and AI agent traffic in your analytics data.Why Segment AI Agent Data in Mixpanel
Mixpanel is powerful for understanding user behavior and funnels, but AI agents can distort your insights by:- Inflating engagement metrics
- Creating misleading user journey patterns
- Skewing conversion funnels and rates
- Distorting cohort analysis
- Filter out or separately analyze AI agent traffic
- Compare behavior patterns between humans and AI agents
- Create more accurate funnels based on human-only traffic
- Make data-driven decisions based on actual human behavior
Integration Steps
1
Install Required Libraries
Install both Mixpanel and Superline Agent Detection:If you’re using script tags instead:
2
Initialize Both Libraries
Initialize both libraries early in your application:
3
Detect and Register User Properties
After collecting enough data for detection, register the result as a Mixpanel user property:
4
Create Mixpanel Cohorts
In your Mixpanel project:
- Go to Data Management > Cohorts
- Create two cohorts:
- Human Users: where “Is Agent” equals “false”
- AI Agents: where “Is Agent” equals “true”
5
Set Up Segmented Reports
Create segmented reports to compare humans vs. AI agents:
- Create any report (Insights, Funnels, Flows, etc.)
- Click “Add filter” or “Segment by”
- Select “Is Agent” as the property
- Compare “true” vs “false” values
Complete Integration Example
Here’s a comprehensive integration example that covers various scenarios:Advanced Mixpanel Features
Funnel Analysis
Funnel Analysis
Create separate funnels for humans and AI agents:
- Go to Funnels in Mixpanel
- Create your conversion funnel
- Click “Segment by” and select “Is Agent”
- Compare conversion rates between humans and AI agents
Retention Analysis
Retention Analysis
Compare retention metrics between humans and AI agents:
- Go to Retention in Mixpanel
- Set up your retention analysis
- Break down by “Is Agent”
JQL for Advanced Queries
JQL for Advanced Queries
Use Mixpanel’s JQL (JavaScript Query Language) to perform advanced analysis:This allows for complex filtering and analysis based on the agent detection data.
Implementation Patterns
Best Practices
- Wait For Sufficient Data: Allow 3-5 seconds of user interaction before finalizing detection
- Register Super Properties: Use Mixpanel’s super properties to automatically include agent information in all events
- Create Segment Comparisons: Always compare key metrics between human and AI segments
- Use Cohorts: Create saved cohorts for humans and agents to easily apply these segments in any report
- Consider Confidence Thresholds: For uncertain cases (confidence around 0.4-0.6), you may want to create a third “uncertain” segment based on the
Agent Confidence
property, or adjust the initial detection threshold using theinit
option.