Retention is one of the hardest metrics to move, but you can't improve what you don't measure. In Mixpanel, retention tracking means identifying a cohort of users on a specific date, then measuring how many of them perform a key action—like logging in or posting content—in subsequent periods. Knowing whether your retention is improving week-to-week tells you if your product changes are actually keeping users around.
Track the Right Events
Retention in Mixpanel is built on events. You need to identify which user actions actually signal engagement—login, a feature use, a purchase—then make sure you're tracking those consistently.
Identify Your Retention Event
Pick one action that represents an active, engaged user. For most products, this is login or a core feature interaction. Don't overthink it—pick something binary that users either do or don't do in a given period. Common choices: login, purchase, post_content, api_call.
Track the Event from Your Client SDK
Send the event to Mixpanel every time the user performs that action. Include the user ID and any properties that help you segment later (plan tier, signup source, region). Use mixpanel.track() with a consistent event name.
// Track a user login
mixpanel.identify(userId);
mixpanel.track('login', {
'plan': userPlan,
'source': signupSource,
'account_age_days': daysSinceSignup
});Set User Properties for Cohort Segmentation
Register user properties that stay with the user profile, not just individual events. This lets you slice retention by plan, region, or other attributes in your retention report. Use mixpanel.register() or include properties in track().
// Set user properties once during signup
mixpanel.register({
'plan': 'professional',
'company_industry': 'saas',
'signup_date': new Date().toISOString()
});
// Or include them in every event
mixpanel.track('feature_used', {
'feature': 'export',
'plan': 'professional'
});login on web but user_login on mobile, Mixpanel treats them as different events.Build and Interpret a Retention Report
Once you're tracking events, Mixpanel's Retention report does the heavy lifting: it automatically cohorts users by their first occurrence of an event, then tracks how many repeat that event in subsequent periods.
Open the Retention Report
In Mixpanel, navigate to Analytics > Retention. This opens the retention analysis interface. You'll define the event that starts a cohort, the event that defines a returning user, and the date range.
Set Up the Report Parameters
Choose the event that starts a cohort (usually login or signup), then choose the event that defines return (usually the same). Set the cohort date range and period granularity (daily, weekly, or monthly). Segment by user properties if you want to compare retention across plans or regions.
// Query retention via Mixpanel's Data Export API
const response = await fetch(
'https://data.mixpanel.com/api/2.0/retention?' +
'event=login&unit=week&interval=10&access_token=YOUR_TOKEN'
);
const cohorts = await response.json();
console.log(cohorts); // Returns retention data keyed by cohort dateRead the Retention Table
The report shows a cohort table: rows are cohort start dates, columns are weeks (or days/months) since cohort start. Each cell is the percentage of users from that cohort who returned. A 60% in week 1 means 60% of users from that cohort performed the tracked event again in week 2. Watch for decay patterns—steep drops early signal immediate churn.
Segment Retention by User Attributes
Raw retention tells you if users come back. Segmented retention tells you which cohorts are sticky and which are leaky.
Compare Retention Across Plan Tiers
In the Retention report, add a segment by selecting breakdown and choosing the property you want (e.g., plan). This splits the retention table into rows for each plan tier, showing you if pro users have higher week-2 retention than free users.
// Ensure plan property is tracked consistently with every event
mixpanel.track('login', {
'plan': userPlan,
'plan_value': planPrice,
'region': userRegion
});
// Then segment the retention report by this property in the UI
// or via API by adding &on=properties["plan"] to the queryExport and Compare Cohorts
Download the retention table as CSV from the report. Compare week-2 retention across plan tiers, signup sources, or regions. If free users have 30% week-2 retention but pro users have 70%, that's actionable—focus on free-to-paid conversion or early engagement for free users.
Common Pitfalls
- Tracking the wrong event as your retention metric. Using 'any_event' or 'page_view' instead of a meaningful action like 'core_feature_used' or 'purchase'. This inflates retention and masks real churn.
- Inconsistent event naming across platforms. If web sends 'login' but mobile sends 'user_login', Mixpanel splits them into separate events and your retention numbers don't add up.
- Forgetting to identify users before tracking events. Without
mixpanel.identify(userId), Mixpanel can't cohort users across sessions and you'll see inflated retention—each anonymous session looks like a new user. - Looking at retention too early. Week-1 retention can look random; wait until week 2–4 to spot real trends. Also be aware that events fired at signup inflate day-0 retention artificially.
Wrapping Up
Tracking retention in Mixpanel is straightforward: pick an event that signals engagement, track it consistently, then use the Retention report to watch how many users come back. Segment by user properties to find which cohorts are sticking around and which are leaking. If you want to track retention automatically across multiple tools and get deeper cohort analysis, Product Analyst can help.