Retention is the metric that separates products that stick from those that leak users. Mixpanel's retention reports show you exactly how many users come back after their first action, broken down by cohort and time. Without it, you're guessing whether your product is actually sticky.
Instrument Your Events for Retention Tracking
Retention analysis only works if you're tracking the right events. You need a clear starting event (like signup) and a returning event (like active use).
Step 1: Track Your Starting Event
Choose what marks a user's entry into your retention cohort. This is usually signup or first_login. Send this event to Mixpanel with track() and a distinct user ID.
// When a user signs up
mixpanel.track('Signup', {
'Plan Type': 'free',
'Signup Source': 'organic',
'Signup Date': new Date()
});
// Immediately identify the user
mixpanel.identify(userId);Step 2: Track Your Returning Event
Define what counts as a user returning. Common choices: session_start, page_view, or feature_used. Mixpanel measures what percentage of your cohort triggers this event again.
// On every active session
mixpanel.track('Session Start', {
'Session ID': sessionId,
'Device Type': 'mobile',
'App Version': appVersion
});
// Or track specific feature usage
mixpanel.track('Dashboard Viewed', {
'Dashboard Type': 'analytics'
});Step 3: Identify Users Before Events
Always call identify() with the same distinct ID for a user across sessions. Without it, Mixpanel treats each session as a new user and retention data becomes meaningless.
// Call identify() immediately after authentication
const userId = user.id; // e.g., "user_12345"
mixpanel.identify(userId);
// All subsequent events are linked to this user
mixpanel.track('Feature Used', { Feature: 'Export' });
// On logout
mixpanel.reset();identify() before track().Build Your Retention Report
Once events flow into Mixpanel, create the retention report to visualize cohort behavior over time.
Step 4: Open Retention in Mixpanel
Click Retention in the left sidebar. This opens Mixpanel's cohort retention interface where you define starting and returning events.
// Verify events are flowing via the Mixpanel UI
// Or use the Data API to check:
const token = 'YOUR_MIXPANEL_TOKEN';
fetch(`https://mixpanel.com/api/2.0/engage?token=${token}`)
.then(res => res.json())
.then(data => console.log('Users in Mixpanel:', data.total));Step 5: Select Your Starting Event
Under Cohort Definition, select the event that marks user entry (e.g., Signup). Optionally filter by properties like Plan Type = 'free' to segment your cohort.
// In the UI, select 'Signup' from the event dropdown
// Add filters to narrow your cohort:
// Event: Signup
// Where: Plan Type = 'premium' (only premium signups)
// This creates a smaller cohort for more focused analysisStep 6: Choose Your Returning Event
Select what counts as returning — typically Session Start or a feature-specific event like Dashboard Viewed. Mixpanel measures the percentage of your cohort triggering this event.
// In the UI, select returning event(s)
// You can track multiple returning events simultaneously:
// - Session Start (broad engagement)
// - Feature Used (core feature adoption)
// - Dashboard Viewed (premium feature usage)
// Each shows as a separate retention curveStep 7: Set Time Granularity
Choose Daily, Weekly, or Monthly intervals. Daily is granular; weekly smooths noise; monthly is best for low-frequency products.
// Time interval options based on product type:
// Daily: High-engagement (social, news, messaging)
// Weekly: Productivity tools, SaaS dashboards
// Monthly: Enterprise software, accounting tools
// The matrix: X-axis = days/weeks since starting event, Y = cohorts, cells = % retainedAnalyze Results and Troubleshoot
A retention report reveals product health. Watch for warning signs and segment by user properties to find which groups are most at risk.
Step 8: Identify Churn Patterns
Look for cliff patterns (sharp drops after day 1 or week 1), which signal early churn. Use Breakdown to compare retention across signup source, plan type, or geography.
// Fetch retention data via REST API for analysis
const params = new URLSearchParams({
from_date: '2026-01-01',
to_date: '2026-03-26',
retention_type: 'linear',
event: 'Session Start',
born_event: 'Signup',
unit: 'day',
token: 'YOUR_MIXPANEL_TOKEN'
});
fetch(`https://mixpanel.com/api/2.0/retention?${params}`)
.then(res => res.json())
.then(data => console.log('Retention by cohort:', data));Step 9: Segment Retention by User Properties
In the retention report, click Breakdown and select a property like Plan Type or Signup Source. This splits retention curves by segment, showing which groups are stickier.
// Set user properties during signup for segmentation
mixpanel.people.set({
'Plan Type': 'enterprise',
'Signup Source': 'paid_ads',
'Company Size': 'large',
'Industry': 'saas',
'Signup Date': new Date()
});
// Mixpanel uses these properties to create breakdowns in the UIidentify() fires *before* your returning event, or Mixpanel won't link them to the same user.Common Pitfalls
- Forgetting to call
identify()before tracking events — Mixpanel won't link returning events to the original user - Mixing anonymous and identified users in the same cohort — creates data gaps and inflates churn numbers
- Choosing a returning event that's too rare (e.g., 'Paid Invoice') — you'll see near-zero retention even if users are active
- Not setting user properties early — you'll have no way to segment retention by plan, source, or geography later
Wrapping Up
You now have retention tracking live in Mixpanel and can watch how user cohorts behave over time. Watch for cliff patterns, segment by user segment, and use trends to prioritize feature work. If you want to track this automatically across all your analytics tools and get smarter retention insights, Product Analyst can help.