Most product teams segment users by demographics or basic attributes. But what actually matters is what users do. Behavioral Cohorts in Amplitude let you group users by their actions—like users who viewed pricing twice in a week or abandoned checkout after adding items. You can then analyze, target, and understand these groups without writing SQL.
What Are Behavioral Cohorts?
Behavioral Cohorts are groups of users defined by specific actions or event sequences they take in your product.
Understand the core concept
A Behavioral Cohort captures users who match a pattern—did X event, did X and then Y, or didn't do X in the last 30 days. Unlike static user properties ("plan = pro"), behavioral cohorts are dynamic. They update automatically as users take new actions. In Amplitude, you define these patterns in the Cohorts tab using the cohort builder.
// Behavioral Cohorts are audience definitions, not direct SDK calls
// But here's how you'd log the events that populate them:
amplitude.logEvent('Viewed Pricing', {
timestamp: Date.now()
});
amplitude.logEvent('Added to Cart', {
product_id: 'sku_123',
price: 99.99
});
amplitude.logEvent('Checkout Abandoned', {
cart_value: 299.97,
items_count: 3
});Know when to use them
Use Behavioral Cohorts when you need to understand user behavior patterns at scale. They're especially useful for identifying high-risk users (churners, disengaged), high-value users (power users, frequent buyers), or users in a specific stage (onboarding stage, trial ending soon). They're not the right tool for one-off analysis—those are better handled with Amplitude's segmentation in Event Segmentation or Retention.
// Identify high-engagement users with custom properties
amplitude.logEvent('Feature Used', {
feature: 'advanced_reporting',
engagement_level: 'high'
});
// Set user properties that help define cohort eligibility
amplitude.identify(
new amplitude.Identify()
.set('power_user_flag', true)
.set('features_used', 15)
);Creating a Behavioral Cohort
Behavioral Cohorts are built through Amplitude's UI, not through code. But understanding the shape of your events is key.
Set up events that describe behavior
Before creating a cohort, make sure you're logging the events that define it. Use the Event Debugger in Amplitude to verify events are firing with the right properties. For example, if you want a cohort of "users who completed onboarding," you need an Onboarding Completed event with clear metadata.
// Clear, semantic event naming with descriptive properties
amplitude.logEvent('Onboarding Completed', {
time_to_complete_seconds: 480,
step_skipped: false,
total_steps: 5
});
amplitude.logEvent('Premium Feature Accessed', {
feature_name: 'custom_dashboards',
is_first_time: true,
access_method: 'direct_link'
});Create the cohort in the UI
Navigate to Cohorts in Amplitude's left sidebar. Click Create Cohort. Select whether you want to match users based on event occurrence ("users who did X") or event sequences ("users who did X then Y"). Add your conditions, for example: Onboarding Completed event happened in the last 7 days. Name it something actionable like "Recently Completed Onboarding" and save.
// Query cohort membership via REST API
const cohortId = 'cohort_12345'; // From Amplitude UI
const AMPLITUDE_API_KEY = process.env.AMPLITUDE_API_KEY;
fetch(`https://amplitude.com/api/3/cohorts/${cohortId}/members`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${AMPLITUDE_API_KEY}`,
'Accept': 'application/json'
}
})
.then(res => res.json())
.then(data => console.log('Cohort members:', data.members));Refine with sequences or time windows
Behavioral Cohorts support sequence matching (X happened, then Y happened within N days). You can also set time windows—e.g., "users who logged in more than 5 times in the last 30 days." Use the Timeframe toggle in the cohort builder to set how far back to look. Hit Save once conditions are finalized.
// Example: Log events that form a sequence
// These events power an "abandoned cart then returned" cohort
amplitude.logEvent('Cart Abandoned', {
cart_id: 'cart_456',
value: 150,
items_count: 2
});
// Days later, in a new session...
amplitude.logEvent('Session Started', {
session_source: 'email_campaign',
days_since_last_action: 3
});
// In Amplitude UI: create cohort with condition
// "Cart Abandoned" THEN "Session Started" within 7 daysUsing Behavioral Cohorts
Once created, cohorts are available across Amplitude's analysis tools and via REST API.
Segment analysis by cohort
In Event Segmentation, Retention, or User Composition charts, click Segmented By and select your Behavioral Cohort. Amplitude will show metrics broken down by cohort membership. For example, segment retention by "Recently Completed Onboarding" to see if that group has higher 30-day retention than others.
// Pull event data filtered by cohort via REST API
const cohortId = 'cohort_12345';
const AMPLITUDE_API_KEY = process.env.AMPLITUDE_API_KEY;
fetch('https://amplitude.com/api/2/events', {
method: 'POST',
headers: {
'Authorization': `Bearer ${AMPLITUDE_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
event: 'Purchase',
cohort_id: cohortId,
start: '2025-01-01',
end: '2025-03-31'
})
})
.then(res => res.json())
.then(data => console.log('Cohort event data:', data));Export cohorts for external use
Cohorts can be exported to CSV for one-off analysis or synced to external platforms (Segment, Slack, email tools). Click the cohort, select Export or Integrate, and choose your destination. This lets you act on cohorts outside Amplitude—e.g., send a re-engagement email to the "Churned Users" cohort or flag them in your data warehouse.
// If synced via Segment, use cohort data in your app
analytics.identify(userId, {
cohort_membership: 'churned_users',
cohort_updated_at: new Date().toISOString(),
in_power_user_cohort: true
});
// Gate features based on cohort membership
if (userProfile.in_power_user_cohort) {
enableAdvancedFeatures();
} else if (userProfile.cohort_membership === 'trial_users') {
showTrialBanner();
}Common Pitfalls
- Creating too many conditions in a single cohort makes it slow to compute and hard to debug. Start simple—one event, one condition—then layer in complexity if needed.
- Forgetting that Behavioral Cohorts update on a schedule, not in real-time. Don't rely on them for immediate user targeting—use event properties in alerts or your backend API instead.
- Using cohorts for one-time analysis instead of building a reusable segment. Cohorts are meant to be audience definitions you reference repeatedly. For single questions, use Event Segmentation directly.
- Not logging the events that define your cohort, or logging them inconsistently. If event names or properties change mid-stream, your cohort becomes unreliable or empty.
Wrapping Up
Behavioral Cohorts turn your event data into actionable audience segments. They let you identify users by their actions—not just attributes—and analyze or act on those groups across your stack. If you want to track behavioral patterns and cohorts automatically across all your analytics tools, Product Analyst can help.