How much does my search, my reviews or my free delivery threshold really earn?

TL;DR

Difficulty: Advanced

The revenue a report credits to a feature is not what the feature earned, because the people who use it would often buy anyway.

  • Measure a part by switching it off for a random share of visitors and comparing contribution per visitor.
  • Calculate the smallest detectable effect first: at about 2,000 orders a month only parts worth around 15% or more can be measured alone in eight weeks.
  • Trigger on the visitors who could see the part, bundle small parts, and use switchbacks for delivery charges.
  • On your own code it is a flag, an exposure table and one SQL query.
  • Keep every result, with its interval and cost, in a feature value register and decide with the interval.

Your analytics say search brought in €61,000 last month. Some of those customers would have bought anyway, and the report cannot tell you how many. This chapter shows how to measure what each part of a shop really earns, how large a shop has to be before a test can see it, and how to build the switch, the logging and the analysis on Rails and Solidus.

Your reports say what a feature touched, not what it earned

Sooner or later every shop owner wonders what one part of the shop is really worth: the site search, the reviews, the "customers also bought" row, the free delivery rule, the live chat. Which ones would you miss if they disappeared tomorrow?

Analytics tools answer a different question. They tell you how much revenue passed through a feature: orders from sessions that used search, revenue from clicks on recommendations. That number is real, but it is not what the feature earned. Many of those customers would have bought anyway.

This chapter shows how to measure what each part of a shop is worth on its own. The method is simple to say and careful to do: switch the part off for a random share of visitors, and compare what the two groups leave behind in contribution. Along the way you will see why most small effects cannot be measured at all at a typical shop's size, what to do about that, how to build the switch and the logging on Rails and Solidus, and how to keep a register of what every part earns and costs.

It builds on two earlier chapters. Why a shop should be one application explains why owning the code matters, and cohort analysis explains how to follow groups of customers over time, which is exactly what a test does.

Shannonside Home is the invented homeware shop in Limerick that runs through this series (shannonsidehome.example). Niamh owns it, Callum is her developer. The shop sells ceramics, kitchen textiles, lamps and small furniture, about 1,400 products. Its monthly baseline: 110,000 sessions, a conversion rate of 1.8%, so 1,980 orders, an average order value of €84 including VAT, a gross margin of 52% on product, and a contribution before marketing of €44,440, which is €22.44 per order. For this chapter one more invented figure: those 110,000 sessions come from about 74,000 different visitors a month.

Niamh's analytics show that sessions with a search placed 726 orders last month. At €84 each that is €60,984 of revenue "from search", and at €22.44 each, €16,291 of contribution. A search server upgrade would cost money, and Niamh wants to know whether search is worth investing in. Is it worth €16,291 a month? Every figure about Shannonside Home in this chapter is invented for the example.

Revenue from a feature is not what the feature earned

The search report counts the orders of people who used search. It does not count the orders search caused. The difference is selection bias: the people who use a feature are not a random sample of visitors. People who search often arrive knowing what they want, so they would buy at a high rate with or without the box. The chapter on site search shows why searchers convert better and why part of that belongs to the person, not the tool.

The same is true of almost every feature. People who read reviews are already considering a product, and people who use a wishlist are already planning to come back.

How big is the gap? Two well known studies give a sense of it. Sharma, Hofman and Watts studied recommendations on a large online retailer and found that although recommendation clicks made up a large share of traffic to the products they examined, at least 75% of that activity would likely have happened without the recommendations1. Blake, Nosko and Tadelis ran large field experiments at eBay and found that the returns from paid search ads were a fraction of what the usual non experimental estimates claimed. Brand keyword ads had no measurable short term benefit at all2. Different features, same lesson: the number that passes through a feature can be several times what it adds.

Example: who are Shannonside's 726 search orders?

Picture three kinds of customer among the 726.

  • Some knew exactly what they wanted ("oval linen tablecloth"), typed it, and bought. Without search, most of them would have found it through the menu, a little slower.
  • Some were unsure, searched, found something they would not have found otherwise, and bought. Search caused these orders.
  • Some searched, found nothing useful, browsed, and bought something else. Search did nothing for them, but the report still counts them because the session contained a search.

The report credits all 726 orders to search. Only the second group is what search earned. Nobody can tell from the data which customer was which. That is why the rest of this chapter compares groups, not customers.

The question to ask: what would have happened without it?

The value of a feature is the difference between two worlds: the shop as it is, and the same shop, at the same time, with the same visitors, without that feature. Statisticians call the second world the counterfactual. You can never observe it for the same person, because each visitor lives in only one world. But you can observe it for a group, if the two groups are alike in every way except the feature.

The difference is the uplift, here measured as the relative change in contribution per visitor:

u=yˉon−yˉoffyˉoffu = \frac{\bar{y}_{\text{on}} - \bar{y}_{\text{off}}}{\bar{y}_{\text{off}}}

where uu is the uplift, yˉon\bar{y}_{\text{on}} is the average contribution per visitor in the group that sees the feature, and yˉoff\bar{y}_{\text{off}} is the average contribution per visitor in the group that does not. The ratio is explained in Foundations: ratios and rates.

Example: uplift for two invented groups

Suppose 1,000 visitors see search and leave €600 of contribution behind, and 1,000 comparable visitors without search leave €520. Then yˉon=600/1,000=0.60\bar{y}_{\text{on}} = 600 / 1{,}000 = 0.60 and yˉoff=520/1,000=0.52\bar{y}_{\text{off}} = 520 / 1{,}000 = 0.52, so

u=0.60−0.520.52=0.080.52=0.154u = \frac{0.60 - 0.52}{0.52} = \frac{0.08}{0.52} = 0.154

Here yˉon=0.60\bar{y}_{\text{on}} = 0.60 and yˉoff=0.52\bar{y}_{\text{off}} = 0.52 are the two groups' euro per visitor, and u=0.154u = 0.154 is the uplift.

Search adds about 15% to contribution per visitor, compared with a shop without it. The rest of the chapter is about making sure the two groups really are comparable, and about knowing how far to trust a number like 15% when the groups are of a realistic size.

Why before and after comparisons mislead

The obvious shortcut is to switch the feature off for a month and compare that month with the one before. It does not work, because everything else changes too. Season, weather, ad spend, a newsletter, a competitor's sale, a delivery strike. Kohavi, Tang and Xu, in the standard book on online experiments, treat comparisons over time as observational studies with a lower level of trust than a randomised experiment, and list the pitfalls in detail3.

Example: switching search off in January

Suppose Niamh switches search off for all of January and compares January's contribution with December's. December's contribution was higher, as it always is in a homeware shop before Christmas. The fall from December to January would be blamed on search. Now suppose she compares with last January instead. Ad spend was €2,000 a month lower last year, and a large furniture range was added in the spring. Again the difference mixes search with everything else. There is no month that is "the same except for search". There is only a group that is the same except for search, and a random split is the way to build one.

The holdout: switch the part off for a random share of visitors

A holdout test splits visitors at random into two groups. The larger group keeps the shop as it is. The smaller group, the holdout, gets the shop without the part being measured. Because the split is random, the two groups have the same mix of searchers and browsers, new and returning customers, phone and desktop users, and the same weather and ad spend at the same moment. The only systematic difference is the part. A holdout is an A/B test where the B is "without".

Three rules make it work:

  • Randomise by visitor, not by page view. A visitor who sees search on Monday and no search on Tuesday is in neither group. The assignment must stick.
  • Decide the assignment before the visitor can influence it. Assign on arrival, not when someone clicks into the search box, or the people who are most eager to search decide which group they belong to.
  • Count everyone who was assigned, including those who never used the feature. A visitor who never searched still belongs to the group, because in the holdout you cannot know who would have searched.

The usual way to make an assignment stick without storing a list is deterministic hashing: turn the visitor's identifier and the name of the test into a number, and put the visitor in a group based on that number. The same visitor always gets the same number, so always the same group. Different tests use different names, so a visitor's group in one test says nothing about the group in another.

Tap or click to open full screen and move around

Example: one visitor, two tests

A visitor arrives with the identifier q7RbN2xYk4TzW1. Callum's shop runs two tests: search is on for 80% of visitors, reviews are on for 50%. The feature flag library he uses, Flipper, joins the test name and the visitor identifier, computes a CRC32 checksum, takes the remainder after dividing by 100,000, and switches the feature on if that remainder is below the percentage times 1,0004.

For search the text is site_searchVisitor;q7RbN2xYk4TzW1. Its CRC32 value is 3,511,036,797, and the remainder after dividing by 100,000 is 36,797. That is below 80×1,000=80,00080 \times 1{,}000 = 80{,}000, so this visitor sees search. For reviews the text is reviewsVisitor;q7RbN2xYk4TzW1, the CRC32 value is 846,596,447 and the remainder is 96,447. That is not below 50×1,000=50,00050 \times 1{,}000 = 50{,}000, so this visitor is in the reviews holdout. On every later visit the same arithmetic gives the same answers.

Choose one number to decide by: contribution per visitor

A test needs one main metric, decided before it starts, so that nobody can pick the metric that happens to look best afterwards. Kohavi and colleagues call this the overall evaluation criterion, and stress that it should be measurable during the test and believed to drive long term value5. For a shop the right one is contribution per visitor: contribution before marketing, from all orders the visitor placed during the test, averaged over every visitor in the group, including the many who bought nothing.

yˉ=1n∑i=1nyi\bar{y} = \frac{1}{n} \sum_{i=1}^{n} y_i

where yˉ\bar{y} is contribution per visitor in a group, nn is the number of visitors assigned to that group, and yiy_i is the contribution of all orders placed by visitor ii during the test, zero for a visitor who bought nothing. This is an ordinary mean, see Foundations: mean.

Why not the usual numbers?

  • Conversion rate ignores order size and margin. A free delivery rule can raise conversion and still lose money.
  • Average order value ignores how many people buy. A higher threshold can lift it while fewer people order.
  • Revenue per visitor ignores margin, delivery cost and returns. A feature that pushes heavy, low margin furniture can lift revenue and lower profit.

Contribution per visitor combines all of them. Contribution itself is worked out per order in the unit economics chapter.

Example: Shannonside's contribution per visitor

Not every visitor can be in a test (the consent section below explains why). Shannonside's tests include the visitors who agreed to analytics cookies, about 64% of them. Over the last eight weeks that group had 80,000 visitors, who placed 2,330 orders at an average contribution of €22.44. So

yˉ=2,330×22.4480,000=52,28580,000=0.654\bar{y} = \frac{2{,}330 \times 22.44}{80{,}000} = \frac{52{,}285}{80{,}000} = 0.654

Here n=80,000n = 80{,}000 visitors, ∑yi=52,285\sum y_i = 52{,}285 euro of contribution, and yˉ=0.654\bar{y} = 0.654 euro per visitor.

About 65 cent per visitor. It looks tiny, and that is normal: 97 of every 100 visitors buy nothing in eight weeks and count as zero. The figure is still the one that moves when a part of the shop earns money.

Guardrails: what must not get worse

A guardrail is a number that is not the goal but must not get worse. It catches a main metric that rises for a bad reason, or a test that breaks something nobody was watching. Write guardrails down before the test, with the change that would stop it.

Example: the guardrails for the search holdout

GuardrailWhy it mattersStop if
Share of visitors in each groupA split that drifts from 80/20 means the assignment is brokenOutside 79.5% to 80.5% after a week
Return rate of ordersA feature can raise sales of things people send backMore than 1.5 points higher in either group
Contacts to customer service per 1,000 visitorsPeople who cannot find a product write inMore than 20% higher in the holdout
Page load time at the 75th percentileThe new code must not slow the shopMore than 200 milliseconds slower
Repeat order rate after 60 daysA part can earn today and cost loyalty laterChecked after the test, recorded in the register

The first row is the most important, and the least expensive to check. If 80% of visitors were meant to see search and the logs say 77%, something is assigning visitors wrongly (a cache serving one version to everyone, a bot hitting one group). No result from such a test can be trusted. The chapter on experiments inside your own shop shows how to test this formally with a sample ratio mismatch check.

How long and how many visitors: the smallest effect you can see

Before running a test, work out the smallest effect it could reliably detect. This is the minimum detectable effect. If the part you want to measure is probably worth less than that, the test will almost certainly end with "cannot tell", and the weeks of holding the part back are wasted.

MDE=(z1−α/2+z1−β)σ1non+1noff\text{MDE} = \left(z_{1-\alpha/2} + z_{1-\beta}\right) \sigma \sqrt{\frac{1}{n_{\text{on}}} + \frac{1}{n_{\text{off}}}}

where MDE\text{MDE} is the minimum detectable effect in euro per visitor, z1−α/2=1.96z_{1-\alpha/2} = 1.96 for a 5% false alarm rate, z1−β=0.84z_{1-\beta} = 0.84 for an 80% chance of detecting a real effect of that size, σ\sigma is the standard deviation of contribution per visitor, and nonn_{\text{on}} and noffn_{\text{off}} are the numbers of visitors in the two groups. The ideas behind it are in Foundations: sample size and Foundations: spread.

The difficult number is σ\sigma. Contribution per visitor is mostly zeros with an occasional order, which makes it very spread out. If a share pp of visitors buys, and orders have an average contribution cˉ\bar{c} with standard deviation scs_c, then

σ2=p(sc2+cˉ2)−(p cˉ)2\sigma^2 = p \left(s_c^2 + \bar{c}^2\right) - \left(p \, \bar{c}\right)^2

where σ2\sigma^2 is the variance of contribution per visitor, pp is the share of visitors who order, cˉ\bar{c} is the average contribution per order and scs_c its standard deviation. The first term is the average of the squared values (only buyers contribute to it), the second is the square of the mean. See Foundations: spread.

Example: what an eight week test can see at Shannonside

Callum takes the last eight weeks: p=2,330/80,000=0.0291p = 2{,}330 / 80{,}000 = 0.0291, cˉ=22.44\bar{c} = 22.44, and from the order history sc=20.3s_c = 20.3 (some orders lose money, a sideboard earns a lot). So

σ2=0.0291×(20.32+22.442)−(0.0291×22.44)2=0.0291×915.6−0.6542=26.65−0.43=26.22\sigma^2 = 0.0291 \times (20.3^2 + 22.44^2) - (0.0291 \times 22.44)^2 = 0.0291 \times 915.6 - 0.654^2 = 26.65 - 0.43 = 26.22

and σ=26.22=5.12\sigma = \sqrt{26.22} = 5.12. With a 50/50 split over eight weeks, each group has 40,000 visitors:

MDE=(1.96+0.84)×5.12×140,000+140,000=14.34×0.00707=0.101\text{MDE} = (1.96 + 0.84) \times 5.12 \times \sqrt{\frac{1}{40{,}000} + \frac{1}{40{,}000}} = 14.34 \times 0.00707 = 0.101

Here σ=5.12\sigma = 5.12, non=noff=40,000n_{\text{on}} = n_{\text{off}} = 40{,}000, and MDE=0.101\text{MDE} = 0.101 euro per visitor.

About 10 cent per visitor, which is 15.5% of the 65 cent baseline. An eight week test at Shannonside can only reliably see a part that changes contribution per visitor by about 15% or more. That is a sobering number. Search might clear it. A wishlist will not come close.

Longer tests help, but more slowly than you might hope, for two reasons: the interval shrinks with the square root of the number of visitors, and returning visitors mean each new week adds fewer new people. Shannonside's test population grows by about 17,000 visitors in the first week and about 9,000 new visitors in each week after.

Invented example. The minimum detectable effect on contribution per visitor, as a percentage of the 65 cent baseline, for a 50/50 split and for an 80/20 holdout. After 2 weeks: 27.3% and 34.1%. After 4 weeks: 21.0% and 26.2%. After 8 weeks: 15.5% and 19.4%. After 12 weeks: 12.9% and 16.1%. After 16 weeks: 11.3% and 14.1%. After 20 weeks: 10.1% and 12.7%. After 24 weeks: 9.3% and 11.6%. Even half a year cannot reliably detect effects below about 9%. Tap or click to open full screen and move around

This is the honest headline of the chapter for a shop of Shannonside's size: you can measure the big parts, and you cannot measure the small ones one by one. The article on how much data you actually need shows the same arithmetic for ads and forecasts. Shops with ten times the traffic can see effects about three times smaller, because the interval shrinks with the square root.

The size of the holdout, and what the test costs

A 50/50 split measures fastest, but it also withholds the part from half your visitors. If the part is valuable, that costs real money while the test runs. A smaller holdout costs less per week and needs more weeks. The term 1/non+1/noff\sqrt{1/n_{\text{on}} + 1/n_{\text{off}}} shows the trade: with NN visitors and a holdout share hh, it equals 1/(hN)+1/((1−h)N)\sqrt{1/(hN) + 1/((1-h)N)}, which is 4/N\sqrt{4/N} for h=0.5h = 0.5 and 6.25/N\sqrt{6.25/N} for h=0.2h = 0.2. A 20% holdout needs about 56% more visitors for the same precision.

Suppose search is really worth about €5,930 a month (the result measured later in this chapter). Callum compares two designs.

  • 50/50 for eight weeks. Smallest detectable effect 15.5%. Half the visitors go without search for eight weeks, which is 8×7/30.4=1.848 \times 7 / 30.4 = 1.84 months. Cost: 0.5×5,930×1.84=€5,4560.5 \times 5{,}930 \times 1.84 = €5{,}456.
  • 80/20 for sixteen weeks. With 152,000 visitors the smallest detectable effect is 14.1%. A fifth of the visitors go without search for 16×7/30.4=3.6816 \times 7 / 30.4 = 3.68 months. Cost: 0.2×5,930×3.68=€4,3640.2 \times 5{,}930 \times 3.68 = €4{,}364.

The longer, smaller holdout is slightly more precise and about €1,090 less expensive. It is slower to answer, which matters if the decision is urgent. For search it is not, so Callum chooses 80/20 for sixteen weeks.

Triggering: count only the visitors who could have been affected

Some parts are seen by only a few visitors: a delivery slot picker on furniture pages, a size guide on rugs. If you analyse everyone, the visitors who never saw the part add noise and no signal. Triggering means analysing only the visitors who reached the point where the part would have appeared, in both groups. In the holdout you log the moment the part would have been shown, without showing it. Kohavi, Tang and Xu describe triggering as a way to gain statistical power by filtering out users who could not have been affected6.

The rule that keeps it honest: the trigger must be the same in both groups and must happen before the part could change behaviour. "Visited a furniture product page" works. "Opened the slot picker" does not, because only one group has a picker to open.

Example: the furniture delivery slot picker

Shannonside wants to know whether letting customers pick a two person delivery slot on sofa and sideboard pages pays for itself. In eight weeks 12,000 of the 80,000 test visitors view a furniture page. They place 470 orders with an average contribution of €38 and a standard deviation of €34. Suppose the picker lifts their contribution by 12%.

Analysed across all 80,000 visitors, a 12% lift among 12,000 people becomes a lift of only 4.1% overall, against a smallest detectable effect of 15.5%. The test would see a quarter of what it needs.

Triggered on the 12,000, the baseline is 470×38/12,000=€1.49470 \times 38 / 12{,}000 = €1.49 per visitor, p=470/12,000=0.0392p = 470 / 12{,}000 = 0.0392, and

σ2=0.0392×(342+382)−(0.0392×38)2=0.0392×2,600−1.492=101.9−2.2=99.7\sigma^2 = 0.0392 \times (34^2 + 38^2) - (0.0392 \times 38)^2 = 0.0392 \times 2{,}600 - 1.49^2 = 101.9 - 2.2 = 99.7

so σ=9.98\sigma = 9.98 and with 6,000 visitors in each group the smallest detectable effect is 2.80×9.98×2/6,000=0.5102.80 \times 9.98 \times \sqrt{2/6{,}000} = 0.510, which is 34% of €1.49. The test now sees about a third of what it needs, instead of a quarter. Triggering helped, and it still is not enough. Callum records the picker as "not measurable at our size" and Niamh decides on cost and on what the customer service team hears. Knowing that before running a test is worth as much as a test result.

Some parts cannot be split by visitor: switchbacks

Some parts should not differ between two visitors at the same moment. A delivery charge is the clearest case. Two customers comparing notes would find different charges for the same basket, and customer service would have to explain it. There is also the law. Schedule 3 to the Consumer Rights Act 2022 requires a trader to tell consumers, where applicable, that a price was personalised on the basis of automated decision making7. Whether a random test counts is a question for a lawyer, and a design that shows everyone the same charge avoids it.

That design is a switchback: everyone gets version A for a period, then everyone gets version B, alternating, with the order of each pair chosen at random. Each period is one data point. Switchbacks are widely used where splitting users is impossible, and the research on them focuses on the main risk, the carryover effect: what happened in one period still influencing the next8. A customer who saw free delivery on Sunday and orders on Monday is the carryover in a shop.

The analysis compares the two versions within each pair, which cancels slow trends such as the season:

dˉ±t0.975, k−1 sdk\bar{d} \pm t_{0.975,\,k-1} \, \frac{s_d}{\sqrt{k}}

where dˉ\bar{d} is the average difference in contribution between version B and version A across the pairs, kk is the number of pairs, sds_d is the standard deviation of those differences, and t0.975, k−1t_{0.975,\,k-1} is the value from the t distribution with k−1k - 1 degrees of freedom that gives a 95% interval. See Foundations: confidence intervals.

Example: free delivery for everything, or a charge under €40

Shannonside delivers every order free. The unit economics chapter works out on paper what a delivery charge on small baskets is worth, and ends with the advice to test it. Niamh wants to test €5.90 on baskets under €40. Callum runs six pairs of weeks. In each pair a coin decides which week comes first. The rule changes at midnight on Sunday, shown on every page and in the basket, and orders count to the week in which the basket was started, which limits carryover.

PairWeek with free delivery (€)Week with €5.90 under €40 (€)Difference (€)
110,08310,558475
210,29310,498205
39,92310,498575
410,35310,253minus 100
510,19310,598405
610,32310,628305

The average difference is dˉ=(475+205+575−100+405+305)/6=1,865/6=310.8\bar{d} = (475 + 205 + 575 - 100 + 405 + 305) / 6 = 1{,}865 / 6 = 310.8. The differences from that average are 164.2, minus 105.8, 264.2, minus 410.8, 94.2 and minus 5.8. Their squares add up to 285,621, so sd=285,621/5=239.0s_d = \sqrt{285{,}621 / 5} = 239.0. With k=6k = 6 and t0.975, 5=2.571t_{0.975,\,5} = 2.571:

310.8±2.571×239.06=310.8±2.571×97.57=310.8±250.9310.8 \pm 2.571 \times \frac{239.0}{\sqrt{6}} = 310.8 \pm 2.571 \times 97.57 = 310.8 \pm 250.9

The charge earns between €60 and €562 more contribution a week, most likely about €311. Per month that is 310.8×30.4/7=€1,350310.8 \times 30.4 / 7 = €1{,}350, with an interval of €261 to €2,439. Niamh keeps the charge and puts the measured value in the register.

Part by part: what "off" means and what to watch

Each part of a shop needs its own definition of "off", its own trigger and its own guardrail. The definition matters more than it looks: "off" must be a realistic alternative, the way the shop would work without the part, not a broken page.

PartWhat "off" meansTrigger, if anyGuardrail to watchMeasurable alone at Shannonside's size?
Site searchNo search box, menus and filters stayNone, everyone could searchCustomer service contactsProbably, if it is worth 15% or more
RecommendationsThe rows are not renderedViewed a product page or the basketPage load timeOnly if large
ReviewsNo stars and no review text, for every productViewed a product pageReturn ratePossibly
Delivery date promiseStandard "3 to 5 working days" text instead of a dateViewed a product pageLate delivery complaintsOnly if large
Free delivery thresholdRun as a switchback, not a splitStarted a basketAverage order valueYes, by switchback
Live chatNo chat buttonNoneEmails to customer serviceNo, bundle it
WishlistNo heart icon, saved lists still keptNoneNewsletter sign upsNo, bundle it
Quick viewProduct tiles link to the product page onlyViewed a category pagePage load timeNo, bundle it

Two parts need a few more words.

Reviews: hide all of them, never only the bad ones

A reviews holdout must hide every review for every product in the holdout group. Hiding only some reviews, for example the negative ones, would not be a test of reviews, and it would also misrepresent what customers think. In Ireland, section 55(1)(zb) of the Consumer Protection Act 2007, inserted by section 157 of the Consumer Rights Act 2022, prohibits submitting false consumer reviews and misrepresenting consumer reviews in order to promote products9. The revised Act on the Law Reform Commission's site shows the provision in its full context10. Hiding only the bad reviews is exactly the kind of misrepresentation to stay well clear of. Showing no reviews at all to a random group misleads nobody about what other buyers said. This is general information and not legal advice.

Example: Shannonside's reviews holdout

Callum runs reviews at 50/50 for eight weeks, triggered on visitors who viewed a product page. Contribution per visitor is 12.0% higher with reviews, with a 95% interval of 1.1% to 22.9%. The return rate is 8.6% with reviews and 9.4% without, which fits the idea that reviews help people choose the right item. Both numbers go into the register.

Small parts: test them as a bundle

Chat, wishlist and quick view are each far too small to measure alone. Switched off together, as one "extras" bundle, they have a chance. If the bundle shows no value, at least one part in it is worth little, and the costs decide which goes first. If it shows value, you test the halves of the bundle next.

Example: the extras bundle

The bundle runs 50/50 for eight weeks. Contribution per visitor is 0.8% higher with the extras, with an interval of minus 10.1% to plus 11.7%. That is "cannot tell". The bundle costs €640 a month: €320 for the chat software, about €250 of staff time answering chats, and about €70 of upkeep for the other two. Live chat is almost all of the cost. The decision is made later in the chapter, with the register.

Parts are not additive: interactions

Measure each part alone and add up the results, and you will usually get the wrong total. Parts overlap. Search and recommendations both help people find products. Switch off one, and the other catches some of the visitors who would have used it. Each measured alone looks smaller than it is, and both together are worth more than the sum.

If two tests run at the same time with independent assignments (different names in the hash), every combination of the two exists in the data, and you can see the overlap. With a 50/50 split each, a quarter of visitors are in each combination.

Example: search and recommendations together

Callum looks at contribution per visitor in the four combinations during a period when both tests ran. The numbers are illustrative. With only a quarter of the visitors in each cell they are noisy.

Recommendations onRecommendations off
Search on€0.678€0.661
Search off€0.588€0.531

With recommendations on, search is worth 0.678−0.588=0.0900.678 - 0.588 = 0.090 per visitor. With recommendations off, search is worth 0.661−0.531=0.1300.661 - 0.531 = 0.130. Recommendations alone, with search on, are worth 0.678−0.661=0.0170.678 - 0.661 = 0.017. Adding the two single effects gives 0.090+0.017=0.1070.090 + 0.017 = 0.107, but switching both off costs 0.678−0.531=0.1470.678 - 0.531 = 0.147. The parts are partial substitutes. The lesson for the register: record each value as "with everything else on", and never add the column up and call it the value of the whole shop.

Why owning the code makes this possible

A holdout needs three things: a switch that turns a part off for chosen visitors, a record of which visitor was in which group, and a way to join that record to orders, costs and returns. In a shop where every part is your own code, all three are ordinary engineering. Every part sits behind a flag, every exposure is a row in your own database, and every order already carries its contribution. That is the practical meaning of owning your business data.

Rented platforms are moving in this direction, and it is fair to say how far. Shopify's Rollouts can run an Experiment that compares a treatment with a control on the online store, with a default traffic split of 50/50. A rollout can change the main theme, the checkout and accounts configuration, product catalogues and discounts, and experiments are available on the Grow plan or higher11. For comparing two theme designs that is a useful built in tool. Its documented limits are the ones that matter for this chapter: Liquid templates cannot be changed as part of a rollout, headless and custom storefronts are not supported, and experiment reports show conversion, bounce, reached checkout and add to cart rates, with orders and sales available through ShopifyQL queries. Product cost, fulfilment and return costs are not part of them12 (all checked 22 November 2026). Logic that runs on the server, such as how search ranks results, how a delivery date is computed or which products are recommended, lives in the platform or inside an app, and whether an app can be switched off for a random fifth of visitors depends on the app's vendor.

Example: what Callum can test that a theme experiment cannot

Niamh wants to test a change to search ranking: products in stock and with a high margin move up when relevance is equal. This is not a theme change. It is a line in the search service. On Shannonside's own system it is a flag around that line, and the analysis uses contribution per visitor with real product costs and, a month later, real returns. Niamh can also ask the question that matters most for a homeware shop, whether customers who bought through the new ranking come back, by following both groups as cohorts for six months.

Building it: feature flags with Flipper

A feature flag is a switch in the code that decides, for each visitor, whether a part runs. Callum uses Flipper, a widely used Ruby library for flags. Its README shows the setup for Rails with the Active Record adapter, which stores the flags in the shop's own database13. The three commands are:

bundle add flipper-active_record
bin/rails g flipper:setup
bin/rails db:migrate

Flipper can enable a feature for a percentage of actors, where an actor is anything with a flipper_id13. The source shows how the percentage is applied: the feature name and the actor's id are joined, hashed with CRC32 and compared with the percentage, as in the earlier example4. Two consequences follow. A visitor keeps the same group as long as the identifier stays the same. And if you change the percentage halfway through, some visitors switch groups, so the percentage is set once and left alone until the test ends.

Starting the two holdouts takes two lines in the Rails console:

# Search stays on for 80% of visitors in tests; 20% form the holdout
Flipper.enable_percentage_of_actors(:site_search, 80)

# Reviews: a 50/50 test
Flipper.enable_percentage_of_actors(:reviews, 50)

What is the visitor's identifier? Solidus already gives every visitor one. A before_action sets a signed, permanent cookie called guest_token with a random value if the visitor does not have one, and new orders are created with that same guest_token14. So the token links a visitor to their orders without any new tracking. Callum uses it only for visitors who agreed to analytics, because using it for tests is a different purpose from keeping a basket.

Logging who was in which group

The analysis needs to know which visitors were assigned, to which group, and when they first saw the shop under that assignment. One small table holds it:

# db/migrate/20270201090000_create_feature_exposures.rb
class CreateFeatureExposures < ActiveRecord::Migration[8.0]
  def change
    create_table :feature_exposures do |t|
      t.string   :visitor_token, null: false
      t.string   :feature,       null: false
      t.string   :variant,       null: false   # "on" or "off"
      t.datetime :first_seen_at, null: false
    end
    add_index :feature_exposures, [:visitor_token, :feature], unique: true
  end
end

The model writes a row the first time a visitor meets a test and ignores every later visit, thanks to the unique index:

# app/models/feature_exposure.rb
class FeatureExposure < ApplicationRecord
  def self.record(token:, feature:, on:)
    insert_all(
      [{ visitor_token: token, feature: feature.to_s,
         variant: on ? "on" : "off", first_seen_at: Time.current }],
      unique_by: [:visitor_token, :feature]
    )
  end
end

A controller concern puts it together. Every view and controller asks feature_on? instead of calling Flipper directly, so the consent check and the logging can never be forgotten:

# app/controllers/concerns/feature_holdouts.rb
module FeatureHoldouts
  extend ActiveSupport::Concern

  # Parts of the shop that are running as holdout tests right now
  HOLDOUTS = %i[site_search reviews].freeze

  included do
    helper_method :feature_on?
  end

  # true means the visitor gets the part as normal
  def feature_on?(feature)
    return true unless HOLDOUTS.include?(feature)
    return true unless analytics_consent?   # no consent: normal shop, not in the test

    @feature_results ||= {}
    return @feature_results[feature] if @feature_results.key?(feature)

    token = cookies.signed[:guest_token]
    on = Flipper.enabled?(feature, Flipper::Actor.new("Visitor;#{token}"))
    FeatureExposure.record(token: token, feature: feature, on: on)
    @feature_results[feature] = on
  end
end

analytics_consent? is the shop's own method that reads the visitor's choice from the consent banner. In the views the check is one line:

<% if feature_on?(:site_search) %>
  <%= render "shared/search_box" %>
<% end %>

The search results controller asks the same question, so a visitor in the holdout who types a search address by hand gets the category page instead. Callum writes the tests first: a visitor without consent always sees search, a visitor in the holdout never does, and a second request never adds a second exposure row.

Example: what the exposure table holds after a week

After the first week of the search holdout, the table has 17,000 rows for site_search: 13,615 with on and 3,385 with off. That is 80.1% and 19.9%, inside the guardrail of 79.5% to 80.5%. The split is working, and the test continues.

The assignment needs an identifier stored in the visitor's browser, and storing or reading information on a visitor's device is regulated. In Ireland, regulation 5 of S.I. No. 336 of 2011 allows storing information on a user's device, or reading it, only with consent given after clear and comprehensive information, unless the storage is strictly necessary to provide a service the user explicitly asked for15. A holdout run to improve the shop is not strictly necessary for buying a lamp, and the Data Protection Commission enforces these rules, so Shannonside's tests include only visitors who agreed to analytics. This is general information and not legal advice.

Limiting a test to consenting visitors costs visitors, and people who consent may behave differently, so the measured uplift strictly applies to them. For the register, Callum assumes the same relative uplift for every visitor and writes that assumption next to the number.

Example: the size of Shannonside's test population

Shannonside has about 74,000 visitors a month. With 64% consenting, about 47,000 a month can be in tests. Over eight weeks, with returning visitors counted once, that becomes the 80,000 used in all the calculations above. Without the consent limit the same eight weeks would give about 125,000 visitors, and the smallest detectable effect of a 50/50 test would fall from 15.5% to about 12.4%.

The analysis in SQL

Each completed order needs its contribution. The chapter on ROAS, POAS and MER builds an OrderContribution class for Shannonside. Callum stores its result when an order completes, using the Solidus event bus, following the subscriber pattern in the Solidus guides16. The subscriber looks like this:

# app/subscribers/shannonside/contribution_subscriber.rb
module Shannonside
  class ContributionSubscriber
    include Omnes::Subscriber

    handle :order_finalized,
      with: :store_contribution,
      id: :shannonside_store_contribution

    def store_contribution(event)
      order = event[:order]
      OrderContributionRecord.upsert(
        { order_id: order.id, contribution: OrderContribution.new(order).value },
        unique_by: :order_id
      )
    end
  end
end

The query then joins exposures to orders through the guest token, counts only orders completed after the visitor's first exposure and before the test ended, and gives every visitor a total, zero for those who bought nothing:

-- Contribution per visitor in each group of the search holdout
WITH exposed AS (
  SELECT visitor_token, variant, first_seen_at
  FROM feature_exposures
  WHERE feature = 'site_search'
),
per_visitor AS (
  SELECT e.variant,
         e.visitor_token,
         COALESCE(SUM(c.contribution), 0) AS contribution
  FROM exposed e
  LEFT JOIN spree_orders o
         ON o.guest_token = e.visitor_token
        AND o.state = 'complete'
        AND o.completed_at >= e.first_seen_at
        AND o.completed_at <  TIMESTAMP '2027-05-24 00:00'
  LEFT JOIN order_contribution_records c ON c.order_id = o.id
  GROUP BY e.variant, e.visitor_token
)
SELECT variant,
       COUNT(*)                    AS visitors,
       ROUND(AVG(contribution), 4) AS contribution_per_visitor,
       ROUND(STDDEV_SAMP(contribution), 4) AS sd
FROM per_visitor
GROUP BY variant;

The LEFT JOIN is the important part: without it, visitors who bought nothing would vanish, and contribution per visitor would quietly become contribution per buyer. The contribution stored at completion uses the expected return cost. Thirty days after the test ends, when the return window has closed, Callum runs the query again with the actual refunds subtracted, so a part that raises returns is caught. The returns chapter shows how to work out what a return really costs.

Reading the result: an uplift with an interval

A single number is not a result. A result is a number with an interval that says how far it could be from the truth. For the difference between two group averages:

Δ±1.96 σ1non+1noff\Delta \pm 1.96 \, \sigma \sqrt{\frac{1}{n_{\text{on}}} + \frac{1}{n_{\text{off}}}}

where Δ=yˉon−yˉoff\Delta = \bar{y}_{\text{on}} - \bar{y}_{\text{off}} is the measured difference in contribution per visitor, σ\sigma is the standard deviation of contribution per visitor, nonn_{\text{on}} and noffn_{\text{off}} are the group sizes, and 1.96 gives a 95% interval. See Foundations: confidence intervals. Kohavi, Tang and Xu cover the statistics behind it, including when the simple formula needs adjusting17.

To turn a relative uplift into money per month, ask how much less the whole shop would earn without the part. If the shop earns MM a month with the part, it would earn M/(1+u)M / (1 + u) without it, so

V=M(1−11+u)V = M \left(1 - \frac{1}{1 + u}\right)

where VV is the value of the part per month, MM is the shop's monthly contribution before marketing with the part, and uu is the measured uplift. See Foundations: percentages.

Example: the search holdout result

After sixteen weeks, 152,000 visitors are in the test: 121,600 with search and 30,400 without. The query returns €0.654 per visitor with search and €0.566 without. So Δ=0.654−0.566=0.087\Delta = 0.654 - 0.566 = 0.087, and

0.087±1.96×5.12×1121,600+130,400=0.087±1.96×5.12×0.00641=0.087±0.0640.087 \pm 1.96 \times 5.12 \times \sqrt{\frac{1}{121{,}600} + \frac{1}{30{,}400}} = 0.087 \pm 1.96 \times 5.12 \times 0.00641 = 0.087 \pm 0.064

The interval runs from €0.023 to €0.151 per visitor. As uplifts on the €0.566 without search: u=0.087/0.566=15.4%u = 0.087 / 0.566 = 15.4\%, with an interval of 4.0% to 26.8%. In money:

V=44,440×(1−11.154)=44,440×0.13345=5,930V = 44{,}440 \times \left(1 - \frac{1}{1.154}\right) = 44{,}440 \times 0.13345 = 5{,}930

Here M=44,440M = 44{,}440 euro a month, u=0.154u = 0.154, and V=5,930V = 5{,}930 euro a month.

Search is worth about €5,930 a month, and somewhere between €1,709 and €9,393. The report said €16,291. Search really earns about a third of what passes through it, which sits close to what Sharma and colleagues found for recommendations. The guardrails held: the split stayed at 80.0%, returns were the same in both groups, and the holdout wrote 31% more emails to customer service, which is what you would expect when people cannot find things.

Invented example for Shannonside Home, per month. The analytics report credits search with 16,291 euro of contribution from the 726 orders in sessions with a search. The holdout measured the contribution search actually adds at 5,930 euro, with a 95% interval from 1,709 to 9,393 euro. Tap or click to open full screen and move around

The feature value register

The feature value register is one table with a row for every part of the shop: what it is measured to be worth, how sure that is, what it costs, and what was decided. It turns tests into a memory. Without it, the result of a test from last spring lives in someone's inbox and the same argument starts again next year.

Each row holds the uplift and its interval, the monthly value from the formula above, the monthly running cost (software, server, staff time, upkeep), the net value, the guardrail notes, the decision, and the date to test again. Costs include staff time, because a chat window answered by a person is not free.

Example: Shannonside's register after the first year

PartUplift (95% interval)Value a monthCost a monthNet a monthDecisionTest again
Site search15.4% (4.0% to 26.8%)€5,930€170€5,760Keep, invest in rankingSpring 2028
Reviews12.0% (1.1% to 22.9%)€4,761€215€4,546Keep, ask for more reviewsSpring 2028
Delivery date promise5.5% (minus 5.4% to 16.4%)€2,317€90€2,227Keep, retest with a longer holdoutAutumn 2027
Recommendations4.0% (minus 6.9% to 14.9%)€1,709€135€1,574Keep, retest triggered on the basketAutumn 2027
Delivery charge under €40Switchback: €1,350 (€261 to €2,439)€1,350€0€1,350Adopted2028
Extras: chat, wishlist, quick view0.8% (minus 10.1% to 11.7%)€353€640minus €287Drop chat and quick view, keep wishlistAfter the change
Furniture slot pickerNot measurable at this size€50Keep while customer service supports itWhen traffic doubles
Invented example for Shannonside Home. Uplift in contribution per visitor, each part measured on its own with everything else switched on. Site search 15.4%, interval 4.0% to 26.8%. Reviews 12.0%, interval 1.1% to 22.9%. Delivery date promise 5.5%, interval minus 5.4% to 16.4%. Recommendations 4.0%, interval minus 6.9% to 14.9%. Extras bundle 0.8%, interval minus 10.1% to 11.7%. Only search and reviews have intervals entirely above zero. Tap or click to open full screen and move around
Invented example. Estimated value minus running cost per month, each part measured on its own: site search 5,760 euro, reviews 4,546 euro, delivery date promise 2,227 euro, recommendations 1,574 euro, delivery charge under 40 euro 1,350 euro, extras bundle minus 287 euro. Because parts overlap, these values must not be added up to a total for the shop. Tap or click to open full screen and move around

Deciding with an interval, not a verdict

Most rows in a small shop's register will have intervals that include zero. That does not mean "no effect". It means "not proven". Treating every such result as worthless throws away information, and treating every estimate as fact ignores the uncertainty. The useful question is: given what was measured, how likely is the part to be worth more than it costs? With the estimate and its standard error, a normal approximation answers it:

P(u<u∗)=Φ(u∗−u^SEu)P(u < u^{*}) = \Phi\left(\frac{u^{*} - \hat{u}}{\text{SE}_u}\right)

where u∗u^{*} is the uplift at which the part exactly pays for itself, u^\hat{u} is the measured uplift, SEu\text{SE}_u is its standard error (the half width of the 95% interval divided by 1.96), and Φ\Phi is the cumulative normal distribution. See Foundations: distributions and Foundations: probability. The idea of weighing outcomes by their probability is in Foundations: expected value.

Example: recommendations and the extras bundle

Recommendations cost €135 a month. They pay for themselves if V=135V = 135, so u∗=135/(44,440−135)=0.30%u^{*} = 135 / (44{,}440 - 135) = 0.30\%. The measured uplift is u^=4.0%\hat{u} = 4.0\% with a half width of 10.9 points, so SEu=10.9/1.96=5.56\text{SE}_u = 10.9 / 1.96 = 5.56 points, and

P(u<0.30%)=Φ(0.30−4.05.56)=Φ(−0.67)=0.25P(u < 0.30\%) = \Phi\left(\frac{0.30 - 4.0}{5.56}\right) = \Phi(-0.67) = 0.25

Here u∗=0.30%u^{*} = 0.30\%, u^=4.0%\hat{u} = 4.0\% and SEu=5.56\text{SE}_u = 5.56 points.

A one in four chance that recommendations do not pay for themselves, three in four that they do, and the expected value of €1,709 against €135 of cost. Keep them, and test again with a longer holdout triggered on basket views.

The extras bundle costs €640, so u∗=640/(44,440−640)=1.46%u^{*} = 640 / (44{,}440 - 640) = 1.46\%. With u^=0.8%\hat{u} = 0.8\% and the same standard error,

P(u<1.46%)=Φ(1.46−0.85.56)=Φ(0.12)=0.55P(u < 1.46\%) = \Phi\left(\frac{1.46 - 0.8}{5.56}\right) = \Phi(0.12) = 0.55

Here u∗=1.46%u^{*} = 1.46\%, u^=0.8%\hat{u} = 0.8\% and SEu=5.56\text{SE}_u = 5.56 points.

More likely than not, the bundle costs more than it earns. Live chat is €570 of the €640, and the guardrail showed no rise in emails when chat was off. Niamh drops chat and quick view, keeps the wishlist because it costs almost nothing and feeds the back in stock emails, and writes the reasoning into the register so it can be revisited.

That is the whole method in one sentence: measure each part against a random group without it, size the test before you start, decide with the interval, and keep the register. The chapter on the improvement loop turns the register into a monthly routine, and the chapter on experiments goes deeper into the engineering, from sample ratio checks to variance reduction and long running holdouts.

Conclusion

Reports tell you what passed through a part of your shop. Only a comparison with a random group that went without it tells you what the part earned. At Shannonside that was about a third of what the search report claimed.

Measure on contribution per visitor, set guardrails before you start, and calculate the smallest effect the test can see before you hold anything back. For a shop with around 2,000 orders a month that number is sobering: big parts can be measured, small ones only in bundles or on cost. Use triggering where a part is seen by few visitors, switchbacks where everyone must see the same thing, and never add up separately measured values as if the parts did not overlap.

All of this is ordinary engineering when the shop is your own code: a flag around each part, a table of exposures, and a query that joins them to orders and costs you already hold. Keep the results in a register, decide with the interval, and test again when traffic grows.

If you want to know what your search, reviews or delivery rules really earn, book the free workshop: we size the first holdout on your own numbers together, and the first two weeks of work are on me.

Sources

  1. 1.

    Amit Sharma, Jake M. Hofman and Duncan J. Watts, Estimating the causal impact of recommendation systems from observational data, Proceedings of the ACM Conference on Economics and Computation (EC 2015), arXiv 1510.05569, 2015, https://arxiv.org/abs/1510.05569

  2. 2.

    Thomas Blake, Chris Nosko and Steven Tadelis, Consumer heterogeneity and paid search effectiveness: a large scale field experiment, NBER Working Paper 20171, National Bureau of Economic Research, 2014, https://www.nber.org/papers/w20171

  3. 3.

    Ron Kohavi, Diane Tang and Ya Xu, Trustworthy Online Controlled Experiments: A Practical Guide to A/B Testing, chapter 11, Observational causal studies, pages 137 to 150, Cambridge University Press, 2020, https://www.cambridge.org/core/books/trustworthy-online-controlled-experiments/observational-causal-studies/020126527877A19CF7D9AF05CE23518E

  4. 4.

    Flipper, source of the percentage of actors gate, lib/flipper/gates/percentage_of_actors.rb, GitHub, checked 22 November 2026, https://github.com/flippercloud/flipper/blob/main/lib/flipper/gates/percentage_of_actors.rb

  5. 5.

    Ron Kohavi, Diane Tang and Ya Xu, Trustworthy Online Controlled Experiments, chapter 7, Metrics for experimentation and the overall evaluation criterion, pages 102 to 110, Cambridge University Press, 2020, https://www.cambridge.org/core/books/trustworthy-online-controlled-experiments/metrics-for-experimentation-and-the-overall-evaluation-criterion/0A8BF7F06A1338FF6D10C49F4CD8A198

  6. 6.

    Ron Kohavi, Diane Tang and Ya Xu, Trustworthy Online Controlled Experiments, chapter 20, Triggering for improved sensitivity, pages 209 to 218, Cambridge University Press, 2020, https://www.cambridge.org/core/books/trustworthy-online-controlled-experiments/triggering-for-improved-sensitivity/F5862FA880516109EB302984DAED17EA

  7. 7.

    Consumer Rights Act 2022 (No. 37 of 2022), Schedule 3, information to be provided, paragraph (i) on prices personalised on the basis of automated decision making, Irish Statute Book, checked 22 November 2026, https://www.irishstatutebook.ie/eli/2022/act/37/schedule/3/enacted/en/html

  8. 8.

    Iavor Bojinov, David Simchi Levi and Jinglong Zhao, Design and analysis of switchback experiments, arXiv 2009.00148, 2020, https://arxiv.org/abs/2009.00148

  9. 9.

    Consumer Rights Act 2022 (No. 37 of 2022), section 157, inserting section 55(1)(za) and (zb) into the Consumer Protection Act 2007, Irish Statute Book, checked 22 November 2026, https://www.irishstatutebook.ie/eli/2022/act/37/section/157/enacted/en/html

  10. 10.

    Consumer Protection Act 2007 (revised), section 55, as amended by the Consumer Rights Act 2022, Law Reform Commission revised acts, checked 22 November 2026, https://revisedacts.lawreform.ie/eli/2007/act/19/revised/en/html

  11. 11.

    Shopify Help Center, Rollouts: types of rollouts and requirements and considerations, checked 22 November 2026, https://help.shopify.com/en/manual/markets/rollouts/requirements-and-considerations

  12. 12.

    Shopify Help Center, Rollout analytics, checked 22 November 2026, https://help.shopify.com/en/manual/markets/rollouts/analytics

  13. 13.

    Flipper, README (installation with flipper active record, enabling features for a percentage of actors), version 1.4.2, GitHub, checked 22 November 2026, https://github.com/flippercloud/flipper

  14. 14.

    Solidus, source of the controller helpers that set the guest token cookie and create orders with it, core/app/helpers/spree/core/controller_helpers/auth.rb and order.rb, GitHub, checked 22 November 2026, https://github.com/solidusio/solidus/blob/main/core/app/helpers/spree/core/controller_helpers/auth.rb

  15. 15.

    European Communities (Electronic Communications Networks and Services) (Privacy and Electronic Communications) Regulations 2011, S.I. No. 336 of 2011, regulation 5, Irish Statute Book, checked 22 November 2026, https://www.irishstatutebook.ie/eli/2011/si/336/made/en/print

  16. 16.

    Solidus, Subscribing to events, Solidus Guides, checked 22 November 2026, https://guides.solidus.io/customization/subscribing-to-events

  17. 17.

    Ron Kohavi, Diane Tang and Ya Xu, Trustworthy Online Controlled Experiments, chapter 17, The statistics behind online controlled experiments, pages 185 to 192, Cambridge University Press, 2020, https://www.cambridge.org/core/books/trustworthy-online-controlled-experiments/statistics-behind-online-controlled-experiments/9013B5281A1F141FF636F4F6860A04DE