How to Add an Event in Mixpanel
- Sophie Ricci
- Views : 28,543
Table of Contents
You built a product. People are using it. But you have no idea what they’re actually doing inside it.
That’s the problem Mixpanel solves — and events are the foundation of everything. Without events, you’re flying blind. With them, you can see exactly where users drop off, what actions lead to conversions, and what’s worth doubling down on.
This guide walks you through exactly how to add an event in Mixpanel, from setup to verification, with best practices that make your data actually useful.
What Is a Mixpanel Event?
A Mixpanel event is a data point that records a specific action a user takes in your product or website. Every time someone clicks a button, submits a form, watches a video, or completes a purchase — that’s an event.
Events are made up of two parts:
- Event name — what happened (e.g., Sign Up Completed, Video Played)
- Event properties — details about what happened (e.g., plan_type: “pro”, video_id: “12345”)
Together, they give you a granular picture of user behavior that no pageview metric can replicate.
Quick stat: Mixpanel processes over 1 trillion events per year across thousands of product teams globally — making it one of the most widely used behavioral analytics platforms in the world.
Why Event Tracking Matters More Than You Think
Most teams treat analytics as an afterthought. They set up a few basic metrics, check them occasionally, and wonder why growth feels random.
But the data tells a different story:
- Companies using behavioral analytics are 23x more likely to acquire customers than those who don’t (McKinsey)
- 87% of marketers say data is their most underutilized asset (Forbes)
- Teams that instrument products with event tracking see 2–3x improvements in conversion rates within the first six months of optimization
- 73% of businesses say data-driven decision-making is a top priority — but only 29% actually have the analytics infrastructure to act on it (Salesforce)
- Products with comprehensive event tracking reduce churn by an average of 20–30% by identifying and fixing friction points before users leave
- Only 40% of companies use behavioral data to guide their product roadmap — creating a massive competitive gap for those who do
The companies winning in 2025 aren’t guessing. They’re tracking, analyzing, and acting on event data faster than their competitors.
Types of Events in Mixpanel
Before you start adding events, understand the three main types:
Default Events Mixpanel automatically tracks some events when you install the SDK — like page views (if you enable them). These are good starting points but rarely enough on their own.
Custom Events These are the events you define based on what matters for your specific product. A SaaS product might track Trial Started or Feature Unlocked. An e-commerce store might track Product Added to Cart or Checkout Initiated.
Virtual Events (in Mixpanel UI) Created inside Mixpanel by combining or filtering existing events without touching code. Useful for grouping related actions or creating segments on the fly.
For most teams, custom events are where the real value lives. That’s what this guide focuses on.
How to Add an Event in Mixpanel
Set Up Your Mixpanel Project First
Before you can track events, you need a Mixpanel project.
- Go to mixpanel.com and log in (or create a free account)
- Click Create New Project from your dashboard
- Name your project and select your data residency region (US or EU)
- Copy your Project Token — you’ll need this when installing the SDK
Mixpanel’s free plan includes up to 20 million monthly events — more than enough for most early-stage products.
Install the Mixpanel SDK
Events are sent to Mixpanel through their SDK. Pick the one that matches your stack.
JavaScript (Web)
npm install mixpanel-browser
Then initialize it in your app:
import mixpanel from ‘mixpanel-browser’;
mixpanel.init(‘YOUR_PROJECT_TOKEN’, {
debug: true,
track_pageview: true,
persistence: ‘localStorage’
});
Python (Server-side)
pip install mixpanel
from mixpanel import Mixpanel
mp = Mixpanel(‘YOUR_PROJECT_TOKEN’)
Other SDKs available: iOS (Swift/ObjC), Android (Kotlin/Java), Ruby, PHP, Go, React Native, Flutter.
Track Your First Custom Event
Once the SDK is initialized, tracking an event is a single line of code.
JavaScript:
mixpanel.track(‘Sign Up Completed’, {
plan_type: ‘pro’,
signup_method: ’email’,
referral_source: ‘google_ads’
});
Python:
mp.track(‘user_distinct_id’, ‘Sign Up Completed’, {
‘plan_type’: ‘pro’,
‘signup_method’: ’email’
})
The first argument is your event name. Everything inside the object/dictionary is an event property — context that makes your data actionable.
Add Events Using the Mixpanel Lexicon (No-Code Option)
If you want to define and manage events without touching code, Mixpanel’s Lexicon is your command center.
- In your Mixpanel project, go to Data Management → Lexicon
- Click the Events tab
- Click + Add Event Definition
- Enter the event name exactly as it appears in your code (it’s case-sensitive)
- Add a description so your team knows what it means
- Map any event properties with their expected data types (string, number, boolean, etc.)
- Click Save
Lexicon doesn’t create events — it documents and organizes events that are already being tracked. This is critical for team alignment, especially as your tracking grows.
Identify Users Before Tracking Events
Events become dramatically more powerful when tied to specific users.
// Identify a user after they log in
mixpanel.identify(‘user_12345’);
// Set user profile properties
mixpanel.people.set({
‘$name’: ‘Jane Smith’,
‘$email’: ‘jane@company.com’,
‘plan’: ‘pro’,
‘company’: ‘Acme Inc’
});
Without identification, events are tracked anonymously. You can still use them for aggregate analysis, but you lose the ability to do cohort-level analysis or user journey mapping.
Stat to know: Companies that combine event tracking with user identification see 35% better retention insights compared to teams using anonymous event data alone.
Verify Your Events Are Firing Correctly
Before you trust your data, confirm the events are actually coming through.
Option 1 — Mixpanel Live View
- In your Mixpanel project, go to Activity (or Live View depending on your plan)
- Perform the action you’re tracking in your product
- Watch the event appear in real time within 3–5 seconds
Option 2 — Browser DevTools With debug: true in your init config, Mixpanel logs every event to your browser console. Open DevTools, go to the Console tab, trigger your action, and look for Mixpanel output.
Option 3 — Events Report Go to Reports → Events in your Mixpanel dashboard. Filter by your event name and check the last 24 hours. If the count goes up after you trigger the event, you’re good.
How to Add Events Using the Ingestion API (No SDK)
If you’re working server-side without an SDK, you can send events directly via HTTP.
curl –request POST \
–url https://api.mixpanel.com/track \
–header ‘accept: text/plain’ \
–header ‘content-type: application/json’ \
–data ‘[
{
“event”: “Sign Up Completed”,
“properties”: {
“distinct_id”: “user_12345”,
“token”: “YOUR_PROJECT_TOKEN”,
“plan_type”: “pro”,
“time”: 1698765432
}
}
]’
The API returns 1 on success. This method works well for backend event ingestion, batch imports, or migrating historical data from another platform.
Mixpanel stat: The Mixpanel Ingestion API supports up to 2,000 events per batch request, making bulk historical imports straightforward for data migrations.
Best Practices for Naming Mixpanel Events
Bad event names are one of the most common analytics mistakes. They make your data hard to read, hard to filter, and hard to share with your team.
Use a consistent naming convention. The most common is Object Action format:
- ✅ Video Played, Form Submitted, Plan Upgraded
- ❌ play, formsubmit, upgraded_plan
Be specific, not generic. Button Clicked tells you nothing. Upgrade CTA Clicked tells you everything.
Use title case for event names. It’s easier to read in dashboards and becomes a de facto standard for most teams.
Use snake_case for property keys. plan_type, signup_method, video_duration — keep it consistent across all events.
Avoid abbreviations. btn_clk_nav_2 is unreadable six months later. Navigation Button Clicked is not.
Document every event in Lexicon. Add descriptions, expected values, and owners. Your future self (and your team) will thank you.
Industry data: Teams with documented data taxonomies spend 60% less time debugging analytics discrepancies and onboarding new team members.
Common Event Tracking Mistakes to Avoid
Tracking everything without a plan. More events ≠ better insights. Start with the 10–15 events that map directly to your core funnel. Add more once those are clean and trusted.
Not setting a distinct_id. Anonymous events are useful for top-level metrics but useless for user-level analysis. Always identify users after authentication.
Inconsistent property types. Sending plan_type: “pro” in one event and plan_type: 1 in another breaks your filters. Standardize property types across your implementation.
Forgetting to test in staging first. Use a separate Mixpanel project (or the debug flag) for development so test events don’t pollute your production data.
Ignoring the time property. If you’re importing historical data, always set the time property explicitly (Unix timestamp in seconds). Mixpanel defaults to the ingestion time if not set, which corrupts historical analysis.
No ownership. If nobody owns the tracking plan, it decays fast. Assign one person to maintain your Lexicon and event documentation.
How to Create a Virtual Event in Mixpanel
Virtual events let you group or filter existing events inside Mixpanel without writing code. Useful when you want to combine Add to Cart Clicked and Checkout Initiated into a single Purchase Intent event for reporting.
- Go to Data Management → Lexicon
- Click + Create Virtual Event
- Name your virtual event
- Define the filter logic — select which existing events and properties qualify
- Save and use it in any Mixpanel report immediately
Virtual events don’t affect raw data. They’re reporting layers only — which means you can create and delete them freely without touching your implementation.
Conclusion
Adding events in Mixpanel isn’t complicated — but doing it right takes intention.
The teams that win with product analytics aren’t tracking the most events. They’re tracking the right events, naming them consistently, tying them to real users, and acting on what they find.
Start with your core conversion funnel. Get those five to ten events clean and verified. Then build outward from there.
Once your Mixpanel data shows you where users convert — your next question becomes: how do you get more of the right users into that funnel in the first place?
That’s where outbound lead generation comes in. At SalesSo, we build complete outbound systems — precision targeting, multi-touch campaign design, and scaling infrastructure across LinkedIn and cold email — that consistently put qualified decision-makers in front of your team.
If your funnel is solid but your pipeline is thin, book a strategy meeting and let’s fix that.
📊 Turn Data Into Pipeline We build complete outbound
systems — targeting, campaign design, and scaling — that consistently deliver qualified meetings.
7-day Free Trial |No Credit Card Needed.
FAQs
How does Mixpanel event tracking connect to getting more leads and customers?
What counts as an event in Mixpanel?
How many events can I track for free?
Can I add events to Mixpanel without code?
We deliver 100–400+ qualified appointments in a year through tailored omnichannel strategies
- blog
- Sales Development
- How to Add an Event in Mixpanel (Step-by-Step Guide)