Sub topic 8
Defining cohorts: behavior, properties, dynamic and static
A cohort is a group of users who share a defined trait or action. Funnels, retention tables, and other reports use cohorts as filters and as comparison groups. This chapter covers how to define one, which type to choose, and where cohort definitions go wrong.
Prerequisites
This chapter assumes you know three things:
- Events and event properties are the raw data behind reports.
- A user is counted by an identity, such as a user ID or a device ID.
- You can read a basic funnel with steps and a conversion rate.
You do not need SQL to follow the main text. The SQL example near the end is optional.
What a cohort is and why you define one
A cohort is a saved set of users, defined by a rule. The rule answers one question: who belongs in this group?
You define cohorts because raw user counts hide differences. "Overall conversion is 18%" tells you little. "Users who invited a teammate in week one convert at 41%, and users who did not convert at 9%" tells you where to look.
Every cohort definition has two parts:
- A condition: what a user must have done, or what they must be.
- A time frame: when the condition has to be true.
Most confusing cohort numbers come from a vague time frame, so state it explicitly.
Behavioral cohorts
A behavioral cohort groups users by what they did. The condition is built from events, and often from event properties.
Examples:
- Users who performed
Sign Up Completedat least once in the last 30 days. - Users who performed
Report Exportedat least 3 times in the last 14 days. - Users who performed
Project Createdbut never performedTeammate Invited.
Behavioral conditions have three parts you need to set deliberately.
Frequency
"Did the event" and "did the event at least N times" are different cohorts. A single occurrence is often an accident or a test. Three or more occurrences usually signals real use. Pick a threshold that reflects your product's normal rhythm.
Negation
"Did not do X" is useful but easy to get wrong. A user who signed up yesterday has not done X yet. If you define "never invited a teammate" over a long window, new users flood the cohort. Combine negation with a minimum age, for example "signed up more than 14 days ago and has not invited a teammate".
Sequence
Some tools let you require events in order, such as Project Created followed by Report Exported. A sequence cohort is stricter than "did both". Use it when the order matters to your question.
Property-based cohorts
A property-based cohort groups users by what they are, using user properties. Examples include plan type, country, platform, acquisition channel, and company size.
import * as amplitude from '@amplitude/analytics-browser';
amplitude.init('YOUR_AMPLITUDE_API_KEY');
amplitude.setUserId('user_123');
const identify = new amplitude.Identify();
identify.set('plan', 'pro');
identify.set('country', 'DE');
amplitude.identify(identify);
amplitude.track('Sign Up Completed', { plan: 'pro', source: 'pricing_page' });This code sets two user properties (plan and country) and sends one event that carries plan as an event property. The two kinds of property behave differently in cohorts.
| Property kind | Where it lives | What a cohort sees |
|---|---|---|
| User property | On the user profile | The user's current value, usually the latest one sent |
| Event property | On one event | The value at the time of that event |
Suppose a user starts on plan = free and upgrades to pro next month. A cohort defined by the user property plan = free drops that user once the profile updates. A cohort defined as "performed any event where the event property plan = free" keeps the user, because that old event still carries free.
Choose the kind of property that matches your question. "Who is on the free plan now?" calls for the user property. "Who used the product while on the free plan?" calls for the event property.
Dynamic and static cohorts
This choice decides whether membership changes over time.
A dynamic cohort recalculates. The rule is re-evaluated on a schedule or at query time, so users enter and leave as their behavior and properties change. "Performed Report Exported in the last 14 days" is dynamic. A user who stops exporting leaves after 14 days.
A static cohort is a snapshot. The tool evaluates the rule once, stores the list of users, and never updates it. Everyone in the list stays in the list.
| Question | Dynamic | Static |
|---|---|---|
| Does membership change? | Yes, as the rule is re-evaluated | No, fixed at creation |
| Best for | Ongoing monitoring, such as "active power users" | One-time analysis, such as "users in the March launch" |
| Risk | Numbers shift between viewings | Becomes stale, and ignores new users |
| Good for experiments? | Poor, since groups drift | Good, since the group is frozen |
Use a static cohort when you need to follow the same people over time. If you want to know whether users who joined during a launch week still return three months later, the group must not change. A dynamic version would lose members who stopped being active, and you would end up measuring survivors.
Use a dynamic cohort when you want the current state of a segment. A dashboard tile that shows conversion for "users active in the last 30 days" should always reflect the last 30 days.
Defining cohorts with time frames
The time frame changes who qualifies. Compare these definitions of "active user":
- Did any event in the last 7 days.
- Did any event in the last 30 days.
- Did the event in each of the last 4 weeks.
The first is generous and includes casual visitors. The third is strict and describes habitual users. All three are valid. They answer different questions, so name the cohort after its rule: "Active 7d", not "Active users".
A relative window ("last 30 days") is common for dynamic cohorts. A fixed date range ("between 1 and 7 March") is common for static ones.
How a cohort is computed
It helps to see what a cohort definition does underneath. This query builds the user list for "completed sign up at least once in the last 30 days and is on the pro plan", as it would look in a Postgres-style warehouse.
SELECT e.user_id
FROM events e
WHERE e.event_name = 'Sign Up Completed'
AND e.event_time >= NOW() - INTERVAL '30 days'
AND e.event_properties ->> 'plan' = 'pro'
GROUP BY e.user_id
HAVING COUNT(*) >= 1;The tool runs something like this and stores or re-evaluates the resulting user IDs. A dynamic cohort repeats the query. A static cohort runs it once and saves the output. The HAVING clause is the frequency threshold, and the WHERE clause holds the event, property, and time frame conditions.
Defining cohorts in Amplitude and Mixpanel
Both tools support behavioral and property-based cohorts, and both let you combine conditions with AND and OR. The vocabulary differs slightly.
Identity matters here. A cohort is a set of users, so the tool must know which events belong to which person. Calling identify or setUserId before tracking ties events to one user. Without that, the same person on two devices becomes two members.
import mixpanel from 'mixpanel-browser';
mixpanel.init('YOUR_PROJECT_TOKEN');
mixpanel.identify('user_123');
mixpanel.people.set({ plan: 'pro', country: 'DE' });
mixpanel.track('Sign Up Completed', { plan: 'pro', source: 'pricing_page' });In Mixpanel, people.set writes profile properties, which cohorts can filter on. Later chapters compare the two tools in detail. For now, remember that in both tools the cohort builder reads the events and profile data you have already sent. A cohort cannot use a property you never tracked.
Common errors
- Vague time frames. "Users who exported a report" with no window includes someone who exported once two years ago. Always set a window.
- Using a dynamic cohort for a before-and-after comparison. Membership shifts, so the "before" and "after" groups differ in composition. Freeze the group with a static cohort.
- Survivorship bias. A cohort defined by sustained activity ("active every week for 8 weeks") will retain better than any group not filtered that way. This is circular. You defined the group by the outcome you are measuring.
- Negation without a minimum age. New users look like they have "never done" everything.
- Confusing user and event properties. See the table above. The wrong choice moves users between groups.
- Overlapping cohorts treated as separate. A user can sit in several cohorts at once. Adding the sizes of two cohorts double-counts shared users.
- Stale static cohorts. A static cohort created last quarter does not include anyone who joined since.
Putting it together
Here is a worked scenario. You suspect that users who create a project in their first session are more likely to finish sign-up setup.
- Define a behavioral cohort: performed
Project Createdwithin 24 hours of the firstSign Up Completed. - Define the comparison cohort: completed sign-up but did not create a project in that period, and signed up at least 7 days ago so they had a fair chance.
- Make both static if you plan to track them for weeks. Make them dynamic only if you want a live dashboard.
- Use both as comparison groups in a funnel or retention report.
Notice the two cohorts have the same entry condition and differ in one behavior. Fair comparisons come from groups that differ in one thing.
Remember that this shows correlation. Users who create projects early may simply be more motivated. The cohort comparison tells you where to look, and an experiment tells you whether the behavior causes the difference.
Exercise
Your team launched a new onboarding flow on 1 March. You want to know whether users who signed up that week are still active 90 days later. Should the cohort be dynamic or static, and why? Name one other setting you must define in the rule.
Show answer
Use a static cohort. The question is about the same people over time, and a dynamic cohort would drop members who stopped being active, which leaves only survivors and overstates retention. You must also define a time frame, such as "completed Sign Up between 1 and 7 March". A fixed date range is the right kind of window for a static cohort.
Exercise
A user was on the free plan in January and upgraded to pro in February. You build a cohort of "users with user property plan = free" and another of "users who performed any event with event property plan = free". Which cohort contains this user today, and why?
Show answer
Only the second cohort. The user property now reads pro, so the first cohort no longer includes the user. The January events still carry plan = free as an event property, so the second cohort keeps the user.