Aug 11, 2026 · 10 min read
Product Affinity Analysis: What Sells Together
First-hand guidance from the Daymark team on analytics workflows, growth reporting, and the operational metrics teams use to make decisions.
Product affinity analysis finds which products get bought together, so you can build bundles, post-purchase offers, and merchandising that match how people already shop. You do not need a data team or a machine learning model for it. A single order export and a spreadsheet get you most of the way, as long as you understand three numbers: support, confidence, and lift.
This guide walks through the whole method on a small, fully worked sample. You will see how to count co-occurring pairs, how to compute the three metrics by hand, and the one trap that makes popular products look related to everything. Then how to turn the surviving pairs into offers.
What Product Affinity Analysis Measures
Product affinity analysis, also called market basket analysis, looks at completed orders and asks a simple question: when someone buys product A, how much more likely are they to also buy product B? The answer is a relationship between two items, ranked by how strong and how reliable it is.
Three numbers describe every pair. Each answers a different question, and you need all three because any one of them alone will mislead you.
Support(A,B) = orders containing both A and B / total orders
Confidence(A→B) = orders with both A and B / orders with A
Lift(A,B) = Support(A,B) / (Support(A) × Support(B))
Support is how common the pair is overall. Confidence is how often B shows up given that A was bought. Lift is the one that matters most: it compares the pair's actual co-occurrence to what you would expect if the two items were completely unrelated. Lift above 1 means they show up together more than chance predicts. Lift below 1 means less. Lift near 1 means no real relationship, no matter how often you see the pair.
Working a Real Example, Step by Step
The fastest way to trust these numbers is to compute them on a set small enough to check by hand. Below is a 20-order sample from a home fragrance store selling five products: Candle, Matches, Wick Trimmer, Diffuser, and Reed Refill. Follow the four steps and the metrics will make sense in a way no definition can.
Step 1: Export Orders and List Each Basket
Export your orders from Shopify as a CSV (Analytics, then Reports, then Sales by product, or the raw Orders export). Reshape it so you have one row per order and the set of products in it. For the sample, the 20 baskets look like this:
1 Candle, Matches 11 Candle, Matches, Wick Trimmer
2 Candle, Matches, Wick Trimmer 12 Candle, Matches
3 Candle, Wick Trimmer 13 Candle, Diffuser
4 Candle, Diffuser 14 Candle, Diffuser, Reed Refill
5 Diffuser, Reed Refill 15 Candle, Matches
6 Candle, Matches 16 Candle, Wick Trimmer
7 Candle, Diffuser, Reed Refill 17 Candle, Matches, Diffuser
8 Candle, Matches 18 Candle, Matches
9 Candle, Wick Trimmer 19 Candle, Wick Trimmer
10 Diffuser, Reed Refill 20 Diffuser, Reed Refill
Step 2: Count How Often Each Product Appears
Before pairs, count singles. This is one COUNTIF per product against your basket column. In the sample:
| Product | Orders | Support |
|---|---|---|
| Candle | 17 / 20 | 85% |
| Matches | 9 / 20 | 45% |
| Diffuser | 8 / 20 | 40% |
| Wick Trimmer | 6 / 20 | 30% |
| Reed Refill | 5 / 20 | 25% |
Candle is in 85% of orders. Hold onto that. A near-universal product is the source of the trap you are about to see.
Step 3: Count Co-Occurring Pairs
Now count the orders where both items in a pair appear. With five products there are only ten possible pairs, so you can do this by hand or with a SUMPRODUCT across two product columns. Here are the four pairs that show up most:
| Pair | Orders with both |
|---|---|
| Candle + Matches | 9 |
| Candle + Wick Trimmer | 6 |
| Candle + Diffuser | 5 |
| Diffuser + Reed Refill | 5 |
Ranked by raw co-occurrence, Candle + Matches looks like your strongest relationship and Diffuser + Reed Refill looks middling. That ranking is wrong, and the next step shows why.
Step 4: Compute Support, Confidence, and Lift
Apply the three formulas to each pair. The math is arithmetic you can check on paper.
| Pair | Support | Confidence | Lift |
|---|---|---|---|
| Candle + Matches | 45% | 100% (Matches → Candle) | 1.18 |
| Candle + Wick Trimmer | 30% | 100% (Trimmer → Candle) | 1.18 |
| Candle + Diffuser | 25% | 63% (Diffuser → Candle) | 0.74 |
| Diffuser + Reed Refill | 25% | 100% (Reed → Diffuser) | 2.50 |
Read the Candle + Matches row carefully. Every Matches buyer also bought a Candle, so confidence is a perfect 100%. That looks like a slam-dunk bundle. But lift is only 1.18, barely above chance. The reason: Candle is in 85% of all orders, so almost anything you pair it with hits high confidence automatically. Matches buyers were going to buy a Candle regardless. The pairing tells you almost nothing you did not already know.
Now the Diffuser + Reed Refill row. Same 100% confidence, same 25% support, but lift is 2.50. Reed Refill buyers are two and a half times more likely to also buy a Diffuser than a random shopper is. That is a genuine affinity worth acting on, and raw co-occurrence count buried it near the bottom.
There is a subtler side to the trap. Candle + Diffuser has a lift of 0.74, below 1, meaning those two are slightly less likely to appear together than chance. Diffuser buyers lean toward the reed-and-diffuser side of the catalog, a partly separate segment. A pair can co-occur a fair amount purely because your hero product co-occurs with everything, while still being negatively associated once you account for base rates. That is exactly what lift corrects for.
Turning Top Pairs Into Bundles and Offers
A ranked lift table is not a decision yet. Three moves turn it into revenue, and each one maps to a different pair profile.
Build a bundle from high-lift, high-support pairs. Diffuser + Reed Refill has both real lift and enough volume to matter. Bundle them at a small discount, or add a "frequently bought together" block on each product page. This raises units per order, which is the cleanest lever on average order value. Model the impact before you commit using the AOV calculator.
Use high-lift, low-support pairs as post-purchase offers, not bundles. A pair with strong lift but thin volume is not worth a homepage bundle, but it is a good one-click post-purchase upsell shown only to buyers of the anchor item. You spend no page real estate and only surface it to the audience it fits. Measure whether those offers actually lift order value rather than just cannibalizing, following the approach in post-purchase upsell measurement.
Ignore high-confidence, low-lift pairs. The Candle + Matches type. Bundling them changes nothing because those customers already buy both. Discounting the pair just hands margin away on a purchase that was going to happen anyway.
How Often to Rerun It, and on What Data
Rerun affinity analysis quarterly, or after any catalog change, seasonal shift, or new product launch. Affinities move: a pairing that was strong in Q4 gift season can vanish in Q1. Use a rolling window of the last 90 to 180 days rather than all-time orders, so retired products and old buying patterns do not distort the lift math.
Two data cautions. First, exclude free gifts and automatic add-to-cart items, or they will show fake affinity with everything. Second, decide whether you are analyzing at the product level or the variant level. Variants (a candle in three scents) usually belong grouped as one product for affinity, since scent choice is a separate question from what pairs with a candle at all.
This method scales to a few dozen products in a spreadsheet. Past that, the pair count grows fast and the manual approach breaks down. That is the point where connecting your order history to a workspace that computes support and lift across the full catalog pays for itself, and where affinity pairs become one more input into your broader customer segmentation guide rather than a one-off spreadsheet. Once you have the pairs, the next step is activating them, which is where building Klaviyo segments from store behavior turns an affinity into a targeted flow.
Frequently Asked Questions
What is the difference between confidence and lift in basket analysis?
Confidence is how often item B appears given that A was bought. Lift compares that to how often B appears overall. Confidence ignores base rates, so a popular product posts high confidence with everything. Lift corrects for popularity: a value above 1 means the pair appears together more than chance predicts, and near 1 means no real relationship. Rank pairs by lift, sanity-check with confidence and support.
Why do my best-selling products show high affinity with everything?
Because affinity metrics that ignore base rates reward popularity. If a product sits in most orders, it posts high co-occurrence and high confidence with every other item automatically. That is the lift trap. Switch to lift, which divides observed co-occurrence by what you would expect from each item's overall frequency. A best-seller will usually drop to a lift near 1, revealing that most of its pairings were just it being common.
How much order data do I need for product affinity analysis?
Enough that each pair you act on has a meaningful number of orders behind it, not just a few. A rough floor is several hundred orders over the window you analyze, with at least 20 to 30 orders supporting any pair you turn into a bundle. Small samples produce unstable lift values that swing on a handful of orders. Use a rolling 90 to 180 day window so patterns are current without being too thin.
Should I run affinity analysis on products or variants?
Usually products, not variants. Grouping variants like scent or size into one product keeps each pair's order count high enough to be reliable and answers the question you actually care about: what categories pair, not which color pairs. Analyze at the variant level only when variants behave like genuinely different products with distinct buyers. Splitting too finely scatters your orders across many thin pairs and makes every lift value noisy.
What is a good lift value to act on?
A lift above roughly 1.5 signals a relationship worth acting on, and above 2 is strong, though the right threshold depends on your catalog and order volume. Pair the lift check with support: a high-lift pair backed by too few orders is unreliable. Ignore pairs with lift near 1 even when confidence looks high, since those customers already buy both items and a bundle or discount changes nothing about their behavior.
The Takeaway
Popular products co-occur with everything, so co-occurrence counts and confidence will point you at bundles that change nothing. Lift is the metric that separates a real relationship from a best-seller being a best-seller. Rank by lift, confirm with support, then match each pair to the right play: bundle the high-lift high-volume pairs, use high-lift thin pairs as post-purchase offers, and skip the rest.
For where affinity fits alongside RFM (recency, frequency, monetary) tiers and discount behavior, see the customer segmentation guide. To act on the pairs you find, move to building Klaviyo segments from store behavior.