TapCub is live — analytics, insights and live chat, free on one platform
Glossary

Product Affinity Analysis: Support Confidence and Lift

Product affinity analysis finds items bought together more often than chance. Support, confidence and lift with a 1,000-order example, why high confidence without lift misleads, and how many orders you need.

Sophia Bennett Reviewed by Oliver Reed Also called market basket analysis Last updated Nov 29, 2026 Glossary

Quick answer

Product affinity analysis (market basket analysis) finds products bought together more often than chance. It scores each pair with support, confidence and lift; a pair shows real affinity only when lift is clearly above 1 and enough orders contain it.

Formula: support = orders with A and B ÷ all orders; confidence(A→B) = orders with A and B ÷ orders with A; lift = confidence(A→B) ÷ share of orders with B

What is product affinity analysis?

Product affinity analysis finds products that are bought together more often than chance would predict. It is also called market basket analysis or affinity analysis, and it works on order data: each order is a "basket" of items, and the analysis counts how often items appear in the same basket.

The method comes from association-rule mining. Agrawal, Imieliński and Swami introduced rules of the form "if a basket contains A, it also tends to contain B" and measured them with support and confidence in their 1993 SIGMOD paper (dblp record). Brin, Motwani and Silverstein later showed that support and confidence alone can rank misleading rules highly and proposed measuring correlation instead, with an "interest" ratio and the chi-squared test (dblp record). That ratio is what most tools now call lift.

The practical point of this page: a rule is only worth acting on when its lift is clearly above 1 and it rests on enough orders. High confidence on its own is not evidence of affinity.

Support, confidence and lift

For a rule A → B (customers who buy A also buy B), with N orders in total:

MeasureFormulaAnswers
Support of the pairorders with A and B ÷ NHow common is the pair at all?
Confidence (A → B)orders with A and B ÷ orders with AOf baskets with A, what share also has B?
Lift (A → B)confidence (A → B) ÷ (orders with B ÷ N)How much more likely is B when A is in the basket, compared with any basket?

Lift reads simply: 1.0 means A tells you nothing about B, above 1 means they go together, below 1 means they tend not to. Lift is symmetric (A → B and B → A have the same lift), while confidence is not.

Worked example: 1,000 orders

Sample data: an electronics store has 1,000 orders in a month. 200 contain a phone case, 150 contain a screen protector and 90 contain both.

StepCalculationResult
Support (case and protector)90 ÷ 1,0009.0%
Confidence (case → protector)90 ÷ 20045%
Confidence (protector → case)90 ÷ 15060%
Base rate of protector150 ÷ 1,00015%
Lift0.45 ÷ 0.153.0
Expected orders with both, if independent200 × 150 ÷ 1,00030

The pair appears 90 times where independence predicts 30. A case buyer is three times as likely as an average shopper to add a protector. That is a rule worth testing as a bundle or a cart suggestion.

Why high confidence without lift is a false signal

Now take a charging cable that appears in 600 of the same 1,000 orders, and 130 of the 200 case orders.

RuleConfidenceBase rate of BLiftExpected vs observed
Case → protector45%15%3.0030 expected, 90 observed
Case → cable65%60%1.08120 expected, 130 observed

Sorted by confidence, "case → cable" wins: 65% against 45%. But 60% of all orders contain a cable anyway, so a case in the basket barely changes the odds. Recommending the cable to case buyers would mostly show it to people who were going to buy it regardless.

This is the mistake Brin and colleagues warned about, and it shows up whenever one item is a bestseller: any rule that ends in that item gets high confidence. The decision rule:

  1. Rank candidate rules by lift, not confidence.
  2. Use confidence afterwards to estimate how many baskets a suggestion would hit.
  3. Drop rules whose consequent is in a large share of all orders unless lift is clearly above 1.

Small counts and the minimum-support rule

Lift has the opposite weakness: it explodes on rare items. Suppose a niche lens appears in 5 orders, a tripod mount in 6, and 3 orders contain both:

  • Lift = (3 ÷ 5) ÷ (6 ÷ 1,000) = 100.
  • Expected orders with both if independent = 5 × 6 ÷ 1,000 = 0.03.

A lift of 100 from three orders is noise. Two guards fix this:

  • Minimum support. Only evaluate pairs that appear together in at least a fixed number of orders, for example 20 or 30, chosen before you look at results.
  • A significance check. A chi-squared test on the 2 × 2 table (A yes/no × B yes/no) gives 176.5 for case and protector and 2.6 for case and cable. With 1 degree of freedom, the 5% critical value is 3.841 (NIST/SEMATECH e-Handbook), so only the first association is unlikely to be chance. The test is unreliable when expected counts are tiny, as in the lens example, which is why minimum support comes first.

Product affinity vs RFM and average order value

Product affinity analysisRFMAverage order value
Unit of analysisPairs or sets of itemsCustomersOrders
QuestionWhich items go together?Which customers are valuable or slipping?How much is a typical order worth?
OutputRules ranked by liftCustomer groups by recency, frequency and moneyOne average per period
Typical actionBundles, cart suggestions, store layoutWin-back, loyalty offersFree-shipping thresholds, upsells

The three work together. Affinity rules tell you what to suggest, RFM tells you whom to suggest it to, and AOV tells you whether the suggestion changed basket value. Cross-selling is the tactic; affinity analysis is the measurement behind it. For customer-level questions such as who is likely to buy again, see customer data analytics.

How to run it step by step

  1. Export order lines. One row per item per order: order ID, item ID or category, date. Remove refunded orders and test orders.
  2. Choose the level. Individual SKUs give thin counts; categories (cases, protectors, cables) give stable ones. Start at category level.
  3. Fix the window. Use a period long enough to reach your minimum support, such as 90 days, and keep it constant when you compare.
  4. Count pairs and compute support, confidence and lift for every pair above the minimum support.
  5. Filter: lift above a threshold you set in advance (for example 1.5) and the chi-squared value above 3.841.
  6. Test before rolling out. An affinity rule is a correlation. Whether showing the suggestion raises basket value is a separate question that needs a controlled comparison.

Measuring basket behaviour with TapCub

TapCub has no built-in market basket report. What it gives you is the order data and the before/after measurement. The 1,000-order example would run like this:

  1. Record orders with an order ID. All-platform analytics › Business › Commerce & revenue reads purchase events that carry an order ID, revenue and currency, and shows revenue, orders, buyers and average order (revenue ÷ orders).
  2. Send line items as events. The purchase event carries the order total, not the items. To count pairs, send one event per order line (for example order_item) with the order ID and item or category as properties.
  3. Count pairs with SQL. In All-platform analytics › Behavior › Metrics & SQL, the SQL tab runs one SELECT or WITH statement against the project's events view; a self-join on order ID returns pair counts, and the result can be exported as CSV (up to 50,000 rows). Support, confidence and lift then take a few spreadsheet formulas.
  4. Measure the change. After launching a bundle, compare average order value on Commerce & revenue for the periods before and after, and use All-platform analytics › Users › Segments & tags (including the RFM groups) to see which customers take it up.

TapCub does not show product recommendations on your store or run the controlled test; it measures what happens after you do.

Sources

  • R. Agrawal, T. Imieliński, A. Swami, "Mining association rules between sets of items in large databases", SIGMOD 1993, dblp record.
  • S. Brin, R. Motwani, C. Silverstein, "Beyond market baskets: generalizing association rules to correlations", SIGMOD 1997, dblp record.
  • NIST/SEMATECH e-Handbook of Statistical Methods, Critical values of the chi-square distribution.

Was this explanation clear?

We use your answers to fix and expand this page.

Sophia Bennett

Product Adoption Consultant

Explores customer onboarding, live conversations, and self-service, turning common usage questions into practical guidance and improvements.

FAQ

Questions people ask

Short answers to the follow-up questions that come up most.

Still have a question?

Chat with the team behind TapCub — we usually reply within a few hours on business days.

What is the difference between product affinity and market basket analysis?

They are usually the same thing. Market basket analysis is the classic retail name for finding items that appear in the same order; product affinity analysis is the broader marketing name and sometimes also covers items bought by the same customer over time rather than in one basket.

What is a good lift value?

Lift above 1 means two items go together more than chance. In practice teams set a threshold in advance, often 1.5 or 2, and also require a minimum number of shared orders, because a high lift built on three orders is noise.

Why not just use confidence?

Confidence ignores how popular the second item already is. If a cable is in 60% of all orders, any rule ending in the cable gets high confidence. Lift divides by that base rate, so it shows whether the first item actually changes the odds.

How many orders do you need for affinity analysis?

Enough for the pairs you care about to reach your minimum support, such as 20 to 30 shared orders. Small shops usually reach that faster by analysing categories rather than individual SKUs and by using a longer window, such as 90 days.

See this number on your own site

Add one script tag for web and apps, and the first reports fill in within minutes.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics