6 min read

How to Track Churn Rate in Amplitude

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.

javascript
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'
});
Basic event tracking with Amplitude SDK. Each event records a timestamp automatically.

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.

javascript
// 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);
Storing last activity as a user property lets you query for inactive users later.
Tip: Use a consistent timestamp format (Unix milliseconds or ISO 8601). Amplitude stores event timestamps automatically; only add a user property if you need to query against it in Amplitude's UI or API.

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.

javascript
// 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);
});
Query the Amplitude API for users inactive beyond your threshold.

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.

javascript
// 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);
});
Send churn events server-side using Amplitude's Batch Event API.
Watch out: Amplitude's free tier limits API calls. If you query cohort membership daily for thousands of users, batch your API requests or use Amplitude's data export features to avoid rate limits.

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.

javascript
// 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
});
Calculate and track churn percentage as a metric.

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.

javascript
// 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%
Include segment properties so you can break down churn in Amplitude's charts.
Tip: Use Group Analytics in Amplitude to compare churn by company or account. If you have company-level goals, segment churn by plan, vertical, or sign-up source to identify where retention is weakest.

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.

Track these metrics automatically

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

Try Product Analyst — Free