This article explains how Cohorts work behind the scenes, what happens when users enter, remain, or exit a cohort. This should help you build a clear mental model of cohorts, so you can interpret results confidently in analysis, decision-making, and product workflows.
For more information on getting started with Cohorts and how the calculation for Cohorts works, check out these articles for additional details:
What a Cohort Is Under the Hood
A cohort is not a static list of users.
Under the hood, a cohort is defined as a set of conditions that Countly continuously evaluates against user data. These conditions determine which users currently belong to the cohort.
At any point in time, a user either:
- matches the cohort conditions, or
- does not match the cohort conditions.
As user behavior changes, cohort membership updates automatically.
Realtime Cohorts vs Non-Realtime Cohorts
Cohort membership is either updated in real time (enabled by default) or on a scheduled basis:
Realtime Cohorts is enabled by default. In any case that this is disabled, you can enable this under Management -> Settings -> Cohorts (can be modified only by global admins)
When real-time cohorts are enabled:
- On incoming data: Whenever a user sends new data (such as events and sessions), all relevant cohorts for that user are evaluated immediately. The user may enter or exit cohorts right away based on the new data.
- Without incoming data: If a user becomes inactive, a background job runs once per day to re-evaluate time-based cohorts and remove users who no longer qualify.
When real-time cohorts are disabled (old legacy version):
- Cohort membership is updated only by a scheduled background job, which runs once a day.
- Users will enter or exit cohorts during this scheduled evaluation, not at the moment data is received.
- Each calculation fully recalculates the cohort. As a result, this leads to more intensive database queries.
How Cohorts Are Evaluated
At a high level, cohort evaluation works as follows:
- Countly processes incoming user data (such as events and sessions).
- Cohort conditions are evaluated against that data (e.g., did user 1 perform Event A?).
- Users who match the conditions are included in the cohort.
- This evaluation repeats as new data arrives (real-time Cohorts)
Key Points:
-
Evaluation is Retroactive (Entry): When a cohort is created, Countly evaluates it against your entire historical dataset (e.g., "users who performed 'Purchase' in their entire lifetime").
If a user performed the required action, for example, six months ago, they will be included in the cohort the moment it is created. - Initial Generation: The cohort's user list is generated as soon as the cohort is created, based on the defined rules.
- Continuous Re-evaluation (real-time Cohorts): Membership is continuously re-evaluated as new data arrives or when the cohort definition changes.
- Entry/Exit: Users automatically enter a cohort when they meet the conditions and exit when they no longer qualify (for example, when a time window expires).
Entering a Cohort
A user enters a cohort when they meet its evaluation criteria, whether those actions occurred before or after the cohort was created.
Entry to a Cohort may happen when:
- a user performs a specific event,
- a user meets a property-based condition,
- or a time-based condition becomes true (for example, active within the last 7 days)
Key Points:
Reporting is NOT Retroactive: Cohort membership is determined using historical data, but analytics and reporting only track activity from the cohort creation date onward. Entry and exit timelines start on the cohort's creation date.
Staying in a Cohort
After entry, a user remains in a cohort as long as they continue to meet the conditions.
If a user's data or behavior changes and they no longer meet the rules, they are automatically removed (exited) from the cohort.
How and when this evaluation happens depends on your configured Cohorts settings (real-time or non-realtime):
Cohort membership is updated either in real time or on a scheduled basis, depending on your setup.
For details on how these modes differ, see Realtime Cohorts vs Non-Realtime Cohorts here.
You can also update the list of users who stay in or exit a cohort by manually recalculating the cohort, as shown below:
Exiting a Cohort
A user exits a cohort when they no longer meet its conditions during a re-evaluation.
This can happen when:
- a time window expires,
- a previously missing action is completed,
- or a new event disqualifies the user.
-
Exit Triggered by New Data (Realtime Cohorts): When a user sends new data (events, sessions), Countly immediately re-evaluates that user against active cohorts.
If the new data causes the user to no longer match a cohort rule, the user is removed.
Example: For a cohort defined as “Users who have NOT performed ‘Purchase’ in the last 7 days”, a user exits the cohort as soon as they make a purchase, because the condition is no longer satisfied.
-
Exit Triggered by Time-Based Conditions: Some cohorts rely on time windows (e.g., “Active in the last 7 days”). In these cases, a user may need to exit the cohort even if they stop sending data.
To handle this, Countly runs a background job once a day that re-evaluates users in cohorts with expiring or sliding-window rules. If the qualifying action falls outside the defined time range, the user is automatically removed.