Sub topic 2
Choosing what counts as active and the right time unit
This chapter assumes you know what a cohort is (a group of users who share a starting point, usually their first event or signup month). It also assumes you are comfortable with basic product metrics such as active users and churn. The Python examples use pandas, but the ideas apply equally to SQL.
Every retention number rests on two choices: what counts as "active", and how long a period lasts. Change either one and the same product can look healthy or broken. Make these choices deliberately, write them down, and keep them fixed when you compare cohorts.
Why the definition of active matters
Retention asks: of the users who started in a given period, how many came back? "Came back" has no built-in meaning. A user might open the app, log in, receive an email, or complete the core task. Each one gives a different answer.
Suppose 1,000 people sign up in January. In February:
- 600 have a session (they opened the app or site).
- 350 did something other than look around.
- 180 completed the action the product exists for.
All three groups are "retained" under some definition. The retention rates are 60%, 35%, and 18%. Only the last one tells you whether people get value from the product.
Choosing the activity event
An activity event is the event that counts a user as active in a period. A good one has three properties.
- It reflects value received. The user got the benefit the product promises. For a file-sharing tool, that is sharing or opening a file, not loading the home page.
- The user must choose it. Events the product triggers on its own (push notifications delivered, background syncs, emails opened by tracking pixels) measure your outreach, not user intent.
- It is stable. If engineering renames or re-instruments the event next quarter, your history breaks. Pick an event you can track consistently.
Weak, medium, and strong events
| Level | Example events | What it tells you | Risk |
|---|---|---|---|
| Weak | App open, login, page view | The user showed up | Inflated by habit, notifications, and accidental opens |
| Medium | Created a document, searched, viewed a report | The user engaged | May still be exploration, not value |
| Strong | Sent an invoice, completed a ride, merged a pull request | The user got the core value | Smaller numbers, and may need a longer period to observe |
For judging product-market fit, lean toward the strongest event you can measure that still happens regularly. Weak events are fine as a secondary view, but they hide problems. A product can hold 50% "app open" retention while almost nobody finishes the core task.
Any event versus a specific event
You can define active in two ways:
- Any event: a user is active if they did anything in the period. This is easy to compute and easy to inflate.
- Specific event (or set of events): a user is active only if they did one of a named list. This takes more thought and is much more informative.
A common compromise is a "qualifying action" list: three to five events that each represent real value. Keep the list short. If you add events until the numbers look good, you have stopped measuring.
Excluding noise
Before you count, decide what to exclude:
- Internal accounts, test accounts, and bots.
- System-generated events.
- The signup or onboarding events themselves. If the activity event is the same as the event that defines cohort membership, every user is active at age 0 by definition. That is expected for age 0, but it can accidentally leak into later periods if the same event fires again during onboarding.
Choosing the time unit
The time unit (or period) is the length of the window in which you check for activity: a day, a week, or a month. Retention is the share of a cohort that was active in each period after the start.
The right unit is tied to how often a healthy user would naturally use the product.
| Product type | Natural frequency | Reasonable unit |
|---|---|---|
| Messaging, social, games | Daily | Day (also week) |
| Fitness, learning, note-taking | Several times a week | Week |
| Project management, analytics | Weekly to monthly | Week or month |
| Accounting, payroll, tax | Monthly to yearly | Month or quarter |
| Travel booking | A few times a year | Quarter or year |
The mismatch problem
If the unit is shorter than the natural usage gap, healthy users look like churners. A payroll tool used once every two weeks will show weak weekly retention even if every customer is happy, because half the weeks have no activity. If the unit is far longer than the gap, you hide real decay. Monthly retention on a daily-use chat app can look flat while the number of days each user is active collapses.
A practical rule: pick a unit at least as long as the typical gap between uses for a satisfied user. Then check that gap in your own data by looking at how long active users usually wait between events.
import pandas as pd
events = pd.DataFrame({
"user_id": [1, 1, 1, 1, 2, 2, 2, 3, 3, 3],
"ts": pd.to_datetime([
"2026-01-02", "2026-01-09", "2026-01-16", "2026-01-30",
"2026-01-03", "2026-01-17", "2026-01-31",
"2026-01-05", "2026-01-06", "2026-01-20",
]),
}).sort_values(["user_id", "ts"])
events["gap_days"] = events.groupby("user_id")["ts"].diff().dt.days
gaps = events["gap_days"].dropna()
print(gaps.describe().round(1))
print("Median gap:", gaps.median(), "days")
print("90th percentile gap:", gaps.quantile(0.9), "days")The median gap here is 14 days, so a weekly unit would count a typical engaged user as inactive in half of all weeks. A two-week or monthly unit fits better. The 90th percentile tells you how long a gap can get before it is unusual.
Calendar periods versus age periods
There are two related ideas that are easy to mix up:
- Calendar period: a fixed slot on the calendar, such as "March 2026".
- Age: how many periods have passed since the user's start. Age 0 is the starting period, age 1 is the next.
Cohort tables put users in rows by starting calendar period and in columns by age. This lets you compare "month 3" of the January cohort with "month 3" of the March cohort, even though they happened at different times. The previous code in the topic converts calendar months to age with (year difference × 12) + month difference.
Calendar-aligned versus rolling windows
You can define periods two ways:
- Calendar-aligned: periods are calendar weeks or months. A user who signs up on January 31 and returns on February 1 has an age of 1 month, though only one day passed.
- Anchored to the user: periods are counted from each user's own start. Day 30 means 30 days after that user's first event. This is fairer to users who start late in a period.
Calendar alignment is simple and matches how teams report. Its main flaw is that cohorts are uneven: someone who starts on the first of the month gets a nearly full period to return before the next one begins, and someone who starts on the last day gets one day. For monthly cohorts this adds noise to age 1. If your cohorts are small or your period is long, consider user-anchored windows (for example, "active between day 30 and day 59") so every user gets the same time to return.
Matching the unit to the decision
Different questions need different units.
- Early activation problems. Use days. If most users leave in the first three days, a monthly table shows only one number for that whole window.
- Habit formation. Use weeks. Weekly retention smooths out day-of-week effects, since many products spike on weekdays or weekends.
- Long-term fit and revenue. Use months or quarters. This matches billing cycles and gives enough time for a plateau to appear.
It is common to run two views: a fine unit for the first weeks to diagnose onboarding, and a coarse unit for the long run to judge fit. Keep the definition of active the same across both so the numbers connect.
Common errors
- Changing the definition mid-analysis. If the activity event changes between cohorts, the cohort comparison measures the definition change, not the product. Record the definition with every table you publish.
- Choosing the definition after seeing the results. Picking the event that makes retention look best is a form of cherry-picking. Decide before you look.
- Using one unit for products with mixed behavior. Power users may use the product daily and casual users monthly. A single unit will misjudge one group. Segment first (a later chapter covers this).
- Counting one-time events as ongoing activity. Events like "completed setup" or "upgraded plan" happen once. They cannot show repeated use.
- Ignoring time zones. If events are stored in UTC and users are spread across regions, an evening action can land on the next calendar day. Convert to a consistent zone, and keep it the same across analyses.
A short checklist
Before building a cohort table, write down:
- The event or events that count as active, and why they represent value.
- What you exclude (test users, bots, system events).
- The time unit, and the evidence that it matches the usual gap between uses.
- Whether periods are calendar-aligned or anchored to each user.
- The time zone.
With these fixed, the next steps (picking a retention definition and building the table) produce numbers you can trust and compare.
Exercise
A team builds a tool that small businesses use to send invoices. Most customers send invoices about twice a month. The team measures weekly retention with "logged in" as the active event, and sees that only about 45% of a cohort is active in any given week, even for customers who have used the product for a year. Name two problems with this definition and say what you would change.
Show answer
First, "logged in" is a weak event: it shows the user showed up, not that they got value, so it can overstate fit when users log in without doing anything, and it can also understate fit when users stay subscribed but do not need to log in. Change the event to a value action such as "sent an invoice". Second, a weekly unit is shorter than the natural gap of about two weeks between uses, so a happy customer is inactive in many weeks, which makes the 45% figure look like churn. Change the unit to a month (or a two-week window), after checking the gap between invoices in the data. Also record the definition so later cohorts use the same one.