RFM segmentation for ecommerce customers
Segment customers by recency, frequency and spending to choose your next retention action. See how RFM analysis handles new buyers and refunds.
- Published
- Last updated
RFM segmentation groups customers by how recently they bought, how often they buy and how much they spend. Retailers use those purchase patterns to choose different retention actions, such as helping a first-time buyer or contacting a previous regular customer.
A recent first purchase and years of repeat purchases need different treatment. Keep the underlying order history beside the score so the segment explains what to do next.
How RFM segmentation works
Recency, frequency and monetary value (RFM) describe purchasing behaviour within a defined set of orders. Choose one analysis cutoff and an observation window before calculating them.
For the fictional example below, the window is the 180 days ending at that cutoff. Each customer’s measures use qualifying completed orders placed within that window, with refunds known by the cutoff applied.
- Recency is the number of days since the most recent qualifying order. Fewer days receive a higher score.
- Frequency is the number of distinct qualifying orders in the window. More orders receive a higher score.
- Monetary value is net merchandise spending on those orders. Higher spending receives a higher score.
These definitions follow the basic RFM dimensions described in Shopify’s customer-report guidance. The worked example uses its own rules and scoring bands. A platform report can use a different window or calculation, so preserve those definitions when comparing results.
RFM analysis describes recorded purchases. A low frequency score can belong to a happy first-time buyer or someone who buys a durable product only occasionally. The score does not establish a customer’s identity, needs or intention to buy again.
Customer lifetime value asks a separate question about value over the customer relationship. An RFM score alone is not a forecast of future profit.
Build a consistent retail segment
Build one customer-level record from a cleaned order history, using the same calculation rules for everyone in that comparison. Keep the calculation reproducible before assigning segment names.
Start with the fields needed to reconstruct each result:
- A stable customer identifier and a unique order identifier.
- The order timestamp, payment status and fulfilment or completion status used to qualify orders.
- Merchandise amounts after discounts, plus refunds and their timestamps.
- Currency and the chosen treatment of tax and delivery charges.
- Product or category information for interpreting buying cycles.
- First-ever purchase information and a separate record of marketing permission.
Use customer identifiers from your store’s records. Avoid merging different people because they share a name or delivery address. A guest checkout and an account purchase need a confirmed identity match before you combine them.
For this example, monetary value includes GST and excludes delivery. All orders use the same currency. Exclude cancelled and unpaid orders. Remove duplicate order records by order identifier, and count each order once even when it contains several product lines.
Subtract partial merchandise refunds from monetary value. Keep a partially refunded order in frequency while it has positive net merchandise spending. Exclude fully refunded orders from all three measures here. Recalculate recency if that removes the latest order. Customers with no qualifying orders stay outside this scored group.
Those are declared analytical choices. A different report might count refunded orders, which can change its scores without either dataset having a duplicate.
Fictional scoring bands
This small example uses scores from 1 to 3, with 3 highest on each measure. The bands illustrate the calculation and are not industry cut-offs.
| Measure | Score 1 | Score 2 | Score 3 |
|---|---|---|---|
| Recency | 61 to 180 days | 15 to 60 days | 0 to 14 days |
| Frequency | 1 order | 2 or 3 orders | 4 or more orders |
| Monetary value | Below $100 | $100 to below $300 | $300 or more |
Keep equal values in the same band. For example, two customers whose last orders were six days ago both receive recency 3. Do not split tied customers to force equally sized groups. If everyone has one order, frequency cannot distinguish them, whatever scoring scale you choose.
Fictional customer results
The following records summarise qualifying orders within the same 180-day window. Customer labels are fictional. The RFM code records the recency score first, followed by frequency and monetary value.
| Customer | Days since last order | Qualifying orders | Net merchandise spending | RFM code |
|---|---|---|---|---|
| Aster | 6 | 1 | $80 | 311 |
| Banksia | 6 | 4 | $420 | 333 |
| Cedar | 75 | 3 | $240 | 122 |
| Dune | 28 | 2 | $180 | 222 |
| Elm | 100 | 1 | $400 | 113 |
Dune’s latest order was 28 days ago: $120 in merchandise less a $20 merchandise refund leaves $100. An earlier $80 order was 70 days ago. Together they give frequency 2 and monetary value $180. Each measure falls in score 2.
Aster and Banksia have the same recency score but different purchase histories. Separate first-ever purchase information confirms that Aster is new to the store. A single order in this window would not establish that on its own.
Keep the individual measures beside the RFM code. Adding the digits into a total would hide which purchase pattern produced it.
Choose an action for the group
Choose a message that fits the purchase history behind the segment, then apply permission and relevance filters before sending it. An RFM marketing score does not grant permission to contact someone.
For Aster, the new purchaser, start with help using the purchased product. A care guide for a new coffee grinder can answer a practical question. Sending an immediate repeat-purchase offer for another grinder gives the customer little reason to act.
Banksia’s frequent purchases warrant a different check. If the customer repeatedly buys coffee beans, use the pack size and purchase intervals to choose a relevant replenishment message. Confirm that the recommended beans are available and that another order has not already arrived.
Cedar’s last purchase was 75 days ago. If that customer previously reordered a consumable every few weeks, the gap can justify a lapsed-customer segment. A relevant message can explain that their usual product is back in stock. If Cedar bought durable equipment, the same gap is weak evidence of a lapse.
Review unresolved returns and support conversations before sending another sales message. A customer waiting for a refund needs the store to resolve that issue. The RFM code does not contain that context.
The Australian Communications and Media Authority (ACMA) requires consent for marketing emails and messages, with sender identification and an unsubscribe option. Its spam guidance also explains that a purchase alone does not establish inferred consent. Keep the permission record separate from segment membership and honour withdrawals before exporting recipients.
Use RFM groups within your wider customer retention programme. Choose a treatment for a specific buying pattern instead of giving every high-scoring customer the same discount.
Validate and refresh the analysis
Check a segment against real orders before using it in a campaign, then refresh it often enough to match the buying cycle. A score can change because time passes, an order arrives or a refund changes the included history.
Seasonality can make an annual gift buyer look inactive during the rest of the year. A short observation window can erase an established customer’s earlier orders. Comparing weekly grocery purchases with occasional furniture purchases also gives frequency a different meaning.
Compare customers with similar opportunities to buy. Keep new purchasers identifiable and inspect relevant categories separately when their purchase cycles differ. If you change the window or bands, retain the earlier calculation rules so you can explain any movement.
Before a campaign, check the proposed recipients in this order:
- Trace sample customers back to their order identifiers. Recalculate their latest qualifying purchase and confirm the net amounts after refunds.
- Inspect customers at each score boundary and tied values. Confirm that identical inputs receive identical scores.
- Check a new buyer, a fully refunded order and a customer with a recent support problem. Confirm that each receives the intended treatment or exclusion.
- Apply current marketing permission and product-relevance checks. Refresh orders again before sending so a recent buyer does not receive a stale lapsed-customer message.
For a campaign test, compare the treatment with a similar group receiving no campaign message where feasible. Measure purchases after refunds and the cost of the offer, alongside unsubscribes. A high score explains whom you selected. The campaign results show whether that particular message was useful.
Give your store its own shopping agent
Customers ask in their own words. Your agent finds, compares and checks out from your catalogue, right on your site.