Churn is silent in Amplitude unless you explicitly track it. Most teams know their DAU but miss the users who stopped showing up. We'll show you how to identify churned users, measure the rate, and set up alerts when it spikes.
Track User Activity as Events
Before you can measure churn, you need a baseline of what 'active' means. Start by instrumenting your key engagement events.
Send activity events with the Amplitude SDK
Instrument your most important user actions—login, page view, feature use, whatever signals engagement in your product. Each event gets a timestamp in Amplitude. Use track() to send events and ensure the user ID is consistent.
import * as amplitude from '@amplitude/analytics-browser';
// Initialize Amplitude
amplitude.init('YOUR_API_KEY');
// Track a sign-in event
amplitude.track('User Sign In', {
platform: 'web',
timestamp: new Date().getTime()
});
// Track a feature use event
amplitude.track('Feature Used', {
feature_name: 'dashboard_view',
user_segment: 'premium'
});Set a 'Last Activity' user property
Add a user property to store the last time someone engaged. Update it on key events. In Amplitude, this property becomes queryable and helps you identify gaps in activity.
// Update last activity timestamp on important events
amplitude.setUserProperties({
last_activity_at: new Date().getTime(),
last_activity_type: 'feature_use'
});
// Or with identify() when the user logs in
const identify = new amplitude.Identify()
.set('last_active_date', new Date().toISOString())
.set('is_active', true);
amplitude.identify(userId, identify);Create a Churned User Segment
Once activity is tracked, define churn in Amplitude. A 30-day inactive threshold is standard—adjust to your product's usage pattern.
Build a segment for inactive users
Go to Cohorts (or Segments depending on your plan) and create a new segment. Filter for users who have NOT performed an event in the last 30 days. Amplitude will calculate membership in real time and update as new activity arrives.
// Example: Query Amplitude API to get inactive user count
const thirtyDaysAgo = Date.now() - 30 * 24 * 60 * 60 * 1000;
const query = {
filter: [
{
property_type: 'user',
operator: 'last event before',
value: thirtyDaysAgo
}
]
};
// Fetch cohort members via Amplitude API
fetch('https://analytics.amplitude.com/api/2/cohort/members', {
method: 'POST',
headers: {
'Authorization': `Bearer ${AMPLITUDE_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(query)
}).then(res => res.json()).then(data => {
console.log('Churned users:', data.results.length);
});Send a churn event when the condition is met
When a user crosses your inactivity threshold, send a User Churned event server-side via Amplitude's Batch Event API. This gives you an event to pivot on and makes churn visible in your dashboards and funnels.
// Server-side: Detect and track churn (e.g., from a daily cron job)
const amplitudeApiKey = process.env.AMPLITUDE_API_KEY;
const userId = 'user_12345';
const now = new Date();
// Send churn event via Batch API
const event = {
user_id: userId,
event_type: 'User Churned',
time: now.getTime(),
event_properties: {
days_inactive: 30,
churn_date: now.toISOString(),
account_plan: 'pro'
}
};
fetch('https://api2.amplitude.com/2/httpapi', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
api_key: amplitudeApiKey,
events: [event]
})
}).then(r => r.json()).then(d => {
console.log('Churn tracked:', d.code);
});Measure and Monitor Churn Rate
Now calculate churn as a percentage and track it over time. Use Amplitude's Retention chart or query data directly.
Use Amplitude's Retention analysis
Open Retention and select your core engagement event (login, feature use, etc.). Define your cohort start date (e.g., 30 days ago) and Amplitude will show the percentage of users who never returned. That's your churn rate.
// Calculate churn rate manually from exported data
const totalUsersLastMonth = 10000; // Users active 30+ days ago
const activeUsersNow = 9200; // Users active in last 30 days
const churnedUsers = totalUsersLastMonth - activeUsersNow;
const churnRate = (churnedUsers / totalUsersLastMonth) * 100;
console.log(`Churn Rate: ${churnRate.toFixed(2)}%`); // 8.00%
// Track churn rate as a metric event for dashboarding
amplitude.track('Churn Metric Calculated', {
churn_rate_percent: parseFloat(churnRate.toFixed(2)),
period_days: 30,
total_baseline: totalUsersLastMonth,
churned_count: churnedUsers,
retention_rate: 100 - churnRate
});Segment churn by plan and cohort
Churn is rarely uniform. Slice by user property to compare free vs. paid, cohort (signups by month), or region. In Amplitude, add a breakdown in any chart to see churn by segment.
// Compare churn by plan when tracking the churn event
amplitude.track('User Churned', {
plan: 'pro', // free, starter, pro
signup_cohort: '2025-Q1',
region: 'us-west',
mrr_at_churn: 99.00,
days_as_customer: 180
});
// In Amplitude UI: Use "group by" on plan to compare churn across segments
// free plan churn: 12%
// starter plan churn: 8%
// pro plan churn: 4%Common Pitfalls
- Not defining 'active' clearly upfront. Is one event enough, or does the user need to hit a specific feature? Amplitude defaults to any event. Document your definition so churn is consistent month-to-month.
- Timezone misalignment. Amplitude reports in UTC. If your business logic runs in a different timezone and you're comparing 'last 30 days,' timestamps can drift by a full day.
- Churned users returning. Once someone is marked churned, they might come back. Decide in advance: are they churned until active again, or is churn a one-time label? Update your segment logic accordingly.
- API rate limits on large queries. Querying cohort membership for 100k+ inactive users can hit Amplitude's rate limits. Use batch exports or limit your API calls to weekly, not daily.
Wrapping Up
You now have a way to identify churned users, measure churn rate, and break it down by segment in Amplitude. The key is defining 'active' upfront and then querying consistently. If you want to track and act on churn automatically across Amplitude and other tools, Product Analyst can help.