Churn is the silent killer of growth—you can't fix what you can't measure. Amplitude's retention analysis helps you identify which users are leaving, when they leave, and what behavior precedes the drop-off. By tracking the right events and cohorts, you can spot churn patterns before they impact your metrics.
Define Your Churn Signal with Event Tracking
Start by deciding what counts as churn in your product. Is it a user who hasn't logged in for 7 days? 30 days? The JavaScript SDK makes it easy to log the events that matter.
Initialize the Amplitude SDK and track user logins
Set up the Amplitude JavaScript SDK in your app and track a login event every time a user authenticates. This becomes your baseline for measuring active users.
import * as amplitude from '@amplitude/analytics-browser';
// Initialize Amplitude
amplitude.init('YOUR_API_KEY', {
userId: user.id,
defaultTracking: {
sessions: true,
pageViews: true,
formInteractions: true
}
});
// Track login event
amplitude.track('login', {
loginMethod: 'email',
environment: 'web'
});Track key engagement events
Beyond login, log events that signal an active, engaged user—feature usage, subscription renewal, content creation. The more specific your engagement markers, the better your churn model.
// Track key engagement events
amplitude.track('feature_used', {
featureName: 'advanced_filters',
section: 'dashboard'
});
amplitude.track('report_created', {
reportType: 'custom_metrics',
duration: 120
});
amplitude.track('subscription_renewed', {
planTier: 'pro',
renewalValue: 99.99
});Create a Retention Cohort in Amplitude
Once your events are flowing into Amplitude, use the Retention chart to measure how many users return after their first session. Amplitude will automatically calculate churn as 100% minus retention.
Navigate to Insights and select Retention
In the Amplitude dashboard, click Analytics > Insights, then choose the Retention chart type. This shows you cohorts of users and how many come back over time.
// Use Amplitude API to fetch retention data programmatically
const cohortData = await fetch('https://api.amplitude.com/api/2/cohort/list', {
method: 'GET',
headers: {
'Authorization': `Bearer ${YOUR_API_KEY}`,
'Accept': 'application/json'
}
});
const cohorts = await cohortData.json();
console.log('Active cohorts:', cohorts.data);Define your returning behavior
In the Returning section of the Retention chart, select the event that defines an active user coming back. For most SaaS, this is any login event. For engagement-heavy products, pick a specific feature usage event like dashboard_viewed or feature_used.
// Log a specific event that will be your 'returning user' marker
amplitude.track('dashboard_viewed', {
dashboardType: 'overview',
widgets: ['metrics', 'trends'],
sessionDuration: 45
});
// In Amplitude UI, use this event as the 'Returning' behavior
// Users who trigger dashboard_viewed after day 1 are counted as retainedSet Alerts and Export Data for Action
Monitoring churn is only useful if you act on it. Use Amplitude's API and alerting features to trigger workflows in your support and product tools.
Enable anomaly detection on retention drops
In your retention chart, enable Anomaly Detection to flag unusual drops in cohort retention. Amplitude will notify you if retention dips below your historical baseline, signaling a potential product issue or churn surge.
// Use Amplitude REST API to check retention metrics
const retentionCheck = await fetch(
'https://api.amplitude.com/api/2/retention?cohort_definition_type=event&returning_window=day&event=dashboard_viewed',
{
method: 'GET',
headers: {
'Authorization': `Bearer ${YOUR_API_KEY}`
}
}
);
const retention = await retentionCheck.json();
if (retention.data[0].retention < 0.45) {
console.warn('Churn spike detected:', retention.data[0]);
// Trigger alert to your Slack or monitoring tool
}Create a churned-user cohort for re-engagement campaigns
In Cohorts, create a saved cohort of inactive users—those who haven't performed your key event in the last 30 days. Export this list or sync it to your CRM to trigger re-engagement messaging.
// Tag users for reactivation based on inactivity
amplitude.setUserProperties({
churn_risk_30d: true,
lastEngagementDate: lastLoginDate,
segmentForCampaign: 'reactivation'
});
// Track users entering the churn cohort
amplitude.track('user_churned', {
reason: 'no_login_30days',
lastActiveDate: lastLoginDate,
planTier: userPlan
});Common Pitfalls
- Measuring retention without controlling for seasonal patterns. January churn often differs from summer churn. Use Amplitude's Compare feature to look at year-over-year cohorts.
- Setting your returning behavior too high (e.g., requiring advanced feature usage) and missing churn in your free-tier users. Start broad, then refine as you understand your user segments.
- Confusing day 1 retention with day 7 retention. Day 1 includes new users, but day 7+ is where real product stickiness emerges. Focus your analysis on D7 and beyond.
- Ignoring power-user churn. A 5% overall retention drop might hide the fact that your top 10% of users are churning at 30%. Always segment by usage level.
Wrapping Up
You now have a clear path to monitor churn in Amplitude: track engagement events, build retention cohorts, and set up alerts. By watching your D7, D30, and D90 retention curves, you'll catch churn before it becomes a growth crisis. If you want to track this automatically across tools, Product Analyst can help.