7 min read

How to Track Retention Analysis in Amplitude

If you're building a product, retention is everything. Amplitude's retention analysis shows you which cohorts of users stay engaged and which drop off. But retention charts are only as good as your event tracking—you need the right events captured with consistent user IDs to get meaningful results.

Setting Up Events for Retention Tracking

Retention analysis in Amplitude starts with proper event tracking. You need at least two events: a cohort entry point (like signup) and a retention event (like returning to use the product).

Initialize Amplitude and set user IDs

Start by initializing the Amplitude SDK with your API key and setting a user ID for each user. This is critical—without consistent user IDs, Amplitude can't track cohorts. Use setUserId() to assign a user identifier, and optionally call identify() to attach user properties like signup date or plan type.

javascript
import * as amplitude from '@amplitude/analytics-browser';

// Initialize with your API key
amplitude.init('YOUR_API_KEY', {
  defaultTracking: true,
  trackingOptions: {
    sessions: true
  }
});

// Set user ID after signup or login
amplitude.setUserId('user_12345');

// Optionally add user properties for segmentation
amplitude.identify(
  new amplitude.Identify()
    .set('plan', 'free')
    .set('signup_date', new Date().toISOString())
);

amplitude.track('Signup');
Initialize Amplitude and track a signup event with user context

Track the cohort entry event

The cohort entry point defines which users belong to your retention cohort. Common entry events are Signup, First Login, or Onboarding Completed. Track this event with properties that describe the cohort (source, plan, segment) so you can filter on them later in Amplitude.

javascript
// Track signup with properties to segment cohorts later
amplitude.track('Signup', {
  signup_source: 'landing_page',
  plan: 'free',
  referrer: 'google'
});

// Or track onboarding completion
amplitude.track('Onboarding Completed', {
  onboarding_path: 'quick_setup',
  estimated_company_size: '5-10'
});
Track the event that defines your cohort entry point

Track retention events throughout the user journey

Retention events are actions that show a user is returning and engaged. Track events like App Opened, Feature Used, Project Created, or Dashboard Viewed. These should represent meaningful engagement, not noise. Amplitude will use these to calculate retention—how many cohort members performed the event on day 1, day 7, day 30, etc.

javascript
// Track a user returning to the app
amplitude.track('App Opened', {
  app_version: '1.2.0',
  source: 'mobile'
});

// Track a specific feature use
amplitude.track('Dashboard Viewed', {
  dashboard_type: 'analytics',
  time_spent_seconds: 45
});

// Track a high-value action
amplitude.track('Analysis Created', {
  analysis_type: 'retention',
  complexity: 'advanced'
});
Track return events that indicate user engagement
Watch out: User ID changes. If a user signs up as a guest and later logs in with a different user ID, Amplitude treats them as two different users. Use setUserId() consistently and consider aliasing old user IDs to new ones after a user confirms identity.

Building a Retention Cohort in Amplitude

Once your events are flowing, you can create a retention chart to see how your cohorts persist over time. Amplitude's retention analysis groups users by their entry event and tracks whether they performed a retention event in subsequent periods.

Navigate to the Retention chart builder

In the Amplitude app, go to the Analytics tab and select Retention from the chart type menu. This opens the retention analysis builder where you'll define your cohort entry event and retention event.

javascript
// Note: Retention is configured in the Amplitude UI, but you can query via API
// Example: POST to Amplitude's Analytics API for programmatic retention queries

const retentionQuery = {
  "group_by": "day",
  "group_by_range": 7,
  "metrics": [{
    "type": "retention",
    "group_by": "eventtype",
    "scope": "cohort_event"
  }]
};

// This would be sent to the Amplitude REST API
// fetch('https://api2.amplitude.com/api/2/events', { method: 'POST', ... })
Retention is primarily configured in the UI but can be queried via API

Select your cohort entry event and period

Under Initial Event, select the event that defines your cohort. For example, choose Signup to track users from their first signup. You'll also select the retention period (daily, weekly, or monthly). Daily retention is most granular; weekly/monthly are better for longer-term trends.

javascript
// Segment retention by properties set during signup
// In the Amplitude UI: Initial Event = Signup, filter by plan = 'free'
// This compares retention across user segments

// Ensure properties are tracked during the initial event:
amplitude.track('Signup', {
  signup_source: 'organic',
  plan: 'free',
  country: 'US',
  company_size: 'small'
});

// Later, compare free vs. paid retention in the Amplitude UI
// by filtering the cohort on the 'plan' property
Segment your cohort by properties to compare retention across groups

Define the retention event and analyze

Under Returning Event, select the action that indicates a user is retained. This could be App Opened (showing they're active) or a domain-specific event like Analysis Created (showing they're using your core feature). Amplitude will calculate the percentage of your cohort that performed this event on day 1, day 7, day 30, etc.

javascript
// Track returning events with rich properties for deeper analysis
amplitude.track('App Opened', {
  is_returning_user: true,
  days_since_signup: 7,
  platform: 'web'
});

// Use user properties to track subscription status over time
amplitude.identify(
  new amplitude.Identify()
    .set('subscription_status', 'active')
    .set('last_action_date', new Date().toISOString())
    .set('total_events_created', 5)
);
Ensure returning events are well-instrumented for reliable cohort analysis
Tip: Use N-day retention to measure whether users return after a specific gap. For example, 7-day retention on day 30 tells you how many users from your cohort were active on day 30 onwards (not necessarily continuous). This is more realistic than strict day-to-day retention.

Interpreting Retention Results and Acting on Insights

Amplitude's retention table shows you the percentage of users in each cohort who returned on specific days or weeks. Understanding the table layout and what the numbers mean is key to acting on retention data.

Read the retention table structure

The retention chart displays cohorts in rows (grouped by entry date) and columns for each retention period. Each cell shows the percentage of users who performed the retention event. A cell value of 100% means 100% of that cohort performed the event on that day; 50% means half of them did. The first column (Day 0) typically shows 100% since everyone in the cohort performed the entry event.

javascript
// Example: Typical retention percentages for a new user cohort
const retentionExample = {
  cohort_date: '2025-03-01',
  day_0: 100,    // 100% performed entry event
  day_1: 45,     // 45% returned on day 1
  day_7: 28,     // 28% returned on day 7
  day_30: 12     // 12% returned on day 30
};

// Log retention curve
console.log(`Cohort: ${retentionExample.cohort_date}`);
console.log(`Day 1 retention: ${retentionExample.day_1}%`);
console.log(`Day 7 retention: ${retentionExample.day_7}%`);
console.log(`Day 30 retention: ${retentionExample.day_30}%`);
Example retention percentages showing a typical SaaS drop-off curve

Compare cohorts to identify what drives retention

Run retention charts for different entry events or user segments to find patterns. For example, compare Signup > App Opened for free users vs. paid users, or compare Onboarding Completed users to Signup Only users. If one cohort has higher retention, investigate what's different—onboarding quality, feature access, or user segment.

javascript
// Break down onboarding into steps to identify drop-off points
amplitude.track('Onboarding Step Completed', {
  step_number: 1,
  step_name: 'account_setup'
});

amplitude.track('Onboarding Step Completed', {
  step_number: 2,
  step_name: 'connect_datasource'
});

amplitude.track('Onboarding Step Completed', {
  step_number: 3,
  step_name: 'create_first_analysis'
});

// Use these as separate entry events in Amplitude to identify which step best predicts retention
Create micro-events during onboarding to isolate where users disengage

Export data and take action

Use Amplitude's Export button to download retention data for sharing or further analysis. Look for inflection points—where retention drops sharply. If day 3 retention is 30% but day 4 is 15%, something happened around that time. Investigate the user journey, check for bugs, or analyze support tickets from users who churned.

javascript
// Track user frustration signals to correlate with retention drops
amplitude.track('User Interacted With Help', {
  help_topic: 'how_to_add_datasource',
  help_clicked_from: 'error_message'
});

amplitude.track('Error Occurred', {
  error_type: 'connection_failed',
  error_code: 503,
  user_plan: 'free'
});

// Export retention by plan and error frequency to find correlations
// In Amplitude, segment by these properties to see if error-prone cohorts have lower retention
Track errors and support interactions to diagnose retention drops
Watch out: Amplitude calculates retention on the cohort's local time zone. If your users span multiple time zones, the day boundaries may not align with their actual usage. Consider using UTC or running separate analyses per region for accuracy.

Common Pitfalls

  • Missing or inconsistent user IDs break retention analysis. If 30% of your signup events don't have a user ID attached, Amplitude can't track those users in later retention periods, and your retention curve will significantly underestimate true retention.
  • Choosing the wrong retention event. If you select 'Page View' as your retention event, you'll measure mere pageloads, not meaningful engagement. Use events that indicate real product use (feature activation, data creation, settings change).
  • Not filtering out bot traffic or test accounts. Internal team usage or bot signups inflate your cohorts and skew retention upward. Tag and exclude test data (e.g., is_test_account: true) or filter in the Amplitude UI.
  • Confusing N-day and strict-day retention. Strict day 7 means the user was active exactly on day 7. N-day retention on day 7 means they were active any time from day 7 onwards. Amplitude defaults to N-day; understand which you're viewing.

Wrapping Up

Retention analysis in Amplitude reveals who stays engaged with your product and who doesn't. By instrumenting your events carefully, building cohorts in Amplitude's retention builder, and interpreting the retention curve, you can pinpoint what drives long-term engagement. If you want to track retention automatically across your entire tool stack and get alerts when retention dips, Product Analyst can help.

Track these metrics automatically

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

Try Product Analyst — Free