6 min read

How to Set Up Behavioral Cohorts in Amplitude

You're running A/B tests or analyzing retention, but you're working with everyone instead of the users who actually matter. Behavioral cohorts in Amplitude let you define user groups based on what they actually do — not just demographics. Once set up, you can analyze them separately, target them for experiments, or sync them to your other tools.

Understanding Behavioral Cohorts in Amplitude

A behavioral cohort is a group of users defined by their actions and properties, not static traits. In Amplitude, cohorts combine event patterns, user properties, and temporal conditions to identify your most important user segments.

Step 1: Identify the Behavior That Matters

Start by deciding what behavior defines your cohort. Ask: Are these users who completed a specific action? Who have a property set to a certain value? Who match a sequence of events? In Amplitude, cohorts work with events you're already tracking via the track method, so the events need to exist in your data.

javascript
// Track the behaviors that will define your cohort
amplitude.track('Feature_Viewed', {
  feature_name: 'advanced_reporting',
  timestamp: Date.now()
});

amplitude.track('Export_Initiated', {
  export_type: 'csv',
  data_range: '30d'
});
These events become the foundation for your cohort rules

Step 2: Navigate to Cohorts in Amplitude

In the Amplitude dashboard, go to Analytics > Cohorts. Click Create Cohort. You'll see options to build a rule-based cohort using events, user properties, or a combination. Amplitude uses an AND/OR logic system — you can chain conditions together.

javascript
// Your event tracking should capture the properties needed for cohort rules
amplitude.track('Subscription_Started', {
  plan_type: 'enterprise',
  annual: true,
  company_size: '1000+'
});
Make sure you're tracking the properties that will filter your cohort
Watch out: Cohorts in Amplitude are retroactive — they apply to historical data matching your rule. If you create a cohort for "users who used Feature X," it includes everyone who ever did that, not just new users.

Define Cohort Rules in the Amplitude Dashboard

Building a cohort rule means specifying conditions: events happened, properties match values, or sequences occurred. The Amplitude UI guides you through this with a visual builder.

Step 1: Add Event-Based Conditions

Click Add Group and select Event. Choose the event name (e.g., Feature_Viewed), then set conditions on its properties (e.g., feature_name equals "advanced_reporting"). You can require the event to have happened within a time window (last 30 days, last 6 months, all time). Use Match ANY event in the group if multiple event types qualify, or Match ALL events if you need a specific sequence.

javascript
// Example: Events you'd use to define a cohort
// Users who viewed advanced reporting within the last 30 days
amplitude.track('Feature_Viewed', {
  feature_name: 'advanced_reporting'
});

// AND have triggered an export in that same window
amplitude.track('Export_Completed', {
  export_type: 'csv'
});
Amplitude will match users where both events occurred in your time window

Step 2: Add Property-Based Conditions

Click Add Group and select Property. Choose a user property (e.g., plan_type) and set a condition (equals, contains, greater than, etc.). This filters by static or derived user attributes. Combine multiple property conditions with AND/OR logic — for example, (plan_type = "enterprise" OR plan_type = "team") AND active_subscription = true.

javascript
// Set user properties that will be used in cohort filters
amplitude.setUserProperties({
  plan_type: 'enterprise',
  active_subscription: true,
  company_size: '1000+',
  onboarding_completed: true
});
These properties can be set at signup or updated as users progress

Step 3: Save and Name Your Cohort

Give your cohort a descriptive name (e.g., Enterprise Users with Advanced Reporting Access). Amplitude will calculate the cohort size — you'll see how many users match your rule. Click Save Cohort and it's ready to use in charts, segments, and downstream tools.

javascript
// Once your cohort is created, you can use it in Amplitude's API
// to query cohort metadata and configuration
fetch('https://api.amplitude.com/2/cohorts', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY'
  }
}).then(res => res.json())
  .then(data => console.log('Cohorts:', data));
Use the Amplitude API to programmatically access your cohort definitions
Tip: Use the Preview button before saving — it shows you the matching user count and lets you test your rule logic. A cohort that matches 0 users is usually a sign that either your events haven't fired yet or your conditions are too strict.

Use Cohorts in Analysis and Downstream Tools

Once your cohort is saved, you can segment your analysis by it, target it in experiments, or sync it to downstream tools like your email platform or data warehouse.

Step 1: Segment Charts and Reports by Cohort

In any Amplitude chart (funnel, retention, user sessions), click Segment and add your cohort as a dimension. You'll instantly see how that user group behaves differently — retention rates, conversion funnels, feature adoption, whatever metric you're measuring. This is where cohorts prove their value: comparing behavior across groups.

javascript
// Set user identity so Amplitude can match this user to cohorts
amplitude.setUserId('[email protected]');
amplitude.setDeviceId('device-id-123');

// Track events — Amplitude automatically matches the user to cohorts
// based on their properties and historical behavior
amplitude.track('Page_Viewed', {
  page: '/dashboard'
});
Amplitude uses your user ID and properties to match against cohort rules automatically

Step 2: Export or Sync Cohorts to External Tools

Amplitude lets you export cohorts via API or sync them to destinations like Segment, Salesforce, HubSpot, or S3. In the cohort details, click Sync and choose your destination. This lets you activate the cohort — for example, send a targeted email to Enterprise users, or load them into your data warehouse for custom analysis.

javascript
// Query cohort metadata via the Amplitude API
// Useful for building custom workflows or exports

fetch('https://api.amplitude.com/2/cohorts/{cohort_id}', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY'
  }
}).then(res => res.json())
  .then(cohort => {
    console.log('Cohort name:', cohort.name);
    console.log('User count:', cohort.size);
  });
Use the API to retrieve cohort metadata for automation or custom exports
Tip: Cohorts are dynamic — users enter and exit them as their behavior changes. A user added to "Active Users" cohort (event in last 30 days) will drop out after 30 days of inactivity. Keep this in mind when syncing to external tools.

Common Pitfalls

  • Creating cohorts on events you haven't implemented yet. Always verify your events are firing in Amplitude before building cohorts on them — use the Events > Live Events view to double-check.
  • Setting cohort time windows too narrow. If you require an event in the last 7 days but users only do that action monthly, your cohort will be nearly empty. Test your rule logic with Preview before saving.
  • Forgetting that cohort membership is dynamic. Syncing a cohort to an external tool captures a snapshot, but Amplitude's cohort evolves as user behavior changes. Set up periodic re-syncs or use Amplitude's integrations instead of one-time exports.
  • Using cohorts without checking the match count. A cohort matching zero or five users might indicate your rule is correct but your behavior is rare, or it could mean your conditions are impossible. Always validate cohort size before relying on it for analysis.

Wrapping Up

Behavioral cohorts transform how you analyze your product. Instead of looking at everyone, you focus on the users who exhibit the behaviors that matter to your business — high-value customers, engaged beta testers, churn-risk users, whatever you define. Once set up, segment all your Amplitude reports by them, run experiments on them, or sync them to tools downstream. If you want to track behavioral cohorts automatically across Amplitude and your other tools without manual setup each time, Product Analyst can help.

Track these metrics automatically

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

Try Product Analyst — Free