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.

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:

5601,980=0.283\frac{560}{1{,}980} = 0.283

That is 28.3%28.3\%. In November:

9203,500=0.263\frac{920}{3{,}500} = 0.263

That is 26.3%26.3\%. 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 NcN_c for cohort cc.
  • 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 mm. See Foundations: ratios and rates for the general idea of a rate.

Rc(m)=ac(m)NcR_c(m) = \frac{a_c(m)}{N_c}

where Rc(m)R_c(m) is the cumulative repeat rate of cohort cc at age mm, ac(m)a_c(m) is the number of customers in cohort cc who have placed a second order by the end of month mm (counting from the first order month), and NcN_c is the cohort size. Because a customer who has come back once stays counted, Rc(m)R_c(m) can only rise or stay flat as mm 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:

CohortCustomersMonth 1Month 2Month 3Month 4Month 5Month 6
May 20261,2404.5%7.5%10.5%12.5%14.5%17.5%
June 20261,1804.6%7.8%10.6%12.4%15.6%not yet
July 20261,3104.2%7.1%9.5%12.9%not yetnot yet
August 20261,2904.4%7.3%10.8%not yetnot yetnot yet
September 20261,3504.3%8.4%not yetnot yetnot yetnot yet
October 20261,4205.9%not yetnot yetnot yetnot yetnot 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:

RMay(3)=1301,240=0.105R_{\text{May}}(3) = \frac{130}{1{,}240} = 0.105

So 10.5%10.5\% 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:

CohortUsual step in the month before NovemberStep into NovemberNovember cell
May 20262.0 points (month 4 to 5)3.0 pointsMonth 6, 17.5%
June 20261.8 points (month 3 to 4)3.2 pointsMonth 5, 15.6%
July 20262.4 points (month 2 to 3)3.4 pointsMonth 4, 12.9%
August 20262.9 points (month 1 to 2)3.5 pointsMonth 3, 10.8%
September 20264.3 points (month 0 to 1)4.1 pointsMonth 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 Rc(m)R_c(m) from above.

For the active rate the formula is the same ratio with a different count on top. See Foundations: ratios and rates.

Ac(m)=bc(m)NcA_c(m) = \frac{b_c(m)}{N_c}

where Ac(m)A_c(m) is the active rate of cohort cc in month mm, bc(m)b_c(m) is the number of customers from cohort cc who placed at least one order in calendar month (cohort month plus mm), and NcN_c 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:

MonthCustomers who ordered in the monthActive rateCumulative repeat rate
Month 1 (June)564.5%4.5%
Month 2 (July)453.6%7.5%
Month 3 (August)473.8%10.5%
Month 4 (September)322.6%12.5%
Month 5 (October)352.8%14.5%
Month 6 (November)524.2%17.5%

Month 2 as an active rate:

AMay(2)=451,240=0.036A_{\text{May}}(2) = \frac{45}{1{,}240} = 0.036

So 3.6%3.6\% 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:

RMay(2)=56+371,240=931,240=0.075R_{\text{May}}(2) = \frac{56 + 37}{1{,}240} = \frac{93}{1{,}240} = 0.075

That is 7.5%7.5\%, 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:

Line chart of the cumulative repeat rate by months since the first order, Shannonside Home invented example. The January to October 2025 cohorts reach 5.0% after one month, 12.1% after three, 18.0% after six and 28.0% after twelve. The January to June 2026 cohorts reach 4.4%, 7.6%, 10.8%, 12.6% and 14.4% in months one to five, about 1.3 to 1.6 points below 2025 at each age. The November 2025 Black Friday cohort reaches only 6.2% after three months and 16.1% after twelve, with a jump in its twelfth month, November 2026. Tap or click to open full screen and move around

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:

10.8−12.112.1=−0.107\frac{10.8 - 12.1}{12.1} = -0.107

So 2026's customers come back about 11%11\% 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.

Rˉ(m)=∑cac(m)∑cNc\bar{R}(m) = \frac{\sum_{c} a_c(m)}{\sum_{c} N_c}

where Rˉ(m)\bar{R}(m) is the pooled cumulative repeat rate at age mm, ∑c\sum_{c} adds up over all cohorts in the pool, ac(m)a_c(m) is the number of repeat customers of cohort cc by month mm, and NcN_c is the size of cohort cc. Only cohorts old enough to have reached month mm 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:

12.0+6.22=9.1\frac{12.0 + 6.2}{2} = 9.1

That is 9.1%9.1\%. The pooled rate:

Rˉ(3)=142+1641,180+2,640=3063,820=0.080\bar{R}(3) = \frac{142 + 164}{1{,}180 + 2{,}640} = \frac{306}{3{,}820} = 0.080

The two methods give 9.1%9.1\% and 8.0%8.0\%. 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 mm: all orders the cohort has placed up to month mm, first orders included, divided by the cohort size.
  • Revenue per customer by month mm: all revenue from the cohort up to month mm, 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.

Vc(m)=∑o∈Oc(m)roNcV_c(m) = \frac{\sum_{o \in O_c(m)} r_o}{N_c}

where Vc(m)V_c(m) is the cumulative revenue per customer of cohort cc by month mm, Oc(m)O_c(m) is the set of all orders placed by members of cohort cc from their first order to the end of month mm, ror_o is the revenue of order oo, and NcN_c is the cohort size. Swap ror_o 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:

1,5951,100=1.45\frac{1{,}595}{1{,}100} = 1.45

That is 1.451.45 orders per customer. Revenue per customer, including VAT:

VJan 2025(12)=133,9801,100=121.80V_{\text{Jan 2025}}(12) = \frac{133{,}980}{1{,}100} = 121.80

So V=121.80V = 121.80: 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:

495308=1.61\frac{495}{308} = 1.61

So a customer who comes back at all places about 1.61.6 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.

LineAmount
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:

0.65×22.44+0.35×15.75=20.100.65 \times 22.44 + 0.35 \times 15.75 = 20.10

That is 20.1020.10 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.

CCc(m)=∑o∈Oc(m)koNc,CACc=ScNcCC_c(m) = \frac{\sum_{o \in O_c(m)} k_o}{N_c}, \qquad \text{CAC}_c = \frac{S_c}{N_c}

where CCc(m)CC_c(m) is the cumulative contribution per customer of cohort cc by month mm, kok_o is the contribution of order oo, Oc(m)O_c(m) and NcN_c are as before, CACc\text{CAC}_c is the blended new customer acquisition cost of cohort cc, and ScS_c is the ad spend in the cohort's first month. The payback month is the first month mm in which CCc(m)≥CACcCC_c(m) \geq \text{CAC}_c.

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:

CAC=14,1501,150=12.30\text{CAC} = \frac{14{,}150}{1{,}150} = 12.30

So each customer cost 12.3012.30 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:

CC(12)=20.10+0.45×22.44=30.20CC(12) = 20.10 + 0.45 \times 22.44 = 30.20

So the ordinary cohort has earned 30.2030.20 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:

CACNov 2025=44,8002,640=16.97\text{CAC}_{\text{Nov 2025}} = \frac{44{,}800}{2{,}640} = 16.97

That is 16.9716.97 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:

CCNov 2025(12)=5.73+0.25×22.44=11.34CC_{\text{Nov 2025}}(12) = 5.73 + 0.25 \times 22.44 = 11.34

11.3411.34 euro is still below the 16.9716.97 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.

Line chart of cumulative contribution per customer by months since the first order, Shannonside Home invented example. An ordinary 2025 cohort starts at €20.10 on the first order and reaches €30.20 by month twelve, always above its acquisition cost of €12.30. The November 2025 Black Friday cohort starts at €5.73 and reaches €11.34 by month twelve, still below its acquisition cost of €16.97. Tap or click to open full screen and move around

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

Stacked bar chart of Shannonside Home's monthly revenue including VAT from June to November 2026, in thousands of euro, split by customer cohort, invented example. First orders of new customers bring €99.1k, €110.0k, €108.4k, €113.4k, €119.3k and €216.7k. Earlier 2026 cohorts bring €12.2k rising to €17.5k, then €30.3k in November. 2025 cohorts bring €25.1k falling to €19.8k, then €31.5k in November. Cohorts from 2024 and earlier bring €12.2k falling to €9.7k, then €15.4k in November. Tap or click to open full screen and move around

In October, returning customers brought €17.5k plus €19.8k plus €9.7k, which is €47.0k of €166.3k:

47.0166.3=0.283\frac{47.0}{166.3} = 0.283

So 28%28\% 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:

(19.825.1)1/4=0.942\left(\frac{19.8}{25.1}\right)^{1/4} = 0.942

That is a fall of 5.8%5.8\% 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.

Rˉ=∑iwiRi\bar{R} = \sum_{i} w_i R_i

where Rˉ\bar{R} is the pooled repeat rate, ii runs over the channels, wiw_i is the share of new customers who came through channel ii (the shares add up to 1), and RiR_i is the repeat rate of the customers from channel ii.

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 orderShare of new customers 2025Month 3 repeat rate 2025Share of new customers 2026Month 3 repeat rate 2026
Google ads45%12.1%40%12.1%
Meta ads20%7.0%38%6.9%
Newsletter, organic and direct35%15.0%22%15.1%

Within each channel, 2026 customers come back exactly as often as 2025 customers. Now the pooled rates. For 2025:

Rˉ2025=0.45×12.1+0.20×7.0+0.35×15.0=5.45+1.40+5.25=12.1\bar{R}_{2025} = 0.45 \times 12.1 + 0.20 \times 7.0 + 0.35 \times 15.0 = 5.45 + 1.40 + 5.25 = 12.1

That is 12.1%12.1\%. For 2026:

Rˉ2026=0.40×12.1+0.38×6.9+0.22×15.1=4.84+2.62+3.32=10.8\bar{R}_{2026} = 0.40 \times 12.1 + 0.38 \times 6.9 + 0.22 \times 15.1 = 4.84 + 2.62 + 3.32 = 10.8

The whole 1.31.3 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:

Bar chart of the twelve month repeat rate by the category of the first order, Shannonside Home 2025 cohorts, invented example. Ceramics 34%, kitchen textiles 31%, lamps 22%, small furniture 14%. Tap or click to open full screen and move around

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 categoryCustomersFirst order valueFirst order contributionExtra orders per customerTwelve month contribution per customer
Ceramics4,600€54€14.430.54€26.63
Kitchen textiles3,100€58€15.490.50€26.62
Lamps2,400€99€26.450.35€34.35
Small furniture1,400€210€44.100.22€49.13

Work through the lamp row. The first order leaves:

99×22.4484=26.4599 \times \frac{22.44}{84} = 26.45

22% of lamp customers come back, each with 1.6 orders, so the extra orders per customer are 0.22×1.6=0.3520.22 \times 1.6 = 0.352, worth 0.352×22.44=7.900.352 \times 22.44 = 7.90. Together:

26.45+7.90=34.3526.45 + 7.90 = 34.35

So 34.3534.35 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 orderShare of customersRepeat rate after twelve monthsFirst order contributionTwelve month contribution per customer
With WELCOME1035%24%€15.75€24.37
At full price65%30%€22.44€33.21

The code row in full. Extra orders per customer: 0.24×1.6=0.3840.24 \times 1.6 = 0.384, worth 0.384×22.44=8.620.384 \times 22.44 = 8.62. Plus the first order:

15.75+8.62=24.3715.75 + 8.62 = 24.37

The full price row: 0.30×1.6=0.480.30 \times 1.6 = 0.48 extra orders, worth 10.7710.77, plus €22.44, which makes €33.21.

Check that the split adds up to the pool: 0.35×24+0.65×30=27.90.35 \times 24 + 0.65 \times 30 = 27.9, 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:

ChannelRepeat rate, phone firstRepeat rate, desktop firstShare of channel on phone
Google ads27%30%55%
Meta ads17%18%88%
Newsletter, organic and direct34%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.

Ic(m)=100×Rc(m)Rˉref(m)I_c(m) = 100 \times \frac{R_c(m)}{\bar{R}_{\text{ref}}(m)}

where Ic(m)I_c(m) is the index of cohort cc at age mm, Rc(m)R_c(m) is its cumulative repeat rate, and Rˉref(m)\bar{R}_{\text{ref}}(m) 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%:

INov 2025(3)=100×6.212.1=51I_{\text{Nov 2025}}(3) = 100 \times \frac{6.2}{12.1} = 51

With an index of 5151, 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%:

INov 2025(11)=100×13.626.3=52I_{\text{Nov 2025}}(11) = 100 \times \frac{13.6}{26.3} = 52

At month 12 the index jumps to 100×16.1/28.0=58100 \times 16.1 / 28.0 = 58, 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.

p^±1.96p^(1−p^)n\hat{p} \pm 1.96 \sqrt{\frac{\hat{p}(1 - \hat{p})}{n}}

where p^\hat{p} is the observed rate as a fraction (0.069 for 6.9%), nn 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:

(p^1−p^2)±1.96p^1(1−p^1)n1+p^2(1−p^2)n2(\hat{p}_1 - \hat{p}_2) \pm 1.96 \sqrt{\frac{\hat{p}_1(1 - \hat{p}_1)}{n_1} + \frac{\hat{p}_2(1 - \hat{p}_2)}{n_2}}

where p^1\hat{p}_1 and p^2\hat{p}_2 are the two rates and n1n_1 and n2n_2 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:

1.960.069×0.931494=1.96×0.0114=0.0221.96 \sqrt{\frac{0.069 \times 0.931}{494}} = 1.96 \times 0.0114 = 0.022

That is plus or minus 2.22.2 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.

1.960.069×0.9312,964=1.96×0.00466=0.0091.96 \sqrt{\frac{0.069 \times 0.931}{2{,}964}} = 1.96 \times 0.00466 = 0.009

Now the margin is 0.90.9 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 −0.8-0.8 points, and its margin:

1.960.062×0.9382,640+0.070×0.9302,100=1.96×0.00728=0.0141.96 \sqrt{\frac{0.062 \times 0.938}{2{,}640} + \frac{0.070 \times 0.930}{2{,}100}} = 1.96 \times 0.00728 = 0.014

The interval runs from −0.8−1.4=−2.2-0.8 - 1.4 = -2.2 to −0.8+1.4=0.6-0.8 + 1.4 = 0.6 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_at is the moment the order was placed (it stays empty for baskets that were never checked out), state holds the order state such as complete or canceled, while email and user_id identify the customer, and total, item_total, promo_total, included_tax_total and additional_tax_total hold the money.
  • spree_line_items: one row per product line, with order_id, quantity, price, cost_price, promo_total and included_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:

  • orders keeps only placed, uncancelled orders and gives each one a customer key and an Irish time.
  • ranked numbers each customer's orders with row_number and finds the first order month with min. Both are window functions, which calculate across one customer's rows without collapsing them10.
  • sizes counts each cohort's customers. second_orders works out the month of age of every second order: years between the two months times 12, plus the remaining months.
  • grid builds every cohort and month pair from 1 to 12 with generate_series11 and keeps only complete months, so young cohorts never show zeros for months that have not happened.
  • The final SELECT counts 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

Tap or click to open full screen and move around

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.

If you want to know whether the customers you win today are worth more or less than last year's, book the free workshop: we build your first cohort table from your own orders together, and the first two weeks of work are on me.

Sources

  1. 1.

    Norman B. Ryder, The cohort as a concept in the study of social change, American Sociological Review, volume 30, number 6, 1965, reprinted in William M. Mason and Stephen E. Fienberg (editors), Cohort Analysis in Social Research, Springer, 1985, pages 9 to 44, https://ideas.repec.org/h/spr/sprchp/978-1-4613-8536-3_2.html

  2. 2.

    Columbia University Mailman School of Public Health, Age period cohort analysis, Population Health Methods, https://www.publichealth.columbia.edu/research/population-health-methods/age-period-cohort-analysis

  3. 3.

    Google, [GA4] Cohort exploration, Analytics Help, https://support.google.com/analytics/answer/9670133

  4. 4.

    Revenue, Current VAT rates, Revenue Commissioners, checked 22 November 2026, https://www.revenue.ie/en/vat/vat-rates/search-vat-rates/current-vat-rates.aspx

  5. 5.

    Michael Lewis, Customer acquisition promotions and customer asset value, Journal of Marketing Research, volume 43, number 2, pages 195 to 203, 2006, abstract at https://www.iaorifors.com/paper/53212

  6. 6.

    Eric T. Anderson and Duncan I. Simester, Long run effects of promotion depth on new versus established customers: three field studies, Marketing Science, volume 23, number 1, pages 4 to 20, 2004, https://ideas.repec.org/a/inm/ormksc/v23y2004i1p4-20.html

  7. 7.

    Solidus, core database schema migration solidus_one_four (tables spree_orders, spree_line_items, spree_payments, spree_refunds), GitHub, checked 22 November 2026, https://github.com/solidusio/solidus/blob/main/core/db/migrate/20160101010000_solidus_one_four.rb

  8. 8.

    Solidus, Spree::Order model (scopes complete and canceled), GitHub, checked 22 November 2026, https://github.com/solidusio/solidus/blob/main/core/app/models/spree/order.rb

  9. 9.

    The PostgreSQL Global Development Group, Date/time functions and operators (date_trunc, age, make_interval, AT TIME ZONE), PostgreSQL documentation, https://www.postgresql.org/docs/current/functions-datetime.html

  10. 10.

    The PostgreSQL Global Development Group, Window functions, PostgreSQL tutorial, https://www.postgresql.org/docs/current/tutorial-window.html

  11. 11.

    The PostgreSQL Global Development Group, Set returning functions (generate_series), PostgreSQL documentation, https://www.postgresql.org/docs/current/functions-srf.html

  12. 12.

    Solidus, Spree::LineItem model (total_before_tax and total_excluding_vat), GitHub, checked 22 November 2026, https://github.com/solidusio/solidus/blob/main/core/app/models/spree/line_item.rb