Custom Analytics Integration
This guide shows you how to integrate Superline Agent Detection with any analytics platform of your choice, beyond the specific integrations we’ve covered for Google Analytics and Mixpanel.Universal Integration Approach
Regardless of which analytics platform you’re using, the core integration pattern remains similar: detect AI agents and include this information in your analytics data. Here’s a universal approach that works with any platform.1
Initialize Agent Detection
First, initialize Superline Agent Detection early in your application:
2
Create Detection Function
Create a function that performs detection and returns the result:
3
Integrate with Your Analytics
Call the detection function at the appropriate time and add the result to your analytics platform:
Platform-Specific Examples
Here are integration examples for several popular analytics platforms:Segment
Segment
Amplitude
Amplitude
Plausible
Plausible
Adobe Analytics
Adobe Analytics
Custom Backend API
Custom Backend API
Creating a Universal Analytics Wrapper
For larger applications that need a consistent analytics interface across multiple pages/components, consider creating a universal analytics wrapper that incorporates agent detection:Best Practices for Any Platform
Regardless of which analytics platform you’re using, follow these best practices:Consistent Property Names
Use consistent property names across all events (e.g., always use
isAgent
rather than mixing is_agent
, isBot
, etc.)Include Confidence
Always include the confidence for nuanced analysis.
Delay Detection
Wait 3-5 seconds before performing detection to allow sufficient data collection
Graceful Fallbacks
Handle detection failures gracefully to ensure analytics continue to work even if detection fails
Advanced Topics
Real-time Dashboards
Real-time Dashboards
For real-time monitoring of human vs. AI traffic:
- Send detection results to a real-time data processing system like Firebase, Supabase, or a custom WebSocket server
- Build a dashboard that shows current traffic breakdowns
- Set up alerts for unusual patterns in agent traffic
Session Stitching
Session Stitching
For multi-page applications, ensure consistent agent detection across pages:
A/B Testing Integration
A/B Testing Integration
Ensure A/B tests consider agent status: