5 min read

How to Track Churn Rate in Mixpanel

Churn is the silent killer of recurring revenue. If you're shipping features but losing customers, you need to see it happening in real time. Mixpanel's retention reports and cohort analysis let you measure exactly when and why users stop coming back.

Step 1: Track Engagement Events

Churn starts with inactivity. You need baseline engagement events that tell you whether a user is still active or gone dark.

Send engagement events from your app

Fire a tracking event whenever the user does something meaningful in your product. For a SaaS app, that might be Login, Dashboard Viewed, or Report Generated. Use the Mixpanel JavaScript SDK's track() method with a consistent event name and optional properties.

javascript
mixpanel.track('Dashboard Viewed', {
  'timestamp': new Date().toISOString(),
  'user_id': userId,
  'subscription_tier': 'pro',
  'feature_used': 'reports'
});
Track engagement events with user context

Set user properties for subscription status

Store the user's current status (active, trial, churned) as a people property. This lets you segment churn by subscription tier or plan type later. Use people.set() to store long-lived user attributes.

javascript
mixpanel.people.set({
  'subscription_status': 'active',
  'subscription_tier': 'pro',
  'signup_date': new Date().toISOString(),
  'monthly_spend': 99.00,
  'last_active': new Date().toISOString()
});
Set user properties to track subscription lifecycle
Watch out: Don't send too many event properties. Keep it focused—date, user segment, and action type. Bloat slows queries and confuses analysis later.

Step 2: Build Retention Cohorts

Churn is measured as retention decline. Mixpanel's Retention report groups users by signup date and tracks how many come back N days later.

Create a retention report in Mixpanel

Go to Reports > Retention. Set your initial event (e.g., Signup or First Login) and your return event (e.g., Dashboard Viewed). Mixpanel will show you what percentage of Day 0 users returned on Day 1, Day 7, Day 30, etc. This directly measures churn—if 70% return on Day 7, your 7-day churn is 30%.

javascript
// Ensure your events are named consistently
mixpanel.track('Signup', {
  'user_id': newUserId,
  'signup_source': 'web'
});

// Later, track returning engagement
mixpanel.track('Dashboard Viewed', {
  'user_id': userId
});
Events must be sent consistently for retention reports to work

Segment churn by user cohort

In the Retention report, add filters to compare churn across segments. For example, filter by Signup Source to see if organic users churn faster than paid users. Use the Segmentation dropdown to break down retention by any user property.

javascript
// Track signup source as a property
mixpanel.track('Signup', {
  'user_id': newUserId,
  'signup_source': 'google_ads',  // Track where they came from
  'plan_type': 'starter'
});

// This property becomes available for segmentation in Retention reports
Send properties at signup so you can segment cohorts later
Tip: 7-day and 30-day retention are the most actionable. If your 7-day churn is 50%, you're losing half your users in a week—that's your top priority to fix.

Step 3: Export Churn Data for Deeper Analysis

The Retention report shows the trend, but sometimes you need the raw data. Use Mixpanel's Data Export API to pull churn lists and integrate them into your data warehouse.

Export events via the Data Export API

Use Mixpanel's REST API to export event data in bulk. This is useful if you need to cross-reference churn events with billing data or CRM systems. Authenticate with your project token and specify a date range.

javascript
const projectToken = 'YOUR_PROJECT_TOKEN';
const startDate = '2024-01-01';
const endDate = '2024-01-31';

const url = `https://data.mixpanel.com/api/2.0/export?from_date=${startDate}&to_date=${endDate}&event=["Signup","Dashboard Viewed"]`;

fetch(url, {
  headers: {
    'Authorization': `Basic ${btoa(projectToken + ':')}`
  }
})
.then(res => res.json())
.then(data => console.log(data));

// Returns JSONL format (one JSON object per line)
Pull raw event data via the Data Export API

Identify churned users with user properties

Query your People data to find users whose last_active property is older than your churn threshold (e.g., 30 days). You can use Mixpanel's Segmentation report or export people data and process it in your data warehouse.

javascript
// Mark users as churned when they haven't been active in 30 days
const thirtyDaysAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000);

mixpanel.people.set({
  'last_active': new Date().toISOString(),
  'churn_status': 'at_risk'  // Set this property for segmentation
});

// Then segment by churn_status in reports to see at-risk users
Update user properties to track churn status
Tip: Export weekly, not daily. Mixpanel's API has rate limits, and churn patterns emerge over weeks, not hours.

Common Pitfalls

  • Not tracking engagement consistently. If you only track login but miss 'Feature Used' events, you'll underestimate activity and overestimate churn.
  • Confusing 'Day 0' in retention reports. Day 0 is the signup or activation day, not the next day. A 50% Day 1 churn means half your users never came back the next day.
  • Setting user properties after the fact. If you wait to set 'subscription_tier' after signup, you can't segment early cohorts. Set properties at the moment they're true.
  • Ignoring free trial churn separately. Paying users and trial users churn for different reasons. Create separate retention reports for each so you're not mixing signals.

Wrapping Up

You now have a churn tracking system in Mixpanel. Run the retention report weekly, segment by plan or source, and use the churned user lists to win them back. Churn doesn't fix itself—measure it, understand it, and act on it. If you want to track this automatically across tools, Product Analyst can help.

Track these metrics automatically

Product Analyst connects to your stack and surfaces the insights that matter.

Try Product Analyst — Free