The customer loyalty journey: from segments to experiences
Every October someone at a shop asks what would make more customers come back, and the honest answer is that this is four questions wearing one coat. Who are the customers, by what they do and need rather than where they live? What does each group respond to when price or email moves? How do buying and contact feed each other, so that the email report stops taking credit for intent? And which moments in the experience actually make a person return? Each has its own chapter earlier in this series. Here I assemble them on one running case, my Solidus demo hamper shop The Gift Bow: four segments, a price and email elasticity for each, a pair of simultaneous equations for the loop between repeat purchase and email opens, and a questionnaire that ranks nine experience moments by their effect on real repurchase. You get the tables, the charts, the SQL and Python to build the customer panel, a six month plan with one decision per month, and a plain account of what changes for the business at the end. This is part 19 of 21 of the Marketing Analytics series.
The question every shop owner asks in October
Every autumn the same conversation happens at The Gift Bow, my Solidus demo hamper shop at hampers.keferboeck.com. The Christmas stock is ordered, the delivery slots with the courier are booked, and someone looks at the customer table and says: we have 24,000 people who have bought from us in the last three years, and only 14 percent of them came back last year. What would make more of them come back?
It sounds like one question. It is actually four, and they have to be answered in order. Who are these 24,000 people, not by postcode but by how and why they buy? What does each group respond to when we move price or send more email? How do buying and our contact with them feed each other, so that we do not mistake the echo for the cause? And which moments in ordering, receiving and giving a hamper make a person want to do it again? Each question has its own chapter earlier in this series. This one puts them on the same table, in the order I would actually run them, with a month by month plan. The numbers are illustrative, but the structure is exactly what I do.
Where this sits in the series
This is the last chapter of part four, media and loyalty, which covers chapters 15 to 19. The previous chapter, Loyalty with structural equation modelling, built the rigorous version of the experiences model with latent constructs. This one is the practical assembly: segments, elasticity, a loyalty loop and a questionnaire, welded into one project. Next comes part five, testing and big data, starting with Statistical testing: sample size, lift and full factorial designs, which is how you prove that the changes this project recommends actually worked.
One system, not four projects
The mistake I see most often is that these four pieces get commissioned as four separate projects, by four different people, over three years, and none of them uses the output of the others. Run as one system, each stage produces the input for the next.
The loyalty journey project: segments first, then three analyses that all use the segments, then one test and one dashboard.
The segments are the spine. Elasticity and the loyalty loop are estimated per segment, and the questionnaire is sampled by segment. At the end there is one dashboard that answers one question: is the repeat rate rising in the segments we chose to work on?
Stage one: segments built on behaviour and needs
I wrote about why the strategy has to come before the algorithm in Segmentation: strategy before algorithms, so I will only summarise the rule: segment on what people do and why they do it, never on who they are. Postcode and age tell me nothing about whether someone buys a hamper for their mother or for themselves.
For The Gift Bow the behavioural variables come straight from the order table: days before 25 December the order was placed, whether the shipping name matches the billing name, order value, hampers per order, previous orders and the channel that brought the visit. The needs side comes from a six question survey sent to 1,400 customers, asking why they bought and what would have stopped them. A latent class model on the two together settles on four segments. The method choice is covered in the segmentation tools chapter; the result is what matters here.
| Segment | Share of customers | Share of revenue | Average order | Repeat rate | Typical timing |
|---|---|---|---|---|---|
| Planners | 22% | 38% | £62 | 41% | October to mid November |
| Last minute gifters | 41% | 30% | £54 | 12% | 15 to 22 December |
| Self treaters | 27% | 14% | £38 | 23% | Year round |
| Corporate buyers | 10% | 18% | £410 | 55% | Late November, by quote |
Reading it line by line. Planners are a fifth of the customers and nearly two fifths of the revenue; they buy early, buy again, and the shipping name is almost never their own. Last minute gifters are the biggest group by count and the worst by loyalty; they found us through a search on 18 December and will do the same next year, possibly on someone else's site. Self treaters buy smaller hampers for their own kitchen, all year round. Corporate buyers are few, large and loyal, and they order through a quote form rather than the basket.
Already the original question has changed shape. Raising the overall repeat rate from 14 percent means something completely different for Planners, who are already at 41 percent, than for Last minute gifters at 12 percent.
Stage two: elasticity per segment
The second stage asks what each segment responds to. I estimate a separate log log demand model per segment on weekly data, 156 weeks for three years, which is the same model as in the elasticity chapter, just fitted four times.
Here is the number of orders from segment in week , is the average price paid per hamper by that segment in that week after discounts and adjusted for the mix of hampers, is the number of marketing emails sent per active customer in that segment, is a set of seasonal controls for the weeks before Christmas, Easter and Mother's Day, and is the error. Because both sides are in logs, is the price elasticity of that segment directly: a 1 percent price change moves orders by percent. The same holds for and email.
| Segment | Price elasticity | Email elasticity | What it means in practice |
|---|---|---|---|
| Planners | minus 0.9 | 0.21 | Mildly price sensitive, respond well to email |
| Last minute gifters | minus 0.5 | 0.04 | Do not care about price, do not read email |
| Self treaters | minus 1.8 | 0.15 | Strongly price sensitive, respond to email |
| Corporate buyers | minus 1.3 | 0.02 | Compare quotes, ignore newsletters |
Price elasticity by segment, shown as absolute values. Self treaters react almost four times as strongly to a price change as Last minute gifters.
Each line changes a decision. Last minute gifters have an elasticity of minus 0.5, so a 10 percent discount in the week before Christmas gives up 10 percent of margin to gain 5 percent more orders; the shop was doing exactly that every year. Self treaters at minus 1.8 are the only segment where a lower price genuinely pays for itself in volume, so a smaller kitchen hamper under £30 is a real product decision for them, not a coupon. Corporate buyers are elastic because they collect three quotes, so the lever is a volume tier, not a newsletter. Planners are where email works: 10 percent more emails per active Planner bring roughly 2 percent more orders, up to the point where they unsubscribe, which the model cannot see.
Stage three: the loyalty loop
That email elasticity of 0.21 has a problem, and it is why the third stage exists. The Gift Bow, like every shop, sends more email to people who bought recently, and people about to buy a Christmas hamper open more email in November because they are looking for one. So opens and orders cause each other within the same quarter, and a single equation credits email with an effect that is partly intent showing up twice. I covered the general case in the simultaneous equations chapter; here is the smallest version that works, on a panel of customers by quarter.
is the number of orders by customer in quarter . is the number of marketing emails that customer opened in the same quarter, transactional mails excluded. is last quarter's orders, which carries the habit. is the number of gift occasions the customer saved in the shop's reminder calendar that fall in this quarter, something they told us months ago that does not depend on this quarter's email. is the number of emails we sent, set by the calendar and the segment rules. is the segment. and are the errors. Opens drive orders in the first equation; orders and sends drive opens in the second. Each equation has one variable the other does not, the saved occasions and the sends, and that identifies the system so two stage least squares can estimate it. Those exclusion restrictions are assumptions. I think they are reasonable, and I say so in the memo rather than hiding them.
| Coefficient | Meaning | Single equation OLS | Two stage least squares |
|---|---|---|---|
| Extra orders per extra opened email | 0.062 | 0.031 | |
| Carry over from last quarter's orders | 0.34 | 0.33 | |
| Extra orders per saved occasion | 0.27 | 0.26 | |
| Extra opens per order in the quarter | 2.4 | 1.9 | |
| Extra opens per email sent | 0.18 | 0.18 |
The first row is the whole point. Naive OLS says an opened email is worth 0.062 orders; the system says 0.031, half as much. The rest barely moves, which is reassuring. The loop itself is real but modest: an extra open produces 0.031 orders, each order produces 1.9 further opens, each of which produces 0.031 orders, and so on. The total effect of one extra open, echoes included, is
so the loop adds about 6 percent to the direct effect. Not nothing, not a strategy. What does matter is that differs by segment: 0.058 for Planners, 0.036 for Self treaters, 0.021 for Corporate buyers and 0.014 for Last minute gifters. That is the email cadence decision, and it is the opposite of what the shop had been doing, which was sending everyone the same eleven emails between 1 November and 23 December.
Stage four: the experiences questionnaire
The first three stages tell me who, what and how often. None of them tells me what to change about the hamper, the delivery or the card. For that I ask, but about moments, not about satisfaction in general. Nobody can act on "overall satisfaction 7.8".
The questionnaire went to a sample stratified by segment, 1,140 usable responses. Each respondent rated nine moments from 1 to 10: ease of ordering, range of choice, delivery on the promised day, presentation when the box was opened, the card message arriving exactly as typed, contents matching the description, how a problem was handled if there was one, price fairness, and packaging sustainability. The loyalty outcome is not a stated intention but actual repurchase within nine months, matched back to the order table. The model regresses that outcome on the standardised moment scores.
is one if customer bought again within nine months and zero otherwise, is the score of moment standardised to mean zero and standard deviation one, so that is comparable across moments, and is the error. The previous chapter does this properly with latent constructs and structural paths; this simpler version already separates the moments that matter from the ones that do not.
| Moment | Mean score, 1 to 10 | Standardised effect on repurchase | Rank |
|---|---|---|---|
| Delivery arrived on the promised day | 7.9 | 0.31 | 1 |
| Presentation when the box was opened | 8.4 | 0.24 | 2 |
| Handling of a problem, those affected only | 6.2 | 0.22 | 3 |
| Card message exactly as typed | 8.1 | 0.18 | 4 |
| Price fairness | 7.1 | 0.11 | 5 |
| Contents matched the description | 8.6 | 0.09 | 6 |
| Range of choice | 7.7 | 0.08 | 7 |
| Ease of ordering | 8.8 | 0.06 | 8 |
| Packaging sustainability | 7.4 | 0.04 | 9 |
Nine moments placed by today's score and effect on repurchase. Top left is where the money is: strong effect, mediocre score.
Two experiences move loyalty most, and neither is on the website. The first is the delivery arriving on the day we promised, effect 0.31 with a score of only 7.9, and for Last minute gifters alone the effect is 0.44. A hamper that arrives on 27 December is not late, it is worthless, and the buyer remembers that for exactly one year. The second is the moment the box is opened, effect 0.24. For gift buyers this is second hand: they hear about it from the recipient, or they do not. So the two changes the project recommends are a guaranteed delivery day with a proactive message when it slips, and a redesign of the inner presentation with a small card inviting the recipient to send a photo back to the giver. Problem handling ranks third and only applies to the 210 people who had one, which is why its score is so low and why it belongs in the same fix.
The moments the shop had been investing in are at the bottom. Ease of ordering scores 8.8 with an effect of 0.06; another checkout redesign would improve nothing that matters. Packaging sustainability, which the team was sure would be decisive, comes last at 0.04. People care about it when asked, and it does not change whether they buy again.
How the pieces feed each other
Put the four outputs side by side and the plan writes itself. The segments decide who gets which price rule and which cadence. Elasticity says where a price change is safe: a guaranteed delivery day costs about £2.40 more per parcel, which Last minute gifters can carry and Self treaters cannot. The loop says how often to talk and to whom, and warns that an email programme looks twice as good in a dashboard as it really is. The questionnaire says what to change in the physical experience and, crucially, what not to spend on.
Without the segments the questionnaire would have averaged the delivery effect across everyone and understated it where it matters most. Without the elasticity the delivery upgrade would have been funded by a blanket price rise that loses Self treaters. Without the loop the email team would have a budget it could not justify. Each piece corrects a mistake the others would otherwise make.
A month by month plan
This is how I sequence it for a shop of this size. Six months, one accountable person, one decision per month.
| Month | What happens | What you hold at the end | Decision it enables |
|---|---|---|---|
| 1 | Free workshop, then two weeks joining orders, email logs and the reminder calendar into one customer table | Data memo with the gaps named, first RFM sketch | Is the data good enough to continue |
| 2 | Needs survey to 1,400 customers, latent class segmentation, naming and sizing | Four segments, a profile sheet, a scored customer list | Which segments to work on |
| 3 | Weekly demand model per segment, elasticities with error margins | Price and offer rules per segment | What to discount, for whom, and what never |
| 4 | Customer by quarter panel, loyalty loop by two stage least squares | Email cadence per segment, honest value of an open | How many emails each segment gets |
| 5 | Experiences questionnaire fielded, effects matched to actual repurchase | Ranked table of moments, the two experiences to change | What to change in delivery and presentation |
| 6 | Changes designed, test set up as in the next chapter, one dashboard built | Live dashboard, test plan with the sample size written down | Go live for Christmas |
What changes for the business is concrete. Instead of one discount code for everyone there are four offer rules, and one segment gets no discount at all. Instead of eleven identical emails there are cadences of nine, three, six and two. The courier contract is renegotiated for a guaranteed day on the Last minute segment's parcels. The inner box is redesigned once. And the weekly management question stops being "how did the newsletter do" and becomes "is the repeat rate rising in Planners and Last minute gifters against the same week last year", which one chart answers.
Running it yourself
The data is less exotic than it sounds. Three years of orders with customer id, timestamp, value, line items, shipping and billing names and channel. Email send and open events by customer. Any first party signal of intent that is not email, such as saved occasions or wishlists. A survey tool that carries a customer id so answers join back to behaviour. That last point is where most surveys fail: anonymous answers cannot be matched to actual repurchase, so you end up modelling stated intent, which is a weaker thing.
The customer by quarter panel for the loop is a single query.
with q as (
select user_id, date_trunc('quarter', completed_at) as qtr,
count(*) as orders, sum(total) as spend
from spree_orders
where state = 'complete'
group by 1, 2
),
e as (
select user_id, date_trunc('quarter', occurred_at) as qtr,
count(*) filter (where event = 'open') as opens,
count(*) filter (where event = 'sent') as sent
from email_events
where campaign_type = 'marketing'
group by 1, 2
)
select coalesce(q.user_id, e.user_id) as user_id,
coalesce(q.qtr, e.qtr) as qtr,
coalesce(orders, 0) as orders, coalesce(spend, 0) as spend,
coalesce(opens, 0) as opens, coalesce(sent, 0) as sent
from q full outer join e on q.user_id = e.user_id and q.qtr = e.qtr;
Fill the missing quarters with zeros before you lag anything, otherwise a customer who bought in Q4 and not in Q1 disappears from the panel and the habit coefficient is inflated. The two stage estimation is a few lines in Python: opens is the endogenous variable and emails sent is the instrument.
import statsmodels.api as sm
from linearmodels.iv import IV2SLS
exog = sm.add_constant(panel[["orders_lag", "occasions"]])
m1 = IV2SLS(panel["orders"], exog, panel["opens"], panel["sent"])
r1 = m1.fit(cov_type="clustered", clusters=panel["user_id"])
print(r1.summary)
Before you trust any of it, run four checks. Segments must be stable: refit on a random half of the customers and the same four groups should appear at roughly the same sizes. Elasticities must have the right sign and a standard error small enough that the decision does not flip within it; minus 0.9 with a standard error of 0.7 is not a decision, it is a shrug. The instruments in the loop must be strong, which in practice means a first stage F statistic comfortably above ten. And the questionnaire effects must survive controlling for segment, otherwise you have rediscovered that Planners are loyal and called it delivery.
Time: six months at the pace above, with the shop's people spending perhaps two hours a week on questions. Faster is possible if the data is clean. It rarely is.
Pitfalls
Segmenting on who people are. Age bands and postcodes produce segments that are easy to describe and useless to act on, because the same 45 year old in Leeds buys a hamper for her mother in October and one for herself in March. Behaviour and stated needs separate those two purchases; demographics never will.
Estimating elasticity from promotion weeks only. If price only moves when you run a promotion, the model learns the effect of promotion week, email, banner and season included, and calls it price. You need price variation that is not tied to a campaign, even if that means holding a small hamper at two prices across regions for a quarter.
Reading opens as causal. Every email platform reports revenue attributed to opens and every one overstates it, for exactly the reason the loop equations exist. If a dashboard says email drove 30 percent of revenue, halve it in your head until someone shows you an estimate that handled the simultaneity.
Asking about satisfaction instead of moments, and measuring intent instead of behaviour. "Would you buy again" correlates with politeness. Actual repurchase nine months later, matched by customer id, correlates with what happened to the parcel.
Segments the shop cannot operationalise. If scoring a new customer needs a latent class model, nobody in the warehouse will use it. Every segment needs a two rule approximation that can be written as a filter in the shop's admin and agrees with the model at least 85 percent of the time.
How I do this for clients
This project is the fullest expression of what I sell as data science for a small or medium business, and it is why I insist on being one accountable person rather than a team of specialists: the value is in the joins between the four stages, and joins are what get lost between departments.
It starts with the free workshop, where we look at your order and email data together and I tell you honestly whether it can carry the project. Then I do two weeks of real work at my own risk: the customer table, the data memo, a first segmentation sketch. If that memo says the data is not ready, you have lost nothing and gained a list of what to fix.
From month two you get, each month, one artefact you own outright: a scored customer list with segment labels that loads into your shop and your email tool, a price and offer memo per segment with elasticities and their error margins, an email cadence memo with the honest value of an open, a ranked table of experience moments and the two changes I would make, and finally one dashboard that answers one question. Every model is in your repository, documented, and does not depend on me to rerun.
Because the discount rules and the cadence go live before the project ends, the changes usually pay for the later months. Where the client prefers, the growth side can run on commission under my growth hacking programme, so I am paid when the repeat rate moves and not before. Costs are laid out plainly on the pricing page; the first month is described in the first data science month.
Questions to ask your team before the next Christmas
- Are our segments defined by what customers do and need, or by what they look like, and can the warehouse tell which segment an order belongs to?
- Do we know the price elasticity of each segment separately, with an error margin, or one number for the whole shop?
- When the email report claims revenue, has anyone corrected for the fact that people about to buy open more email?
- Which single experience moment has the biggest effect on repurchase, and what is its score today?
- Are we measuring loyalty as stated intention or as actual repurchase matched to the customer record?
- Which decision changed last quarter because of any of these analyses?
- If the person who built the models left tomorrow, could we rerun them?
This series is inspired by Mike Grigsby's Marketing Analytics (Kogan Page). The explanations, examples and numbers here are my own.