What You’ll Need
Before starting, make sure you have:- A Mixpanel account with Admin or Owner access (sign up if you don’t have one)
- Access to an AI coding assistant (Claude, ChatGPT, Cursor, etc.)
- Be sure to use the most advanced AI model you have access to
- Your project’s code files and a development or staging environment to test the changes
Step 1: Get Your Mixpanel Project Token
Log into Mixpanel
Log into your Mixpanel account
Open Project Settings
Go to your project settings (gear icon in the bottom left)
Find Your Token
Click on “Overview” in the left sidebar. Scroll down to Access Keys section and copy your “Project Token” - it looks like a long string of letters and numbers.
You will need to be an Admin or Owner in your project
Step 2: Create Your AI Instructions
Choose Your Settings
You’ll need to pick three things:A. Choose Your SDK Type
This depends on what type of app or website you’re building:- Web
- Mobile
- Server
- Gaming
javascript- For web applications
Don’t see your platform? Check with a developer or choose the closest match.
B. Choose Your Event Type
This determines what kinds of user actions you’ll track:ai- Best for AI-powered features (chatbots, AI tools, ML features)ecommerce- Best for online stores and shopping appsdefault- Good general-purpose events for most other apps
C. Decide on Extra Features
- Autocapture - Automatically tracks clicks and page views (JavaScript SDK only)
- Session Replay - Records user sessions for debugging (JavaScript, iOS Swift, Android SDKs only)
Step 3: Give Instructions to Your AI Assistant
Step 4: Test Your Installation
After the AI completes the setup, test that everything is working:Quick Test
Check Mixpanel
Go to your Mixpanel dashboard and click on “Events” in the left sidebar or visit the Events page
What to Look For
Depending on your event type, you should see:- AI Events
- E-commerce Events
- Default Events
- Launch AI when AI features are used
- AI Prompt Sent when users send prompts
- AI Response Sent when AI responds
Command Line Mode
Skip the interactive prompts by providing options directly:Available Options
| Option | Description | Values |
|---|---|---|
-t, --token | Your Mixpanel project token | String |
--sdk | SDK type to install | javascript, flutter, ios-objective-c, ios-swift, android, react-native, go, python, ruby, php, nodejs,java, unity |
--events | Additional event type options | ai, ecommerce, default |
--autocapture | Enable autocapture (JavaScript only) | Boolean flag |
--sessionreplay | Enable session replay (Javascript, iOS Swift and Android Only) | Boolean flag |
--confirm-each | Require approval for each code change made by AI | Boolean flag |
Event Templates
Default Events
- Sign Up: Track new user acquisition with signup method and UTM parameters
- Sign In: Monitor user login events with authentication method tracking
- Page View: Track page/screen views with URL and title information
- Search: Capture search queries and result counts
- Error: Monitor application errors with error types and messages
- Purchase: Track completed transactions with revenue and currency data
- Conversion: Monitor key value moments specific to your product type
AI Events
- Launch AI: Track AI feature engagement and measure adoption patterns
- AI Prompt Sent and Prompt Text: Capture user prompts and analyze engagement intent
- AI Response Sent: Monitor AI outputs with cost, token usage, and response time metrics
- API Error: Track AI feature errors and monitor failure rates
- User Feedback: Collect user sentiment and feedback on AI interactions
- AI Dismissed: Monitor AI feature disengagement points
- Conversion Event: Measure how AI features influence key business outcomes
E-commerce Events
- Purchase: Track completed transactions with cart contents and total price
- Add to Cart: Monitor shopping behavior with cart items and product categories
- Product Viewed: Track product engagement across the purchasing funnel
- Ad Data: Monitor advertising spend and cost data for ROI calculations
Troubleshooting
No Events Showing Up?
No Events Showing Up?
- Check that you used the correct project token
- Verify your app is running and being used
- Wait a few minutes - sometimes there’s a delay
- Check the browser console (F12) for any error messages
Wrong Events Tracking?
Wrong Events Tracking?
- Make sure you chose the right event type in Step 2B
- Ask your AI assistant to show you what events are being tracked
- You can always re-run the setup with different event types
Need Help?
Need Help?
- Check the Mixpanel documentation at docs.mixpanel.com
- Ask your AI assistant to explain what it installed
- Contact Mixpanel support through our help center
Success!
Once you see events flowing into your Mixpanel dashboard, you’re all set! You can now:- View real-time user activity
- Create reports and dashboards
- Set up alerts for important events
- Analyze user behavior patterns