Cohort analysis for online shops: are the customers you win today better or worse than last year's?
TL;DR
Difficulty: Intermediate
Blended numbers move with the mix of customers, so they cannot say whether new customers are better or worse. Group customers by the month of their first order and compare cohorts only at the same age.
- Read the cohort table along rows (one cohort's life), down columns (cohorts at the same age) and along diagonals (calendar effects such as Black Friday).
- Pool cohorts by adding customers, never by averaging rates, and go from repeat rate to contribution per customer against CAC.
- Cut by channel, first product, discount and device: a fall in the total is often a change in the mix, not in the customers.
- Check every difference against its margin of error, and build it all with two SQL queries on your own Solidus orders.
What to read first
Most shop dashboards cannot tell you whether the customers you win this year are better or worse than last year's, because every number on them mixes all customers together. Cohort analysis fixes that by following each month's new customers through their own life with the shop. This chapter shows how to build the table from your own orders, read it in three directions, and turn it into decisions about channels, discounts and Black Friday.
The blended number that cannot answer the question
"Are the customers I win today better or worse than the ones I won last year?" It sounds like a simple question. Most shop dashboards cannot answer it, because every number on them mixes all customers together: the ones who found you last week and the ones who have bought from you since 2021.
Take the share of orders from returning customers. If it falls, your customers may have become less loyal. Or you simply won a lot of new customers, so the old ones are a smaller slice of a bigger pie. A blended number moves with the mix of customers as much as with their behaviour, and it cannot tell you which.
Cohort analysis is the fix. You split customers into groups by when you won them, follow each group through its own life with the shop, and compare like with like: this year's customers after three months against last year's customers after three months.
This chapter covers the cohort table and the three directions to read it in, retention, revenue and contribution per cohort, the cuts by channel, first product, discount and device, the Black Friday cohort, noise, and the SQL that builds it all from a Solidus database. How to draw a cohort chart cleanly is covered in charts for analytics and marketing.
Example: Shannonside Home's returning share falls, and nothing is wrong
Shannonside Home is the invented example shop of this series: an online homeware shop in Limerick at shannonsidehome.example, run by Niamh, with Callum as her developer. It sells ceramics, kitchen textiles, lamps and small furniture. The example's baseline: 110,000 sessions a month, a conversion rate of 1.8%, so about 1,980 orders a month, an average order value (AOV) of €84, a gross margin of 52% on product, a return rate of 9%, and €16,500 a month on Google and Meta ads. 28% of first time customers buy again within twelve months.
In October 2026 Shannonside Home took 1,980 orders. 1,420 of them were first orders from new customers, and 560 came from returning customers. In November, with Black Friday, it took 3,500 orders: 2,580 from new customers and 920 from returning customers.
The returning share in October:
That is . In November:
That is . Niamh's dashboard shows the returning share falling from 28.3% to 26.3% and paints it red. Yet 920 returning orders is 64% more than 560. The share fell only because new customers grew even faster. The blended number told the opposite of the truth.
A cohort is a group of customers who started at the same time
A cohort is a group of people who share a starting point. The word comes from demography and sociology, where Norman Ryder described the cohort as the group of people who experience the same event in the same period, such as being born in the same year, and showed why following such groups through time reveals change that a snapshot hides1.
In a shop, the most useful starting point is the first order. An acquisition cohort is every customer whose first order fell in the same calendar month, whether they ever came back or not. Each customer belongs to exactly one cohort, for life, so a cohort never changes its members. That is what makes the comparison fair.
Two more terms, because the rest of the chapter uses them:
- Cohort size: the number of customers in the cohort, written for cohort .
- Cohort age, or month number: how many full calendar months have passed since the cohort's first order month. Month 0 is the month of the first order itself, month 1 is the next calendar month, and so on.
Example: three Shannonside Home customers placed in their cohorts
- Amira first ordered a set of mugs on 3 May 2026. She ordered a tea towel set on 19 July. She belongs to the May 2026 cohort, and her second order came in month 2 (July is two calendar months after May).
- Ben first ordered a floor lamp on 30 May 2026 and never came back. He also belongs to the May 2026 cohort. He counts in the cohort size forever, even though he has no second order.
- Chloe first ordered on 1 June 2026, two days after Ben. She belongs to the June 2026 cohort.
Amira's July order is month 2 for her, while for Chloe a July order would be month 1. The calendar month and the cohort age are different clocks. Keeping them apart is the whole skill of reading a cohort table.
The cohort table: one row per cohort, one column per month of age
The standard way to lay cohorts out is a cohort table:
- each row is one cohort (May 2026, June 2026, and so on), with its size.
- each column is a cohort age (month 1, month 2, month 3 and onwards).
- each cell holds one number for that cohort at that age, for example the share of the cohort that has ordered again.
Because young cohorts have not lived as long as old ones, the table is a triangle. The oldest cohort has the most columns filled, the newest has one. The empty cells are not zeros. They are months that have not happened yet. Treating them as zero is the most common mistake in cohort reports, and it makes every new cohort look terrible. The same goes for totals: "revenue per 2026 customer so far" always looks worse than "per 2025 customer", because the 2026 customers have had less time. Statisticians call this censoring, and the fix is to compare cohorts only at equal ages. For modelling the full curve from incomplete data, see survival analysis, churn and customer lifetime value.
The number in each cell needs a precise definition. The most useful one for a shop is the cumulative repeat rate: the share of the cohort that has placed at least a second order by the end of month . See Foundations: ratios and rates for the general idea of a rate.
where is the cumulative repeat rate of cohort at age , is the number of customers in cohort who have placed a second order by the end of month (counting from the first order month), and is the cohort size. Because a customer who has come back once stays counted, can only rise or stay flat as grows.
Example: Shannonside Home's cohort table at the end of November 2026
Callum builds the table on 1 December 2026, so November is the last complete month. These are the example's numbers, cumulative repeat rates:
| Cohort | Customers | Month 1 | Month 2 | Month 3 | Month 4 | Month 5 | Month 6 |
|---|---|---|---|---|---|---|---|
| May 2026 | 1,240 | 4.5% | 7.5% | 10.5% | 12.5% | 14.5% | 17.5% |
| June 2026 | 1,180 | 4.6% | 7.8% | 10.6% | 12.4% | 15.6% | not yet |
| July 2026 | 1,310 | 4.2% | 7.1% | 9.5% | 12.9% | not yet | not yet |
| August 2026 | 1,290 | 4.4% | 7.3% | 10.8% | not yet | not yet | not yet |
| September 2026 | 1,350 | 4.3% | 8.4% | not yet | not yet | not yet | not yet |
| October 2026 | 1,420 | 5.9% | not yet | not yet | not yet | not yet | not yet |
Take one cell and work it through. The May 2026 cohort has 1,240 customers. By the end of August 2026 (month 3), 130 of them had placed a second order:
So of the May customers had come back within three months. The October row has one cell, because October's customers have lived through only one complete month after their first, November. Its other cells say "not yet", never 0%.
Read the table three ways: rows, columns and diagonals
A cohort table answers three different questions depending on the direction you read it in.
Along a row you see one cohort's life: how quickly the May customers came back over six months. This is the shape of retention, and it is what chapter 4, repeat purchase and churn when customers never cancel, models in depth.
Down a column you compare cohorts at the same age: all six cohorts after one month, or the five cohorts old enough to have a month 2. This is the answer to the question in the title. If later cohorts are lower in the same column, the customers you win now come back less than the ones you won before.
Along a diagonal, from bottom left to top right, you see one calendar month. In the table above, the last filled cell of every row is November 2026: May's month 6, June's month 5, July's month 4, August's month 3, September's month 2 and October's month 1. Anything that happened in the calendar, a sale, a postal strike, a broken checkout, shows up as a stripe along a diagonal, hitting every cohort at once.
Demographers call this the age, period and cohort problem. The calendar month is always the cohort month plus the age, so the three can never be fully separated by arithmetic alone, only with judgement or extra assumptions2. The practical rule: before you blame or praise a cohort, check whether the whole diagonal moved.
Example: the November stripe in Shannonside Home's table
Look at the step each cohort takes into its November cell, compared with its usual monthly step:
| Cohort | Usual step in the month before November | Step into November | November cell |
|---|---|---|---|
| May 2026 | 2.0 points (month 4 to 5) | 3.0 points | Month 6, 17.5% |
| June 2026 | 1.8 points (month 3 to 4) | 3.2 points | Month 5, 15.6% |
| July 2026 | 2.4 points (month 2 to 3) | 3.4 points | Month 4, 12.9% |
| August 2026 | 2.9 points (month 1 to 2) | 3.5 points | Month 3, 10.8% |
| September 2026 | 4.3 points (month 0 to 1) | 4.1 points | Month 2, 8.4% |
Every cohort but the youngest took a bigger step into November than into the month before. That is a diagonal: Black Friday brought customers of every age back at once. August's month 3 is 10.8%, higher than July's 9.5% and May's 10.5%. Is August a better cohort? No. August's month 3 happens to be November. The calendar flattered it. The fair comparison for August is its month 2, 7.3%, against May's 7.5% and June's 7.8%, which says August is, if anything, slightly weaker.
October's 5.9% in month 1, against 4.2% to 4.6% for the others, is also mostly November talking.
Three ways to count retention, and when to use each
"Retention" in a cohort table can mean three different things, and tools do not always say which one they show. Google Analytics 4 offers all three in its cohort exploration as calculation options: standard, rolling and cumulative3.
- Standard (active in the month): the share of the cohort that ordered in that month. A customer who ordered in month 2 and month 5 counts in those two months only. This shows the rhythm of buying, and it goes up and down.
- Rolling: the share that ordered in that month and in every earlier month. It fits a subscription box. For a homeware shop it is near zero, because nobody buys a lamp every month.
- Cumulative: the share of the cohort that has met the condition in any month up to this one. With "placed a second order" as the condition, this is the cumulative repeat rate from above.
For the active rate the formula is the same ratio with a different count on top. See Foundations: ratios and rates.
where is the active rate of cohort in month , is the number of customers from cohort who placed at least one order in calendar month (cohort month plus ), and is the cohort size.
One caution about GA4: its cohorts are built from consenting browsers and devices, not from customers in your order database, so one customer on two devices can be two users. For a cohort table you steer by, use the shop's own orders. Is your dashboard lying to you explains the consent gaps.
Example: the May cohort counted three ways
The May 2026 cohort has 1,240 customers. Callum counts, for each month, how many of them ordered in that month:
| Month | Customers who ordered in the month | Active rate | Cumulative repeat rate |
|---|---|---|---|
| Month 1 (June) | 56 | 4.5% | 4.5% |
| Month 2 (July) | 45 | 3.6% | 7.5% |
| Month 3 (August) | 47 | 3.8% | 10.5% |
| Month 4 (September) | 32 | 2.6% | 12.5% |
| Month 5 (October) | 35 | 2.8% | 14.5% |
| Month 6 (November) | 52 | 4.2% | 17.5% |
Month 2 as an active rate:
So of the cohort ordered in July. Why does the active column not add up to the cumulative column? Because some customers order in more than one month. In month 2, 45 customers ordered, but only 37 of them were ordering for the second time ever. The other eight had already come back in month 1. So the count of repeat customers rose by 37, from 56 to 93:
That is , the figure in the table. The cumulative repeat rate answers "how many have we turned into repeat customers so far", the right question for comparing cohorts. The active rate answers "how many are buying right now", the right question for planning stock and emails.
Better or worse than last year: compare whole years at the same age
Now the question in the title can be answered properly. Take all the cohorts of last year, take all the cohorts of this year, and compare them column by column: month 1 against month 1, month 3 against month 3. Never compare this year's cohorts at month 3 with last year's at month 12, and never compare calendar months.
A whole year of cohorts pooled together smooths out noise and diagonals. Leave the Black Friday cohort out of the pool and look at it on its own, because one giant, unusual cohort would otherwise dominate the year.
Example: Shannonside Home's 2025 customers against its 2026 customers
Callum pools the January to October 2025 cohorts (11,500 customers, every one of them at least twelve months old by now) and the January to June 2026 cohorts (7,800 customers, all at least five months old). He draws the cumulative repeat rate by month of age, with the November 2025 Black Friday cohort as a third line:
At every age the 2026 line runs below the 2025 line. After three months, 12.1% of 2025's customers had come back, and 10.8% of 2026's. The gap is 1.3 percentage points, and in relative terms:
So 2026's customers come back about less often than 2025's at the same age. That is the honest answer to Niamh's question: the customers she wins this year are somewhat worse, measured by how often they return. The next sections find out why, and whether "worse" is the right word.
Pool cohorts by adding up customers, not by averaging rates
There are two ways to combine cohorts into one line. The tempting way is to average the cohort rates: add up the percentages and divide by the number of cohorts. That gives every cohort the same weight, whether it had 300 customers or 3,000. The right way for "what share of our customers come back" is to pool: add up the repeat customers of all cohorts and divide by the total number of customers. See Foundations: mean for the weighted mean.
where is the pooled cumulative repeat rate at age , adds up over all cohorts in the pool, is the number of repeat customers of cohort by month , and is the size of cohort . Only cohorts old enough to have reached month may be in the pool for that month, otherwise the empty cells drag the rate down.
Example: October 2025 and the Black Friday cohort, pooled two ways
The October 2025 cohort had 1,180 customers, and 12.0% of them had come back by month 3, which is 142 people. The November 2025 Black Friday cohort had 2,640 customers, and 6.2% had come back by month 3, which is 164 people.
The average of the two rates:
That is . The pooled rate:
The two methods give and . The pooled 8.0% is the true share of these 3,820 customers who came back within three months. The 9.1% overweights the small October cohort. Neither is wrong as arithmetic, but only the pooled figure answers a question about customers. It also shows why Callum keeps the Black Friday cohort out of the 2025 pool: one cohort of 2,640 would pull the whole year's line down and hide what the ordinary months did.
Orders and revenue per customer: retention is only the first column
The repeat rate says how many customers come back, not how often they buy once they do or how much they spend. Two more cumulative measures fill that in:
- Orders per customer by month : all orders the cohort has placed up to month , first orders included, divided by the cohort size.
- Revenue per customer by month : all revenue from the cohort up to month , divided by the cohort size.
Both are cumulative, so they grow along a row and can be compared down a column, just like the repeat rate. See Foundations: ratios and rates.
where is the cumulative revenue per customer of cohort by month , is the set of all orders placed by members of cohort from their first order to the end of month , is the revenue of order , and is the cohort size. Swap for 1 and you get orders per customer.
Pick one revenue definition, with or without VAT, before or after refunds, and keep it everywhere. The example uses order value including VAT, to match its €84 AOV. The eCommerce metrics glossary sets out the options.
Example: twelve months of the January 2025 cohort
The January 2025 cohort has 1,100 customers. In the twelve months to the end of January 2026, they placed 1,595 orders in total, first orders included, worth €133,980 including VAT.
Orders per customer:
That is orders per customer. Revenue per customer, including VAT:
So : the average January 2025 customer spent €121.80 in their first year, €84 on the first order and €37.80 on later ones. Of those 1,100 customers, 28% (308 people) came back, and the 495 repeat orders came from them:
So a customer who comes back at all places about more orders within the year. That number is worth knowing: it says the problem, if there is one, is getting the second order, not the third.
Contribution per cohort: the number that pays for the customer
Revenue per customer still does not tell you whether a customer was worth winning. For that you need what each order leaves after all the costs that come with it, the contribution. Chapter 2, unit economics and contribution margin per order, works this out line by line for the example's average order, and this chapter takes its result: €22.44 per order before marketing.
| Line | Amount |
|---|---|
| Customer pays, including VAT | €84.00 |
| VAT at the Irish standard rate of 23%4 | €15.71 |
| Net revenue | €68.29 |
| Cost of goods | €32.78 |
| Payment fees (1.7%) | €1.43 |
| Fulfilment (carrier, packaging, pick and pack) | €7.50 |
| Expected cost of returns | €4.14 |
| Contribution per order before marketing | €22.44 |
The example treats an order at the average value as the full price case. A first order with the 10% welcome code loses a further €8.40 of order value, which is €6.83 of net revenue, and saves €0.14 of payment fees, so it leaves €15.75. In 2025, 35% of new customers used the code, so the average first order left:
That is euro of contribution on the average first order. Now the cohort measure. Cumulative contribution per customer adds up the contribution of every order the cohort has placed and divides by the cohort size. Set it against what you paid to win each customer, the customer acquisition cost (CAC). Here I use the simplest form, the blended new customer CAC: all ad spend in the cohort's month divided by the number of new customers that month. Chapter 3, customer acquisition cost, payback and LTV to CAC, covers what else belongs in the numerator. See Foundations: ratios and rates.
where is the cumulative contribution per customer of cohort by month , is the contribution of order , and are as before, is the blended new customer acquisition cost of cohort , and is the ad spend in the cohort's first month. The payback month is the first month in which .
Example: an ordinary 2025 cohort against the Black Friday cohort
The ordinary 2025 cohort. An average month in 2025 had €14,150 of ad spend and 1,150 new customers:
So each customer cost euro to win. Its first orders already leave €20.10 per customer, so the cohort pays back its CAC in month 0, on the first order. By month 12, with 0.45 extra orders per customer at €22.44 each:
So the ordinary cohort has earned euro per customer after a year.
The Black Friday cohort, November 2025. Ad spend that month was €44,800, because Black Friday auctions are expensive, and it brought 2,640 new customers:
That is euro per customer. Every one of them bought with the 25% sitewide Black Friday discount. On an €84 basket that is €21 off including VAT, or €17.07 of net revenue, and the payment fee falls by €0.36, so the first order leaves €22.44 minus €17.07 plus €0.36, which is €5.73. By month 12 the cohort had placed 0.25 extra orders per customer:
euro is still below the it cost to win each of them. A year later, the Black Friday cohort has not paid for itself, while an ordinary cohort paid for itself on day one.
The revenue report called November 2025 the best month of the year. The cohort report shows it bought customers who, a year on, still cost more than they have returned.
The layer cake: how much of this month's revenue old customers bring
One chart turns cohorts back to the calendar on purpose: the layer cake. Each month's revenue is a bar, stacked by the cohort the buyers belong to. The bottom layers are your customer base paying you again, the top layer is what you bought this month. It shows how dependent revenue is on winning new customers, and how fast each year's layer thins out.
Example: Shannonside Home's revenue from June to November 2026, by cohort
In October, returning customers brought €17.5k plus €19.8k plus €9.7k, which is €47.0k of €166.3k:
So of October's revenue came from customers won before October. The 2025 layer fell from €25.1k in June to €19.8k in October. As a monthly rate:
That is a fall of a month, while the 2026 layer grew by about the same amount in money. Shannonside Home is replacing its old customers' spending, not adding to it. A shop whose bottom layers thicken each year is building an asset. One whose bottom layers stay flat rents its revenue from the ad platforms every month.
Cohorts by channel: the mix explains more than the customers
The most useful next cut is by acquisition channel: where each customer came from for the first order. Different channels bring different people, who come back at different rates. To cut by channel, the shop must store the channel with the order, in its own database. Ad platforms cannot do it, because they do not know who came back months later. The tracking series shows how to capture this reliably in the shop database as the source of truth, and attribution for online shops explains which channel to credit when there were several.
Channel cohorts also expose Simpson's paradox: every group can stay the same while the total gets worse, because the mix changed. Statistical thinking for growth explains it in general. The pooled rate is a weighted mean of the channel rates. See Foundations: mean.
where is the pooled repeat rate, runs over the channels, is the share of new customers who came through channel (the shares add up to 1), and is the repeat rate of the customers from channel .
Example: Shannonside Home's year on year gap is a channel mix
Callum splits the 2025 and 2026 pools by the channel of the first order and compares the month 3 repeat rate:
| Channel of first order | Share of new customers 2025 | Month 3 repeat rate 2025 | Share of new customers 2026 | Month 3 repeat rate 2026 |
|---|---|---|---|---|
| Google ads | 45% | 12.1% | 40% | 12.1% |
| Meta ads | 20% | 7.0% | 38% | 6.9% |
| Newsletter, organic and direct | 35% | 15.0% | 22% | 15.1% |
Within each channel, 2026 customers come back exactly as often as 2025 customers. Now the pooled rates. For 2025:
That is . For 2026:
The whole point fall comes from the mix. In 2026 Niamh moved budget to Meta, and Meta brought nearly twice the share of new customers, who come back about half as often as Google's. So the honest answer is more precise than "this year's customers are worse": the customers from each channel are as good as ever, and she is buying more of the kind that comes back less. Whether that is a mistake depends on what each channel's customers cost and leave, the subject of ROAS, POAS and MER.
Cohorts by first product: what the first basket says
The first thing a customer buys says a lot about whether they will come back. Someone who starts with a mug may return for the matching bowls. Someone who starts with a sideboard may not need another for ten years. The trap is to rank first products by repeat rate alone: a category with a low repeat rate can still bring the most valuable customers if the first order is large. Always set the repeat rate next to the twelve month contribution per customer.
Example: mugs come back, sideboards pay
Callum splits the 2025 pool (11,500 customers) by the category of the largest item in the first order:
Now the contribution. The example keeps it simple: a first order leaves about 26.7% of its value including VAT as contribution (€22.44 of €84), except small furniture, where bulky shipping and a higher return rate cut it to 21%. A repeat customer places 1.6 more orders a year, each leaving €22.44.
| First category | Customers | First order value | First order contribution | Extra orders per customer | Twelve month contribution per customer |
|---|---|---|---|---|---|
| Ceramics | 4,600 | €54 | €14.43 | 0.54 | €26.63 |
| Kitchen textiles | 3,100 | €58 | €15.49 | 0.50 | €26.62 |
| Lamps | 2,400 | €99 | €26.45 | 0.35 | €34.35 |
| Small furniture | 1,400 | €210 | €44.10 | 0.22 | €49.13 |
Work through the lamp row. The first order leaves:
22% of lamp customers come back, each with 1.6 orders, so the extra orders per customer are , worth . Together:
So euro per lamp customer. The ranking flips. Ceramics customers come back most, but small furniture customers leave the most contribution in their first year, almost twice as much. Ceramics are a good way into the shop for customers who will return. Furniture is worth paying more to acquire, as long as Niamh does not expect those customers back soon. What to send after the first order is the subject of after the purchase, from first order to second.
Cohorts by first order discount: correlation is not the code's fault
Splitting cohorts by whether the first order used a welcome discount almost always shows that discount customers come back less. Lewis studied customer data from a newspaper and an online grocer and found that the deeper the acquisition discount, the lower the repeat rate and the long run value of the customers it brought, with customers won at a 35% discount worth roughly half as much as those won at full price5.
But Anderson and Simester, in three large field experiments with a catalogue retailer, found that deeper discounts increased later purchases by new customers while reducing them for established ones6. Experiments measure what a discount does. A cohort split only shows who chose to use a code.
Customers who use a code are partly different people: more price sensitive, and some would never have bought at full price. A cohort table shows the gap. Only an experiment, where a random part of new visitors sees the code and the rest does not, shows whether the code causes it. Experiments inside your own shop are the subject of feature flags, A/B tests and holdouts, and the maths of each discount is in offers and promotions.
Example: the welcome code at Shannonside Home
In the 2025 pool, 35% of new customers used the 10% code WELCOME10 on their first order. Callum compares them at twelve months:
| First order | Share of customers | Repeat rate after twelve months | First order contribution | Twelve month contribution per customer |
|---|---|---|---|---|
| With WELCOME10 | 35% | 24% | €15.75 | €24.37 |
| At full price | 65% | 30% | €22.44 | €33.21 |
The code row in full. Extra orders per customer: , worth . Plus the first order:
The full price row: extra orders, worth , plus €22.44, which makes €33.21.
Check that the split adds up to the pool: , the 28% of the baseline.
The tempting conclusion is "drop the code, it costs €8.84 per customer". It does not follow. Some of the 35% would not have bought without the code, so dropping it loses them entirely, along with their €24.37. The right next step is a holdout: show the code to a random 80% of first time visitors for eight weeks, hide it from 20%, and compare the two cohorts' conversion rate and their month 3 contribution per visitor. That answers the question the cohort table can only raise.
Cohorts by device: check the channel before you blame the phone
Cutting cohorts by the device of the first order usually shows that phone first customers come back less. It is tempting to read this as "the mobile shop is worse". Often the device is standing in for the channel: social ads are seen mostly on phones. Cross a device cut with the channel before concluding anything.
Example: Shannonside Home's phone gap is mostly Meta
In the 2025 pool, 68% of new customers placed their first order on a phone, 32% on a desktop or laptop. Twelve month repeat rates: 25% for phone first customers, 34% for desktop first customers. A gap of 9 points.
Callum crosses the two cuts:
| Channel | Repeat rate, phone first | Repeat rate, desktop first | Share of channel on phone |
|---|---|---|---|
| Google ads | 27% | 30% | 55% |
| Meta ads | 17% | 18% | 88% |
| Newsletter, organic and direct | 34% | 36% | 62% |
Within each channel, the phone gap shrinks to 1 to 3 points. Most of the 9 points come from Meta customers, who return least and are nearly all on phones. The small gap left in every channel is worth a look at the mobile account and reorder pages, but it is not the 9 points the first cut suggested.
The Black Friday cohort problem
Every November brings a giant cohort that comes back less. Three causes stack:
- Selection: a sitewide discount pulls in people who buy mainly on discount. A good few of them only ever come back for the next big sale.
- Gift buyers: in November and December many first orders are presents. The buyer may have no need for homeware for themselves.
- The first order margin: the discount cuts the first order's contribution, as the contribution chart showed.
A fourth effect distorts the table itself: the cohort's month 12 lands on the next Black Friday, and the deal seekers come back at once. Never judge a Black Friday cohort against October or January. Compare it with last year's Black Friday cohort at the same age, and index it against the ordinary cohorts. See Foundations: indexing and base rates.
where is the index of cohort at age , is its cumulative repeat rate, and is the pooled repeat rate of a reference group, here the ordinary cohorts of the same year, at the same age. 100 means "as good as an ordinary cohort".
Example: Black Friday 2025 indexed
The Black Friday 2025 cohort reached 6.2% at month 3. The ordinary 2025 cohorts reached 12.1%:
With an index of , the Black Friday customers came back at half the rate of the ordinary ones. And at month 11, just before the next Black Friday, they stood at 13.6% against the ordinary 26.3%:
At month 12 the index jumps to , and that jump is the deal seekers returning for Black Friday 2026, not a sudden change in loyalty. The Black Friday 2024 cohort, with 2,100 customers, stood at 7.0% at month 3, an index of 58 against its own year. Whether 2025's lower figure is a real decline is a question about noise, which is next.
Small cohorts are noisy: how big a difference is real
Every rate in a cohort table is an estimate from a limited number of customers, and small slices such as one channel in one month jump around by chance alone. Before acting on a difference, check it against a confidence interval. For one rate, an approximate 95% interval is the rate plus or minus 1.96 standard errors. See Foundations: confidence intervals.
where is the observed rate as a fraction (0.069 for 6.9%), is the number of customers it is based on, and 1.96 is the multiplier for 95% confidence from the normal distribution. To compare two rates, use the interval for their difference:
where and are the two rates and and the two group sizes. If the interval includes zero, the data cannot tell the two apart. These approximations work well once each group has at least a few dozen repeat customers. Foundations: hypothesis tests covers the test behind it.
Example: one Meta month, six Meta months, and two Black Fridays
One month of Meta customers. Shannonside Home wins about 494 customers a month through Meta, and 6.9% come back by month 3. The margin of error:
That is plus or minus points, so one month's Meta cohort could show anything from about 4.7% to 9.1% with nothing changing at all. When the July Meta cohort shows 5.8% and June showed 7.6%, that is not news.
Six months pooled. Pool January to June 2026: 2,964 Meta customers.
Now the margin is points, so the Meta rate is 6.9% plus or minus 0.9. The Google pool of 3,120 customers at 12.1% has a margin of 1.1 points. The two intervals, 6.0% to 7.8% and 11.0% to 13.2%, do not come near each other. The channel gap is real.
Two Black Fridays. 2025's cohort: 6.2% of 2,640. 2024's: 7.0% of 2,100. The difference is points, and its margin:
The interval runs from to points. It includes zero. Despite thousands of customers in each, the data cannot say that Black Friday 2025 brought worse customers than Black Friday 2024. Niamh should not rewrite her November plan on that difference alone.
Building the cohort table in PostgreSQL on a Solidus shop
On a shop built with Ruby on Rails and Solidus, the orders live in a few tables in the database, usually PostgreSQL, and two queries build everything above with no extra tool.
These are the Solidus tables and columns that matter, as the schema defines them7.
spree_orders: one row per order.completed_atis the moment the order was placed (it stays empty for baskets that were never checked out),stateholds the order state such ascompleteorcanceled, whileemailanduser_ididentify the customer, andtotal,item_total,promo_total,included_tax_totalandadditional_tax_totalhold the money.spree_line_items: one row per product line, withorder_id,quantity,price,cost_price,promo_totalandincluded_tax_total.
Two details decide whether the numbers are right. First, Solidus counts an order as complete when completed_at is set, and a cancelled order keeps its completed_at while its state becomes canceled, so the query has to exclude cancelled orders explicitly8. Second, guests check out without a user account, so user_id is empty for them. Using the lower cased email as the customer key joins a customer's guest orders and account orders together, which is what you want for a cohort.
Rails stores completed_at in UTC. For an Irish shop, an order at 00:30 on 1 June Irish Standard Time is still 31 May in UTC, so the query converts the time to Irish time before cutting it into months. The conversion uses AT TIME ZONE, and the month cut uses date_trunc and age, all standard PostgreSQL date functions9.
-- Cumulative repeat rate per cohort and month of age
WITH orders AS (
SELECT
o.id,
lower(o.email) AS customer_key,
(o.completed_at AT TIME ZONE 'UTC') AT TIME ZONE 'Europe/Dublin' AS placed_at
FROM spree_orders o
WHERE o.completed_at IS NOT NULL
AND o.state <> 'canceled'
),
ranked AS (
SELECT
customer_key,
placed_at,
row_number() OVER (PARTITION BY customer_key ORDER BY placed_at, id) AS nth,
date_trunc('month', min(placed_at) OVER (PARTITION BY customer_key)) AS cohort_month
FROM orders
),
sizes AS (
SELECT cohort_month, count(*) AS customers
FROM ranked
WHERE nth = 1
GROUP BY cohort_month
),
second_orders AS (
SELECT
cohort_month,
(extract(year FROM age(date_trunc('month', placed_at), cohort_month)) * 12
+ extract(month FROM age(date_trunc('month', placed_at), cohort_month)))::int AS second_month
FROM ranked
WHERE nth = 2
),
grid AS (
SELECT s.cohort_month, s.customers, m.month_number
FROM sizes s
CROSS JOIN generate_series(1, 12) AS m(month_number)
WHERE s.cohort_month + make_interval(months => m.month_number)
< date_trunc('month', now() AT TIME ZONE 'Europe/Dublin')
)
SELECT
g.cohort_month::date AS cohort,
g.customers,
g.month_number,
round(100.0 * count(so.second_month) / g.customers, 1) AS repeat_rate_pct
FROM grid g
LEFT JOIN second_orders so
ON so.cohort_month = g.cohort_month
AND so.second_month <= g.month_number
GROUP BY g.cohort_month, g.customers, g.month_number
ORDER BY g.cohort_month, g.month_number;
How it works, step by step:
orderskeeps only placed, uncancelled orders and gives each one a customer key and an Irish time.rankednumbers each customer's orders withrow_numberand finds the first order month withmin. Both are window functions, which calculate across one customer's rows without collapsing them10.sizescounts each cohort's customers.second_ordersworks out the month of age of every second order: years between the two months times 12, plus the remaining months.gridbuilds every cohort and month pair from 1 to 12 withgenerate_series11 and keeps only complete months, so young cohorts never show zeros for months that have not happened.- The final
SELECTcounts the customers whose second order came by each month and divides by the cohort size. The result has one row per cell, and any pivot turns it into the triangle.
For contribution per cohort, the query needs each order's contribution. Solidus defines a line item's value without VAT as its amount plus its promotion adjustments minus the VAT included in the price12, so the product margin is that figure minus the cost price. The costs that are not in the database (payment fees, fulfilment, expected returns) go in as the per order figure from your own unit economics, €13.07 in the example (€1.43 plus €7.50 plus €4.14):
-- Cumulative contribution per customer, per cohort and month of age
WITH orders AS (
SELECT
o.id,
lower(o.email) AS customer_key,
(o.completed_at AT TIME ZONE 'UTC') AT TIME ZONE 'Europe/Dublin' AS placed_at
FROM spree_orders o
WHERE o.completed_at IS NOT NULL
AND o.state <> 'canceled'
),
margins AS (
SELECT
li.order_id,
sum(li.price * li.quantity + li.promo_total - li.included_tax_total
- coalesce(li.cost_price, 0) * li.quantity) AS product_margin
FROM spree_line_items li
GROUP BY li.order_id
),
dated AS (
SELECT
o.customer_key,
date_trunc('month', min(o.placed_at) OVER (PARTITION BY o.customer_key)) AS cohort_month,
date_trunc('month', o.placed_at) AS order_month,
m.product_margin - 13.07 AS contribution -- payment fees, fulfilment, returns per order
FROM orders o
JOIN margins m ON m.order_id = o.id
),
cells AS (
SELECT
cohort_month,
(extract(year FROM age(order_month, cohort_month)) * 12
+ extract(month FROM age(order_month, cohort_month)))::int AS month_number,
sum(contribution) AS contribution
FROM dated
GROUP BY 1, 2
),
sizes AS (
SELECT cohort_month, count(DISTINCT customer_key) AS customers
FROM dated
GROUP BY cohort_month
)
SELECT
c.cohort_month::date AS cohort,
s.customers,
c.month_number,
round(sum(c.contribution) OVER (PARTITION BY c.cohort_month ORDER BY c.month_number)
/ s.customers, 2) AS cumulative_contribution_per_customer
FROM cells c
JOIN sizes s USING (cohort_month)
ORDER BY c.cohort_month, c.month_number;
The window sum(...) OVER (PARTITION BY ... ORDER BY ...) adds up the contribution month by month within each cohort, which gives the cumulative line of the contribution chart. Once it works, subtract actual refunds from spree_refunds (joined through spree_payments) so heavy returners show up, as chapter 7, returns in eCommerce, explains, and store the acquisition channel and first category on the cohort, so every cut in this chapter is one more GROUP BY.
Example: checking the query against what Niamh already knows
Callum runs two checks. The May 2026 cohort size of 1,240 matches the first orders in the May order report. And a hand count of May customers with a second order by 31 August gives 130, which divided by 1,240 is 10.5%, as the query says. When a check fails, the usual causes are cancelled orders left in, or one person under two email addresses.
How often to look, and what to do with what you see
A cohort table moves slowly, and looking every day only invites overreaction. The right rhythm for most shops:
- Monthly: read the newest diagonal first, then the newest cell in each column.
- Quarterly: compare this year's and last year's pooled lines, cut by channel and first category, and check CAC against cumulative contribution.
- After every big campaign: index its cohort at month 1, 3, 6 and 12 before running it again.
Example: Niamh's monthly half hour
In December 2026 the half hour goes like this. The newest diagonal, November, jumped for every cohort: Black Friday, noted, nobody blamed. The October cohort's month 1 of 5.9% is above the pooled 4.4%, but that cell sits on the November diagonal, so it waits. The 2026 pool is 1.3 points below 2025 at month 3, which is larger than its margin of error, so Niamh cuts it by channel and finds the Meta mix. Her one action: cap the Meta share of new customers at 30% for the first quarter of 2027, put the freed budget into Google Shopping and the newsletter sign up, and check the month 3 repeat rate of the January to March 2027 cohorts in July. One finding, one action, one date to look again.
The pooled repeat rate and contribution per customer are also two branches of the profit tree in chapter 8, a KPI tree for an online shop, and the same cohort logic underpins the retention maths and bidding on lifetime value.
Conclusion
Blended numbers move with the mix of customers as much as with their behaviour. A cohort table fixes that by grouping customers by the month of their first order and following each group through its own life. Read it along a row for one cohort's life, down a column to compare cohorts at the same age, and along a diagonal to catch calendar effects before you blame a cohort. Pool cohorts by adding customers, not by averaging rates, and go beyond repeat rates to contribution per customer set against what each customer cost to win. Cut by channel, first product, discount and device, and expect the mix to explain more than the customers do. Treat Black Friday as its own cohort, check every difference against its margin of error, and compare only at equal ages. On a Solidus shop it all comes from two queries on your own orders. Look once a month, act on one finding at a time, and "are my customers getting better or worse" becomes a question with a trustworthy answer.