Segmentation is not demographics
TL;DR
Difficulty: Intermediate
Demographic segments feel rigorous but say little about what people buy, because age and postcode describe the person, not the job they want done. Real segments are clusters of behaviour: recency, frequency, basket and discount response. Standardise each signal with the z score, run k means, and choose the number of groups with the elbow in the within cluster sum of squares and the silhouette. In a worked example of eight coffee customers both point to four groups, including lapsing loyalists no demographic slide shows. Clustering customers is profiling under the UK GDPR, so say so in your privacy notice, honour objections and never infer health or beliefs.
What to read first
Your demographic segments are probably misleading you. Age, gender, postcode and income look scientific on a slide, but two customers who share every box can want opposite things, and two who share none can want the same thing. In this article I show why, then build behaviour segments step by step for an invented Bristol coffee roaster: the signals worth measuring, why you must standardise them, how k means works, how the elbow and the silhouette pick the number of groups, and how each group gets its own message and offer. I finish with the UK GDPR side, because clustering customers is profiling.
The segment that feels rigorous and tells you nothing
Most segmentation decks open the same way. Here are our customers by age. Here they are by gender. Here is the postcode heat map, the household income bands, the neat pie chart of who our buyers are. It looks like homework. It looks like someone did the analysis. And very often it tells you almost nothing about why anyone bought anything.
That is the uncomfortable bit, so let me say it plainly. Demographic segments feel rigorous and usually explain little about what people actually purchase. Knowing that a customer is a woman aged 35 to 44 in a mid income postcode tells you a lot about her census record and very little about her basket. Two people who match on every one of those boxes can walk into your shop wanting opposite things, and you will have grouped them together and written one message for both.
Let me be fair to demographics before I take them apart. They are not useless. They are easy to collect, they are stable, and now and then they really do line up with a need. Nappies sell to new parents, and nobody orders a stairlift for fun. The trouble is treating a weak signal as the whole story. Age is a proxy for a need at best, and a lazy one. When a stronger signal is sitting untouched in your order history, reaching for the census instead is a choice, and usually the wrong one.
Two identical people, opposite baskets
Picture two customers. Same age to the year, same gender, same postcode, near enough the same income. On every demographic chart you own they sit in the same cell, so you would send them the same ad and the same offer.
Customer one buys a pair of trail running shoes, then a fortnight later some energy gels, then a lightweight jacket, then more shoes three months on. She is training for something. She buys on performance, she reorders consumables, she cares about weight and grip, and she will pay for the good stuff.
Customer two bought one pair of the same shoes in November, in a gift box, in somebody else's size, and has not been back. She is a gift buyer. She bought on the recommendation and the returns policy, price mattered, and running has nothing to do with her.
Same demographic cell, opposite needs. Send both the same email about a new midsole and you delight one and baffle the other. The demographic box said they were the same. Their behaviour says they could not be more different.
Two very different people who want the same thing
Now flip it. A 24 year old student and a 61 year old company director share no demographic box at all. Yet both come to your shop for one reason: they need the item tomorrow, guaranteed, because they left it too late. Call it the last minute segment. They want speed and certainty, they barely look at price, and the message that wins both is the delivery cut off clock, not the product story.
Demographics put them in different rooms. Behaviour puts them in the same one. Here is the idea to hold on to: demographics describe the person, behaviour describes the need. You are selling to a need, so measure the thing you are selling to.
What a real segment actually is
A real segment is a cluster of need and behaviour: a group of customers who behave alike, want the same job done and respond to the same trigger, whether or not they share a single line on a census form.
Behaviour is something you already measure. You have just been filing it under reporting instead of using it. How recently did they buy? How often? What is in the basket, and what goes with what? Do they wait for a discount or ignore it? Do they browse for weeks or buy in ninety seconds? Do they send things back? Do they reorder the same consumable on a rhythm? Every one of those is a behaviour signal, and together they describe a customer far better than a postcode.
The job, not the person
There is an old idea in marketing that refuses to age: people do not buy products, they hire them to get a job done. Clayton Christensen and his coauthors put it at the centre of their "jobs to be done" work in the Harvard Business Review1. Nobody wants a drill, they want a hole, and really they want a shelf, and really a tidy room. Two people hire the same product for very different jobs, which is exactly why the product category on your invoice is a poor guide to who your customer is.
Segments are jobs wearing customers. When you cluster behaviour you are really grouping jobs, and most shops serve only a handful of them. The gift job. The stock up job. The treat myself job. The emergency job. Once you name the job, the message almost writes itself, because you know what the customer came to get done. You are not sorting humans, you are sorting the reasons they showed up.
The behaviour signals worth measuring
You do not need a hundred fields to cluster well. You need a handful of honest ones, and each one quietly reveals something about the job.
| Signal | What it measures | What it hints at |
|---|---|---|
| Recency | Days since the last order | Active, lapsing or gone |
| Frequency | Orders in a window | Habit versus one off intent |
| Monetary | Average and total basket | Value tier and headroom |
| Discount response | Share of orders on promotion | Whether price is the trigger |
| Basket shape | What sits together in a cart | The job being done |
| Time to buy | Minutes from landing to checkout | Considered versus impulsive |
| Return rate | Share of items sent back | Gifting, uncertainty or fit trouble |
| Reorder rhythm | Gap between repeat buys of a consumable | Subscription intent hiding in plain sight |
You will not use all eight. Three or four strong signals beat eight weak ones, because every extra axis spreads your customers thinner and makes the clumps harder to see. Start with recency, frequency, basket and discount response, and add more only when a group refuses to separate. The first three are the classic RFM trio, which I take apart in the tools of segmentation.
Finding the clusters without guessing
You cannot eyeball ten thousand customers and sort them by hand. That is the job cluster analysis was built for. Put each customer in a space where every axis is a behaviour: one axis for frequency, one for average basket, one for discount share, one for recency. Customers who behave alike sit near each other. A clustering method finds the natural clumps.
The workhorse is k means. You tell it how many groups to look for, call that number , and it repeats two steps until nothing moves. It assigns every customer to the nearest group centre, then moves each centre to the middle of the customers it just collected. The centres drift until they sit in the heart of real clumps of behaviour. The scikit learn documentation describes the method and its target, the within cluster sum of squares, in plain terms2.
A worked example: a coffee roaster in Bristol
Let me make this concrete before the formulas. Kiln Lane Roasters (kilnlane.example) is an invented Bristol shop selling beans, subscriptions and brewing gear. We pull four signals for eight customers, standing in for the thousands you would really have: orders in the last year, average basket in pounds, the share of orders placed with a discount code, and days since the last order.
| Customer | Orders per year | Avg basket (£) | Discount share | Days since last |
|---|---|---|---|---|
| A | 14 | 32 | 0.05 | 12 |
| B | 2 | 41 | 0.90 | 8 |
| C | 13 | 30 | 0.10 | 140 |
| D | 1 | 68 | 0.00 | 200 |
| E | 15 | 34 | 0.00 | 9 |
| F | 3 | 39 | 0.85 | 15 |
| G | 1 | 72 | 0.00 | 30 |
| H | 12 | 29 | 0.05 | 160 |
There is no age or postcode here, and that is the point. Every number that follows in this article is calculated from this table.
Put every signal on the same scale first
Here is the trap that catches nearly everyone the first time. The signals live on very different scales. Orders run from 1 to 15. Discount share runs from 0 to 0.9. Days since last order run from 8 to 200. Distance in that raw space is almost entirely recency, because a gap of a hundred days dwarfs a gap of ten orders.
Run the numbers on Kiln Lane's raw table and you see the damage. Customer A, a frequent full price buyer, sits about 15.5 units from B, a deal seeker, but 128 units from C, who has exactly A's habits and simply has not ordered for 140 days. Ask for four groups on the raw numbers and the best split lumps A, E, B and F together, the loyal regulars and the deal seekers in one bucket, because their recency happens to be similar. You are secretly clustering on one column and calling it insight.
The fix is to standardise every signal before you cluster, so each speaks with the same voice. The usual move is the z score (Foundations: spread):
Take a value , subtract the average of that signal across all customers, and divide by the standard deviation , the typical distance from the average. Every signal is now measured in the same unit, standard deviations from the middle. scikit learn's StandardScaler does exactly this3.
For Kiln Lane, orders average 7.6 with a standard deviation of 5.96, baskets £43.1 and £16.0, discount share 0.24 and 0.37, days since last 71.8 and 75.4. Customer A's 14 orders become . A's 12 days become . After standardising, A sits 0.25 from E, 1.72 from C and 3.13 from B. The deal seeker is now the furthest away, which is what your eyes told you all along.
The distance that decides who sits together
Clustering lives or dies on one question asked again and again: how far apart are these two customers? Once every signal is standardised, the honest answer is the straight line distance in the behaviour space, Pythagoras with more axes (Foundations: matrices):
For two customers and , walk through every signal , take the gap , square it, add the squares across all signals and take the square root. A small means they behave alike. That is the entire notion of near that k means uses, and it is why standardising matters: the distance is only fair if every axis was put on the same scale first.
What k means is really chasing
The method is trying to make each group as tight as possible. Tightness is measured by the within cluster sum of squares, the total squared distance from every customer to the centre of their own group (Foundations: spread):
For each customer , take their position , find the centre of the cluster they belong to, square the distance between the two, and add it all up. When is small, every customer sits close to their centre and the groups really do behave alike. k means is the machine hunting for centres that make this number as small as it can.
How many segments: the elbow method
There is one decision the machine cannot make for you: how many groups. Pick too small and you crush different customers together. Pick it too large and you slice one real group into shards.
Run the clustering for equal to one, two, three and so on, and write down the WCSS each time. It always falls as you add groups, because more centres can always sit closer to more people. But it does not fall evenly. It plunges while you are still separating genuinely different customers, then flattens once the real groups are found.
Here is Kiln Lane. With eight customers I could check every possible split for each , so these are the best possible values; with real data, k means does the searching. With four standardised signals and eight customers, the WCSS for one group is exactly , because each standardised signal contributes one unit of variance per customer.
| Number of clusters | WCSS | Fall from the row above |
|---|---|---|
| 1 | 32.0 | |
| 2 | 17.5 | 14.5 |
| 3 | 6.3 | 11.2 |
| 4 | 2.7 | 3.6 |
| 5 | 0.13 | 2.6 |
| 6 | 0.07 | 0.06 |
Going from one group to two buys 14.5. Two to three buys another 11.2. Three to four buys only 3.6, and after that the WCSS is heading towards zero simply because there are almost as many groups as customers. The bend, where the steep drop gives way to the gentle slope, is the elbow. Here it says three, possibly four.
Three groups on this data are the deal seekers (B and F), the one off big spenders (D and G), and one large group of frequent full price buyers (A, C, E and H). Hold that thought, because the fourth group is the one that matters most.
A second opinion when the elbow is blurry
Real elbows are often soft, as this one is between three and four. Then you want a second opinion, and the one I use is the silhouette, which scikit learn documents alongside k means2. For one customer, let be the average distance to the others in their own cluster, and the average distance to the members of the nearest other cluster (Foundations: mean):
Here lands between minus one and one. Close to one means the customer sits comfortably inside their group and far from the next. Near zero means they sit on the border. Below zero means they are closer to another group than their own, the machine telling you the label is wrong. Average across all customers for each and the highest average is the tidiest split.
For Kiln Lane the average silhouette is 0.39 with two groups, 0.60 with three, 0.72 with four, 0.65 with five and 0.44 with six.
The silhouette picks four. Going from three to four splits the big frequent group in two: A and E, who ordered last week, and C and H, who used to look exactly like them but have not ordered for 140 and 160 days. When the elbow and the silhouette disagree, choose the split that gives you groups you can name and act on. A segment you cannot describe to a copywriter is not a segment, it is a number. Four it is.
Reading a cluster centre like a portrait
Once the clusters exist, the most useful thing you own is the centre of each one, the average customer of that group, read back in the original units.
| Signal at the centre | Loyal regular (A, E) | Deal seeker (B, F) | One off spender (D, G) | Lapsing loyalist (C, H) |
|---|---|---|---|---|
| Orders per year | 14.5 | 2.5 | 1 | 12.5 |
| Average basket | £33 | £40 | £70 | £29.50 |
| Discount share | 0.03 | 0.88 | 0.00 | 0.08 |
| Days since last | 10.5 | 11.5 | 115 | 150 |
| The job | Keep me stocked | Get me a deal | Buy this once | I drifted away |
| The move | Thanks and first look | Fenced offers | Nudge to subscribe | Win back now |
The loyal regulars are the beating heart of the subscription. The deal seekers only buy when there is a code. The one off spenders bought a grinder or a gift set once, at full price, and stayed away. And the lapsing loyalists have every habit of a regular except recency, which keeps growing.
Notice something. The one off spender centre shows 115 days, the average of D at 200 and G at 30, which is why five groups split them apart. That split is real, but it changes nothing you would do, so it is not worth a fifth segment.
The lapsing loyalist, the group demographics never show
The lapsing loyalist deserves its own moment, because it is the most valuable group to catch and the easiest to miss. On a demographic slide they are invisible, filed with everyone else their age. In a behaviour cluster they light up, because recency has drifted while everything else stayed put. A single well timed "we saved your usual" message to this group can be worth more than a cold acquisition campaign, because these are customers you already paid to win. You only see them if you cluster on behaviour and keep recency as its own axis.
From behaviour to segment to action
Here is the whole path, from raw signals to what you actually do on Monday.
The common mistake is to stop at the demographic chart and jump straight to one message for everyone. The value lives further along, where the behaviour becomes a segment and the segment becomes its own promise and its own price.
Messaging: one product, several promises
With three or four groups, your marketing stops being one shouted message and becomes a handful of quiet, accurate ones. Same product, different promise, because each group wants a different job done. The loyal regular wants to hear about the new single origin first and to be thanked. The deal seeker wants the offer and the deadline. The one off spender wants a reason to come back, perhaps a subscription they never considered. The lapsing loyalist wants a nudge before the gap becomes permanent. Sending all four the same email is a choice to be generic. Sending each its own is one of the highest return changes a small shop can make, and it costs little beyond the segmentation itself.
Pricing: the same shelf, the right offer for each need
Segmentation should move your offers, not just your words. The deal seeker is telling you, with their behaviour, that they only move on a discount, so promotions should be aimed at them and fenced off from everyone else. The loyal regular would have paid full price, so a blanket discount just gives their margin away. The one off big spender paid full price for something substantial and buys on reassurance, so a premium bundle with a strong guarantee can outsell a price cut for that group. When you match offers to behaviour you stop leaving money on the table at both ends: the discount you did not need to give, and the premium you never thought to offer.
A fenced offer, such as a code sent only to the deal seekers, is the ordinary version. Changing the price itself per person by algorithm is a different and more sensitive thing, and the next section explains why.
Behaviour segments are profiling, so do it in the open
Clustering customers by what they buy is profiling in the legal sense. The UK GDPR defines profiling as automated processing of personal data to evaluate personal aspects of someone, in particular to analyse or predict their economic situation, personal preferences, interests, reliability or behaviour4. A k means run on order history does exactly that. That is not a reason to stop. It is a reason to do it properly.
First, say it. Your privacy notice should tell customers that you group them by purchase behaviour to tailor marketing, and you need a lawful basis for it. Second, respect the stop button. Where you process data for direct marketing, people have the right to object at any time, and that includes profiling related to the marketing; once someone objects, you stop processing their data for that purpose5. Third, keep it lean. Behaviour segments need order data, not birthdays, gender or household income, which sits well with the data minimisation principle that you only process what you need6. Ironically, dropping demographics makes the segmentation both better and lighter on personal data.
The sharp edge is special category data: health, religious beliefs, ethnic origin, sex life and sexual orientation, among others, which Article 9 protects more strictly7. Shops get there by inference. The Information Commission (formerly the ICO) says that if your profiling intends to infer something in those categories, or you treat people differently on the basis of such an inference, the inferred data is special category data, however unsure the inference is, and you need an Article 9 condition8. So a cluster that amounts to "probably pregnant", "probably managing a health condition" or "probably observant of a particular faith" is not a harmless marketing label. If your catalogue touches health or religion, build the clusters from frequency, recency, basket value and discount response, and keep product categories that reveal those things out of the model.
Then there are automated decisions. Since the Data (Use and Access) Act 2025, the UK rules sit in new Articles 22A to 22D of the UK GDPR, in force since 5 February 2026. They apply to significant decisions, meaning those with a legal or similarly significant effect, taken without meaningful human involvement, and they are strictest where special category data is involved9. Deciding which newsletter version someone receives will rarely be a significant decision. The European data protection authorities' guidance on the same concept says targeted advertising usually is not, but can be depending on how intrusive it is, and that differential pricing could have a significant effect if prohibitively high prices effectively bar someone from goods or services10. If you sell into the EU, there is one more rule: EU consumers must be told when a price was personalised on the basis of automated decision making11. Fenced codes for a segment are the safe, ordinary route. Algorithmic prices per person need legal advice first.
Common mistakes to guard against
Segmentation projects tend to trip on the same handful of things.
Clustering on the raw numbers. If you do not standardise, you are clustering on whichever signal has the biggest range, as Kiln Lane's recency showed. Standardise, every time.
Chasing too many segments. The elbow says three or four and the temptation is to run twelve because twelve feels more precise. It is not more precise, it is more fragile, and nobody can write twelve emails that genuinely differ.
Segmenting on things you cannot act on. A segment is only worth having if it changes what you do. Two groups that get the same message and the same offer are one group wearing two labels, which is exactly why Kiln Lane's fifth split was not worth keeping.
Building it once and never again. Behaviour drifts. Regulars lapse, deal seekers reform, new customers arrive. A segmentation is a photograph, not a monument, so run it again on a sensible rhythm, quarterly for most shops.
Letting demographics sneak back in. Resist adding age back unless it earns its place by making the groups genuinely tighter. It also adds personal data you then have to justify.
Naming the segment before you understand it. The name should come from the centre, not from a persona somebody sketched in a workshop. Read the portrait first, then name it. For the strategic side of choosing which segments to serve at all, see segmentation strategy before algorithms.
How to apply this without a data team
You can start in an afternoon with a spreadsheet.
First, pull your order history into one table, one row per customer, with four columns: orders in the last year, average basket, share of orders with a discount code, and days since the last order. That is your behaviour space, and it is already more honest than any demographic file you own.
Second, sort by each column and look. Patterns jump out before any maths: the frequent full price buyers, the ones who only ever bought on offer, the big baskets that came once and vanished, the regulars who have gone quiet.
Third, to do it properly, standardise the four columns and run k means for from two to six in whatever tool you have: a Python notebook with scikit learn, R, or a spreadsheet add on. Plot the WCSS, find the elbow, and check it against the silhouette.
Fourth, name each group from its centre, write down the one job it hires you for, and decide one message and one offer for it. Four lines, one per segment.
Fifth, act and measure. Send each group its own email, fence discounts to the group that needs them, and watch the orders and the margin per segment. When the groups start to drift, run the whole thing again. And check your privacy notice says what you are doing before the first send.
The one idea to leave with
Stop describing customers by who they are and start describing them by what they do. Age and postcode feel rigorous and predict little. Need and behaviour look messy and predict a lot. Standardise the signals, let the elbow and the silhouette tell you how many groups you really have, read each centre like a portrait, and give each group its own promise and its own offer. Do it in the open, with lean data and nothing that guesses at health or beliefs.
Turning order history into segments a business can act on is a core part of my data science work. Your raw data stays yours, and the terms for code and models are in the analytics and data science terms. If you want to find your own three or four groups, book the free workshop, and the first two weeks of work are on me.