Sub topic 9
Segmenting Cohorts to Find Who the Product Fits
This chapter assumes you can build a cohort retention table (month of first event, age in months, distinct active users divided by cohort size) and read a retention curve for decay or a plateau. Basic pandas is enough for the code.
Why segment
A blended retention curve averages every kind of user together. If one group stays and another leaves, the average can look like slow decay, even though the product already fits the first group. Segmenting splits each cohort by a user attribute and builds one retention curve per segment. You are looking for a segment whose curve flattens at a useful level. That segment is the people the product fits today.
Choose segments you can act on
Pick attributes known at or near signup, so a user's segment does not change because of how they behaved later. Common choices:
- Acquisition channel, such as paid ads, organic search, or referral.
- Company size or role, for a B2B product.
- Plan or pricing tier at signup.
- First use case, meaning the first feature a user tried.
- Platform, such as web or mobile.
Avoid segments defined by later behavior, for example "users who invited a teammate." Retained users do more of everything, so these segments look good by construction. That is survivorship bias. A behavior can still be a useful hypothesis, but treat it as a lead to test, not a finding.
Build one table per segment
Add a segment column to the user data, then include it in the groupby. This example reuses the events table from the cohort-table chapter and adds an invented channel for each user.
import pandas as pd
channel = {1: "organic", 2: "paid", 3: "organic", 4: "paid", 5: "organic"}
events["channel"] = events["user_id"].map(channel)
active = (
events.groupby(["channel", "cohort", "age"])["user_id"]
.nunique()
.unstack(fill_value=0)
)
retention_by_channel = active.div(active[0], axis=0)
print(retention_by_channel.round(2))Each row is now a (channel, cohort) pair. To compare segments directly, pool the cohorts for each segment. Count active users and cohort sizes across all cohorts, then divide. Only pool at ages that every pooled cohort has had time to reach. Otherwise, the youngest cohort drops out of later ages, and the pooled curve changes for reasons unrelated to the product.
Read the segment curves
Apply the same questions as before to each curve:
- Does the curve flatten, and at what level?
- How long did it take to flatten?
- Is the segment large enough to matter for the business?
A segment that plateaus while the blend decays is a candidate for your target market. The next step is to ask what those users share and whether more of them exist and can be reached.
Gotchas
- Small segments. Every split divides your users into smaller groups. With 12 users in a segment, one person leaving moves retention by about 8 points. Do not read a shape from that.
- Too many cuts. If you test 20 segmentations, one will look good by chance. Decide a handful of hypotheses before you look, and check that a promising segment holds up in a later cohort.
- Segment size. A segment with excellent retention but few reachable users may not support a company. Report the size next to the curve.
- Confounded segments. Channel and company size often overlap. If referrals come mostly from large companies, the channel may not be the cause. Cross the two attributes to check.
What to do with the result
If one segment retains well, check whether it is growing as a share of new signups. Look at what it has in common, and consider narrowing acquisition and onboarding toward it. Later chapters combine this with revenue retention and other signals to reach a judgment.
Exercise
A blended cohort curve decays slowly and never flattens. Splitting by channel shows referral users plateau at 35% retention, while paid users decay toward 5%. Referral users are only 9 people in the cohort. What do you conclude, and what do you do next?
Show answer
The referral result is a lead, not a conclusion. With 9 users, one person changes retention by about 11 points, so the plateau may be noise. Next, pool several cohorts of referral users to enlarge the sample, check that the plateau appears at ages every pooled cohort has reached, and see whether it repeats in newer cohorts. Also check whether referral users share a company size or use case, since channel may be confounded with those.