Segmentation: strategy before algorithms
Most segmentation projects start with an algorithm and end with a slide of clusters nobody uses. The order is wrong. A segment is a group of customers who respond similarly to the same marketing action and differently from other groups, and that definition already tells you what to do: start from a decision you would take differently, split on behaviour, test whether the groups are identifiable, substantial, reachable, responsive and stable, and only then choose a method. In this chapter I use The Gift Bow, my Solidus demo hamper shop, to walk through an a priori split into gift and self purchases, a behavioural segmentation into four groups inside it, a four Ps table per segment, and a churn model per segment that lifts the AUC from 0.71 to roughly 0.78 without a single new data source. There is a little maths, a variance ratio that settles arguments about which variables belong, and a governance routine so the segments do not quietly rot. This is part 13 of 21 of the Marketing Analytics series.
The hamper shop that thought it had one customer
For the first year of The Gift Bow, my Solidus demo hamper shop at hampers.keferboeck.com, the reporting treated every buyer as the same person. One conversion rate, one average order value, one email list, one churn number. That single customer was a fiction. Behind the average sat a woman in Leeds ordering a cheese hamper for herself every seven weeks, a Vienna office manager ordering thirty Christmas hampers on invoice in late October, and a man who orders exactly once a year, on 22 December at 23:40, with next day delivery and in a mild panic. Sending all three the same "ten percent off this weekend" email is not marketing. It is noise with a discount attached.
Segmentation is the discipline of admitting that your customers are not one person and deciding, deliberately, how many people they are. This chapter is about the strategy behind it; the algorithms come in the next one. If you start with the algorithm, you get clusters. If you start with the strategy, you get segments. The difference costs real money.
Where this sits in the series
This is chapter 13 of 21 and the third of four chapters in part three, the interrelationship techniques, where no single variable is the target. The previous chapter, Principal components and factor analysis for marketers, reduced many correlated variables to a few underlying dimensions, which is often the preparation step for what follows here. The next chapter, Tools of segmentation: k means, latent class analysis and going beyond RFM, gets into the machinery. This one is the thinking to do before you touch any of it.
What a segment is, and what it is not
A segment is a group of customers who respond similarly to the same marketing action and differently from other groups. "Respond" means the segment is defined by what people do when you act, not by what they look like. "The same marketing action" means the split must matter for a decision you can actually take: a different product, a different price, a different message, a different channel. "Differently from other groups" means that if two of your segments would react the same way to everything you might plausibly do, you have one segment with two names.
What a segment is not: a demographic bracket, a cluster an algorithm spat out, a persona from a workshop, or a filter in your email tool. All of these can become segments; none is one by default. I wrote about the demographic trap in Segmentation is not demographics; the short version is that age and postcode describe who somebody is, not what they want from you.
The strategic reason to segment is that the four Ps can be set per segment: product (range, bundles, features), price (level, structure, discounting rule), promotion (message, timing, offer) and place (channel, checkout, sales route). A business that cannot name one of the four Ps it would set differently for a segment does not need that segment. It needs a nicer chart.
Five tests before a segment deserves the name
I run every proposed segment through five tests, strictly, because a segment that fails one of them quietly wastes budget for years.
Identifiable. Can I tell, for each individual customer in the database, which segment they belong to, with a rule or a model that runs on the data I have every week? A segment called "people who value craftsmanship" is unidentifiable unless I can score it from behaviour.
Substantial. Is the segment big enough, in revenue or margin, to justify a different treatment, with its own creative, pricing debates and QA? A segment of 200 customers worth £40 a year does not pay for that, however distinctive it is.
Reachable. Can I get a different message or offer in front of this segment without also hitting the others? If your only channel is a homepage banner, you have one segment, whatever the model says.
Responsive. Does the segment react differently to the treatment I have in mind? This is the one people skip. It needs a test, or at least a natural experiment in the history, showing that segment A moved on delivery promises and segment B did not.
Stable. Does the segment stay recognisable for long enough to build something around it? If a third of the members migrate every month, the segment is a mood, not a market.
A priori or post hoc: two roads to the same place
An a priori segmentation is one you decide before looking at the data, because the strategy demands it. For The Gift Bow the a priori split is gift purchase versus self purchase. It is dictated by the business: a gift has a recipient, a deadline and a message card; a self purchase has none of those. In practice I read it from the order: a shipping address different from the billing address, a gift message or a requested delivery date marks a gift with roughly 90 percent accuracy; one survey question at checkout catches most of the rest.
A post hoc segmentation is one you discover in the data. Inside the gift buyers, the a priori split says nothing about the man on 22 December versus the woman who orders her mother's birthday hamper in the same week every March. Those groups emerge from timing, frequency and basket, and they would not have occurred to me from strategy alone.
The two are not rivals. My rule: do the a priori split first when the business logic is overwhelming, then look for post hoc structure inside each half. Running an algorithm on everybody and hoping the gift versus self distinction falls out usually produces clusters that are half gift, half self and useless for both.
From strategy question to activation
Here is the process I follow, drawn as a loop because the last step feeds the first.
The segmentation process as a loop: strategy first, the algorithm in the middle, governance feeding the next question.
The strategic question has to be specific. "We want to understand our customers better" is not a question. "Which customers should get a paid delivery promise and which a loyalty perk instead of a discount?" is one, and it already tells you which variables matter.
Basis variables are the ones you segment on; descriptor variables are the ones you use afterwards to describe and find the segments. Behaviour goes in the basis, demographics at most in the descriptors. Fail a test, go back and change the basis variables. Pass, then name the segments, write a one page definition for each, score every customer, and only then talk about creative.
Which variables to segment on: behaviour first
Segment on what people did before you segment on what they said, and on what they said before what they are.
- Transactional behaviour: how often, how recently, how much, which categories, what time of year, whether it was a gift. It is in every shop database and it is the strongest predictor of future behaviour.
- Engagement behaviour: opened, clicked, visited, abandoned, contacted support. Weaker and noisier, but useful for timing.
- Stated needs and attitudes: a short survey attached to a purchase. Needed when the strategy is about positioning, because behaviour only tells you what people did with the range you had.
- Demographics and firmographics: descriptors only, to help media buying find the segment. Never basis variables unless a law or a logistics constraint forces the split.
Is the split real? A little maths
One ratio saves a lot of arguments. Take any basis variable, say orders per year. Its total variation across all customers splits cleanly into variation within segments and variation between segments:
Here is the value for customer , the overall mean, the set of customers in segment , that segment's mean, its size, with segments and customers in total. The left side is the total sum of squares. The first term on the right is the within segment sum of squares, the spread you have not explained; the second is the between segment sum of squares, the spread the segment labels account for.
The share explained is:
Eta squared runs from 0 to 1. Near 0 the segments do not differ on this variable at all; near 1 knowing the segment almost tells you the value. For a good behavioural segmentation I expect eta squared above 0.3 on the basis variables and I am pleased above 0.5. If age band scores 0.03, age band is telling you it does not belong in the basis.
The second formula is the substantiality test in one line. The value of treating segment differently is:
where is the number of customers in the segment, the margin per responding customer, and the bracket is the lift in response rate from the segment specific treatment over what you do today. If does not comfortably cover the cost of building and running the treatment, merge the segment into its nearest neighbour. This formula is also why "responsive" needs a test: the bracket is the only part you cannot read from history.
The Gift Bow's four groups
Two years of orders, 12,400 customers, one row each with orders per year, average order value, units per order, days between order and occasion, December share of orders, and the a priori gift flag. The numbers are illustrative, drawn from the demo shop's seeded data and rounded. Four groups came out and survived the five tests.
| Segment | Share of customers | Share of revenue | Orders per year | Average order | Typical timing |
|---|---|---|---|---|---|
| Deadline gifters | 42% | 31% | 1.3 | £68 | One to four days before an occasion, heavy in December |
| Occasion loyalists | 23% | 24% | 2.6 | £59 | The same weeks every year |
| Regular treaters | 27% | 19% | 5.8 | £34 | Every six to eight weeks, for themselves |
| Corporate planners | 8% | 26% | 1.4 | £1,120 | October and November, on invoice |
Reading it line by line. Deadline gifters are the biggest group by headcount and the least profitable per head: they buy once, late, and they pay for speed. They are not disloyal, they simply do not think about hampers until the calendar forces them to. Occasion loyalists look similar on a single order but come back, to the week, year after year. Regular treaters are the self buyers: small baskets, high frequency, cheese and wine rather than the big presentation box. Corporate planners are 8 percent of customers and a quarter of revenue, ordering in bulk with a purchase order number and a deadline of "before the office party".
Revenue share of the four segments. Corporate planners are a twelfth of the customers and a quarter of the money.
The eta squared values tell me the split is real and confirm the ordering of variables:
| Variable | Eta squared | What it says |
|---|---|---|
| Orders per year | 0.61 | Frequency separates the groups strongly |
| Units per order | 0.58 | Mostly the corporate group standing apart |
| Days before the occasion | 0.44 | Deadline gifters versus everyone else |
| Average order value | 0.39 | Corporate high, treaters low |
| December share of orders | 0.33 | Seasonality is real, not the whole story |
| Age band | 0.03 | A descriptor at best |
Age and region were never in the basis; I computed them afterwards to show why they should not be.
One churn model for everyone, or one per segment
Here is where segmentation stops being a marketing exercise and starts improving the statistics. A single logistic churn model for all 12,400 Gift Bow customers, built the way the logistic regression chapter describes, reached an AUC of 0.71 on a holdout year, which is respectable and about what a pooled model on retail data usually gets.
The trouble is that "churn" does not mean the same thing in each group, and neither do the predictors. A regular treater who has not ordered in 120 days is gone. An occasion loyalist who has not ordered in 120 days is between birthdays. A corporate planner is only at risk if 15 December passes without an order. Pooling them forces one definition and one set of coefficients onto four different processes.
So I fitted four models, one per segment, each with its own churn window and predictors:
| Segment | Churn definition | Pooled model AUC within segment | Segment model AUC | Churners in the top decile, pooled | Churners in the top decile, segment model |
|---|---|---|---|---|---|
| Deadline gifters | No order within 14 months | 0.69 | 0.74 | 24% | 29% |
| Occasion loyalists | Last year's occasion week missed by 60 days | 0.72 | 0.81 | 27% | 38% |
| Regular treaters | No order within 120 days | 0.74 | 0.83 | 29% | 41% |
| Corporate planners | No order by 15 December | 0.66 | 0.79 | 22% | 36% |
Reading it: the pooled model is weakest exactly where the money is, in the corporate group, because 1,000 customers cannot pull the coefficients of a 12,400 row model their way. The corporate model uses variables the pooled one barely noticed: whether a quote was requested in September, whether the contact person changed, whether last year's delivery had a complaint. Its AUC jumps 13 points. For the treaters the gain comes from the short churn window; the pooled model called half of them safe when they were already gone. The top decile columns are the operational version: the riskiest ten percent of the list now holds 29 to 41 percent of the customers who actually leave.
The pooled model on the left, the four segment models on the right. Every segment model beats the pooled one, and the gains are largest where the pooled model had the least data.
A size weighted blend of the segment AUCs is a rough summary, not a proper pooled statistic, but it gives the feel:
From 0.71 to roughly 0.78 without a single new data source, only by admitting that four processes are not one. The general lesson: when a dependent variable model underperforms on a heterogeneous population, segment first and fit inside. I described the operational side of this in Predictive automation with behavioural segments, where the segment scores drive the automations directly.
The four Ps per segment
This is the table the whole exercise exists to produce. If you cannot fill it in, the segmentation is not finished.
| Segment | Product | Price | Promotion | Place |
|---|---|---|---|---|
| Deadline gifters | Bestsellers held in stock, gift card included, nothing that slows dispatch | Full price, paid next day and Saturday delivery | Delivery countdown on site, occasion calendar emails two weeks ahead | Search ads on urgency terms, mobile checkout with saved addresses |
| Occasion loyalists | Last year's hamper as a one click reorder, an upgrade suggestion | Full price, a loyalty perk instead of a discount | A reminder three weeks before last year's order date, naming the recipient | Email and the account page, nothing paid |
| Regular treaters | Smaller boxes, new arrivals, a subscription option | Bundle pricing and a subscription saving, the only segment where a price cut pays | New product news, tasting notes, restock alerts | Instagram, newsletter, on site recommendations |
| Corporate planners | Branded cards, volume tiers, staggered delivery to many addresses | Volume tiers, invoice payment, quote based | A call in September, a printed catalogue, a case study | LinkedIn, direct sales, a quote form |
Read across a row and you see a coherent proposition for one kind of customer. Read down a column and you see why a single homepage cannot serve all four. The discount decision alone pays for the analysis: only the treaters respond to a price cut with more volume; for the other three a discount is margin given away to people who were going to buy anyway. That is the "responsive" test in action, confirmed with a holdout, not asserted.
Running it yourself
Data you need: two years of completed orders with a customer key, order date, total, item count, shipping versus billing address, and any gift flag or message. One row per customer is the target shape; something like this builds the basis variables from a Solidus schema:
with orders as (
select o.user_id, o.completed_at, o.total, o.item_count,
(o.ship_address_id <> o.bill_address_id) as is_gift
from spree_orders o
where o.state = 'complete'
and o.completed_at >= now() - interval '24 months'
)
select user_id,
count(*) * 12.0 / 24 as orders_per_year,
avg(total) as avg_order_value,
avg(item_count) as units_per_order,
avg(case when extract(month from completed_at) = 12 then 1 else 0 end) as december_share,
avg(case when is_gift then 1 else 0 end) as gift_share
from orders
group by user_id;
Then the algorithm, which is the next chapter, then the profile, then eta squared per variable to check the split is real. The per segment models are the same loop again, one fit per group with its own churn flag.
import pandas as pd
def eta_squared(df, var, seg):
grand = df[var].mean()
ss_total = ((df[var] - grand) ** 2).sum()
groups = df.groupby(seg)[var]
ss_between = (groups.size() * (groups.mean() - grand) ** 2).sum()
return ss_between / ss_total
for var in ["orders_per_year", "avg_order_value", "units_per_order", "age_band"]:
print(var, round(eta_squared(customers, var, "segment"), 2))
How long it takes: with clean order data, the first defensible segmentation is two weeks of work, most of it profiling and the five tests rather than computation. Checks before you trust it: the segments should reproduce on a random half of the customers; eta squared on the basis variables should sit well above 0.3; every segment should pass the five tests in writing; and at least one four Ps difference per segment should have been tested against a holdout.
Governance: segments age
A segmentation is a living asset, and most die of neglect. Customers migrate: a deadline gifter becomes an occasion loyalist the moment she orders for the same birthday twice. The rules I put in place are dull and they work.
Every customer carries a segment ID and a segment version in the CRM, and the scoring runs monthly. Migration between segments is a reported number; when more than about 10 percent move in a quarter, I look at whether the segments or the customers changed. The definitions are refitted once a year and a new version is only adopted if it beats the old one on eta squared and the five tests. Each segment has an owner who can say in one sentence what it is for. And segments get retired: if drops below the running cost for two quarters, the segment merges into its neighbour and its creative stops.
Pitfalls
Segmenting on what is available rather than what matters. Age, gender and postcode are in every export, so they end up in the basis. Later nobody can explain why the segments do not behave differently, because they were never built to.
Too many segments. Eight segments feel thorough and are operationally impossible: four Ps times eight is 32 decisions to maintain. Three to five is the range where a small team can actually run different treatments. If the algorithm insists on more, the basis variables are probably noisy.
Confusing clusters with segments. An algorithm always returns groups, even on random data. A cluster becomes a segment only when it passes the five tests and has a row in the four Ps table.
Declaring responsiveness without a test. The four Ps table is a set of hypotheses until a holdout says otherwise. I have seen "price sensitive" segments that bought more at full price once the discounts stopped. Test the bracket in .
How I do this for clients
The data I need is the order history with a customer key, two years if you have it, plus whatever engagement data your email or CRM tool exports. If you run Solidus or another Rails shop I can usually pull the one row per customer table myself in a day.
The first month starts with the free workshop, where we write down the strategic question and the a priori splits the business already knows about, and agree what "different treatment" would concretely mean. Then two weeks of real work at my cost: the feature table, the a priori split, the post hoc segmentation inside it, the five tests, and a first draft of the four Ps table. If you do not think the segments are real at the end of that, we part with no invoice.
What you get if we continue: a one page definition for each segment, a scored customer list with segment ID and version that loads into your CRM, the scoring SQL or Python so it runs in your own warehouse without me, a decision memo per segment with one number (the substantiality value) and one risk, and a dashboard that answers one question: how are the segments moving. Where it pays, per segment models replace the pooled ones, as in the churn example above. You own all of it. The analytical work is described on the data science page, the activation side, where the four Ps become campaigns and tests, under growth hacking plus, and the commercial terms, including the commission based option, on the pricing page. One accountable person, honest numbers with error margins, no vanity metrics.
Questions to ask your team or agency
- Which decision would we take differently for each segment, beyond the message?
- Can every customer in our database be assigned to exactly one segment by a rule we can run next Monday?
- What is eta squared on our basis variables, and did anybody compute it for the demographic variables as a control?
- Which segment differences in response have actually been tested against a holdout, and which are assumptions?
- What does churn mean for each segment, and does our churn model know the difference?
- When were the segments last rescored, how many customers migrated, and who owns each segment?
This series is inspired by Mike Grigsby's Marketing Analytics (Kogan Page). The explanations, examples and numbers here are my own.