An order export holds three facts about each buyer: when they last ordered, how many orders they placed, and how much they spent. RFM analysis ranks buyers on those three facts (Recency, Frequency, Monetary value) and gives each buyer a group label you can turn into a Klaviyo segment. The worked example below runs the whole method on 20 made-up buyers, so you can see every step and re-run it.

Worked Example: Eight RFM Groups on 20 Made-Up Buyers

Question. How do rank scores sort a small group of buyers into RFM groups?

Inputs. Simulated data, seed 42. The script makes 20 made-up buyers. Each has days since last order, an order count and total spend. It ranks each value and puts the ranks into 5 score bands of 4 buyers each. A higher R score means fewer days since the last order.

Method. The group depends on R and F only. Spend is scored (M) but is not used to pick a group in this example. The rules are the script's own:

  • Champions: R 4-5 and F 4-5
  • Loyal: R 3 and F 4-5
  • Potential Loyalist: R 4-5 and F 2-3
  • New Customers: R 4-5 and F 1
  • Can't Lose Them: R 1 and F 4-5
  • At Risk: R 1 and F 3, or R 2 and F 3-5
  • Hibernating: R 1-2 and F 1-2
  • Need Attention: everyone else
import numpy as np
import pandas as pd

SEED = 42
rng = np.random.default_rng(SEED)
n = 20
customers = pd.DataFrame({
    "customer": np.arange(1, n + 1),
    "recency_days": rng.integers(1, 181, size=n),
    "orders": rng.integers(1, 9, size=n),
    "spend": rng.integers(40, 801, size=n),
})

# Rank within the sample. A high score means recent, frequent, or high spend.
customers["R"] = (
    customers["recency_days"].rank(method="first", ascending=False).astype(int)
)
customers["F"] = customers["orders"].rank(method="first").astype(int)
customers["M"] = customers["spend"].rank(method="first").astype(int)
for col in ("R", "F", "M"):
    customers[col] = np.ceil(customers[col] / n * 5).astype(int)

def label(row):
    r, f = row["R"], row["F"]
    if r >= 4 and f >= 4:
        return "Champions"
    if r == 3 and f >= 4:
        return "Loyal"
    if r >= 4 and f in (2, 3):
        return "Potential Loyalist"
    if r >= 4 and f == 1:
        return "New Customers"
    if r == 1 and f >= 4:
        return "Can't Lose Them"
    if (r == 1 and f == 3) or (r == 2 and f >= 3):
        return "At Risk"
    if r <= 2 and f <= 2:
        return "Hibernating"
    return "Need Attention"

customers["segment"] = customers.apply(label, axis=1)
summary = customers.groupby("segment").agg(
    customers=("customer", "size"), spend=("spend", "sum")
).sort_index()
print(f"Simulated data, seed {SEED}")
print(f"Customers: {len(customers)}")
print("Score bands per measure: 5 "
      "(R and F choose the segment; M is scored but not used)")
print("Segment | customers | summed spend")
for segment, row in summary.iterrows():
    print(f"{segment} | {int(row.customers)} | ${int(row.spend)}")
print(f"Total summed spend: ${int(customers['spend'].sum())}")

Output of that script:

Simulated data, seed 42
Customers: 20
Score bands per measure: 5 (R and F choose the segment; M is scored but not used)
Segment | customers | summed spend
At Risk | 2 | $813
Can't Lose Them | 1 | $778
Champions | 4 | $1116
Hibernating | 5 | $1798
Loyal | 2 | $1174
Need Attention | 2 | $1191
Potential Loyalist | 4 | $1731
Total summed spend: $8601

Result. Seven of the eight groups hold at least one buyer. Hibernating is the largest, with 5 buyers and $1,798 of the $8,601 total. Champions hold 4 buyers and $1,116. Potential Loyalist holds 4 buyers and $1,731. New Customers holds none in this run.

What the data builds in. Recency, orders and spend are drawn independently of one another, so nothing in the data makes a buyer a Champion. Group sizes follow from the draws and the score bands, not from any store. If recency and frequency are unrelated, a rule that covers 8 buyers on R and 8 on F is expected to hold about 3 of 20 buyers (8 x 8 / 20 = 3.2). Champions, Potential Loyalist and Hibernating are rules of that size. New Customers is expected to hold about 1.6. A gap of one or two buyers on a set of 20 is chance, not a finding.

Limit. The data is made up. It does not show the buyer mix or sales of a real store. In a real order export, recency, frequency and spend are usually related, so group sizes will differ.

The Business Question: Which Customers Should I Email?

You have a new product launch, a seasonal sale, or a win-back campaign. You open Klaviyo and see a long list of subscribers. Who gets the email?

Send it to everyone, and you spend effort on customers who may not respond. Segment by "total spend over $500," and you miss recent buyers who have not reached that threshold yet. Filter by "purchased in last 30 days," and you leave out loyal customers who buy quarterly.

RFM combines three behavioral signals: when they last bought (Recency), how often they buy (Frequency), and how much they spend (Monetary value). Looking at them together can show patterns that a single-measure filter misses.

The Hidden Pattern Problem

A customer with $2,000 lifetime spend looks valuable, until you see it was one order 240 days ago. Another customer has spent only $180, but across 6 orders in 8 weeks. Who is more valuable? RFM shows both dimensions together.

What RFM Means

Recency: Days since their last order. Someone who bought yesterday has been in touch more recently than someone who bought 200 days ago.

Frequency: Total number of orders. Someone with 8 orders has a longer record of buying than someone with 1 order.

Monetary: Total amount spent. Someone who spent $1,500 has spent more than someone who spent $40.

RFM analysis scores each customer on all three measures, then groups them. In the example above, a customer who scores high on recency and frequency is a Champion, and one who scores low on both is Hibernating.

Why One Measure Is Not Enough

Take two made-up buyers who both appear in a "total spent $1,000+" list:

  • Customer A: $1,200 spend, 1 order, 280 days ago (one large order, then nothing)
  • Customer B: $1,050 spend, 7 orders, last order 4 days ago (an active repeat buyer)

These customers may need different campaigns. Customer A may need a win-back offer. Customer B may suit early access to new products. A single spend filter puts them in the same list.

RFM separates them. In a store where 280 days is among the longest gaps, Customer A would score low on Recency and Frequency, and under the example's rules would land in Hibernating. Customer B would score high on both and land in Champions.

How RFM Scoring Works

RFM analysis gives each customer a score from 1 to 5 on each dimension. 5 is best, 1 is worst. A customer scored 5-5-5 is at the top of all three.

Step 1: Calculate the Three Measures

For each customer in your order export:

  • Recency: Days between today and their most recent order date
  • Frequency: Count of total orders
  • Monetary: Sum of all order totals

A made-up example customer:

Customer ID: 10284
Last Order Date: 2026-06-28
Total Orders: 4
Total Spend: $387.50

Recency = 14 days (July 12 - June 28)
Frequency = 4 orders
Monetary = $387.50

Step 2: Rank Customers into Five Bands

Sort all customers by each measure and divide them into five equal groups (quintiles). The top fifth gets a score of 5, the next fifth gets a 4, and so on. In the 20-buyer example each band holds 4 buyers.

Recency (fewer days is better): Customers who bought most recently get score 5, customers who bought longest ago get score 1.

Frequency (more orders is better): Customers with the most orders get score 5, customers with the fewest get score 1.

Monetary (more spend is better): Customers who spent the most get score 5, customers who spent the least get score 1.

Step 3: Assign Group Labels

Each customer now has three scores. You choose rules that turn them into a label. The example above uses the R and F rules listed in its Method. For instance, a buyer with R 5 and F 3 falls in Potential Loyalist under those rules.

Quintiles vs Fixed Thresholds

Rank bands adapt to your customer base. A "high-frequency" customer in a subscription business looks different from a "high-frequency" customer in furniture, and bands adjust to your data. Fixed thresholds ("5+ orders = score 5") need you to know the right cutoffs for your business model.

From Order Export to Klaviyo Segments

1. Export Your Order Data

Export your orders from Shopify as a CSV. You need a customer email, an order date, and an order total for each order.

2. Calculate RFM Scores

Run the scoring on your CSV, either with a script like the one above or with an RFM segmentation tool. The steps are the same: group orders by customer email, compute Recency, Frequency and Monetary value, rank each into score bands, and map the scores to group labels.

3. Review Your Group Sizes

Before exporting to Klaviyo, look at how many customers fall in each group and how much they spent. As the made-up example shows, group sizes depend on your data and on your rules. If one group holds nearly everyone, revisit the rules.

4. Prepare a File for Klaviyo

Make a CSV with these columns:

  • Email
  • RFM_Segment (the group label)
  • Recency_Score (1-5)
  • Frequency_Score (1-5)
  • Monetary_Score (1-5)
  • Total_Orders
  • Total_Spend
  • Days_Since_Last_Order

5. Import to Klaviyo and Build Segments

Upload the file to Klaviyo, following Klaviyo's own instructions for importing a file, and map the columns to profile properties. Then build one Klaviyo segment per group, using the RFM_Segment property. Re-import a fresh file whenever you rerun the scoring.

Campaign Ideas by Group

These are ideas to test, not proven results. The groups below come from the example's rules.

Champions: Early Access and Referrals

Goal: Keep your most active buyers engaged and invite referrals.

  • Early access to new products
  • Exclusive colorways or limited editions
  • Referral credits
  • Birthday or anniversary rewards

Consider: Holding back heavy discounts for this group, since they already buy often. Compare a no-discount version with a discount version to see what happens for your store.

At Risk and Can't Lose Them: Personalized Win-Back

Goal: Re-engage buyers who used to order often but have gone quiet.

  • Reference their past purchases: "We noticed you haven't reordered [Product Category] lately"
  • Offer an incentive matched to their past spend
  • Highlight new products in categories they have bought before
  • Ask for feedback: "What can we do to earn your business back?"

Timing: Choose the number of days without an order that counts as quiet for your business, such as a longer gap for slow-cycle products. Follow up once or twice with a stronger offer.

Potential Loyalist and New Customers: Second Purchase

Goal: Help recent buyers make a second purchase.

  • A post-purchase email series with product tips and a cross-sell
  • Cross-sell recommendations based on the first purchase
  • A time-limited offer on the second order
  • Guides and usage ideas for the products they bought

Measure: The share of this group that places a second order, compared across campaign versions.

Hibernating: Light-Touch Re-Engagement or List Cleanup

Goal: Try a light re-engagement, or confirm that these contacts are no longer reading so you can clean your list.

  • A "last chance" message
  • Highlight free shipping or free returns, if you offer them
  • After a few attempts with no opens or clicks, send a re-permission email asking whether they still want to hear from you

The Common Mistake: Treating All Customers the Same

Many stores run campaigns like this:

  • New product launch: email the entire list
  • Seasonal sale: the same discount for everyone
  • Abandoned cart: the same discount regardless of customer value

Groups give you a way to vary the message. Buyers who order often may not need a discount. Buyers who have gone quiet may need a stronger reason to return. Contacts who no longer open your mail cost sending effort, so you can send them less often. Which of these holds for your store is something to check with your own campaign data.

Automation: Updating RFM Segments

RFM scores change as customer behavior changes. A Champion who stops ordering will eventually score lower on recency, and a New Customer who orders again will move to a different group. Rerun the scoring on a schedule that fits how quickly your customers reorder.

Manual Update

  1. Export your orders
  2. Run the scoring
  3. Download the updated segment file
  4. Import it to Klaviyo

Scheduled Script

For hands-off updates, a scheduled job can pull order data, run a scoring script like the one above, and send the updated groups to Klaviyo through its API. This needs setup work, and you are responsible for checking its output.

Data Warehouse and Scheduled Query

If you keep orders in a data warehouse, you can write a query that computes the scores and schedule it. Output the result to Klaviyo through its API or as a file upload.

RFM vs CLV: When to Use Which

RFM analysis and Customer Lifetime Value (CLV) both describe customer value, but they answer different questions.

RFM: Who Are My Best Customers Right Now?

RFM is a behavioral snapshot. It scores customers on what they have done: how recently they bought, how often, and how much. It looks backward.

Use RFM for:

  • Campaign targeting (who gets this week's email?)
  • Spotting customers who have gone quiet
  • Prioritizing customer service resources
  • Segmenting loyalty programs or VIP tiers

RFM is simple to calculate: three measures and a ranking, as the script above shows.

CLV: How Much Will This Customer Spend Over Their Lifetime?

CLV is a forecast. It estimates future value from purchase frequency, average order value, retention and margins. It looks forward.

Use CLV for:

  • Customer acquisition strategy (how much can you spend to acquire similar customers?)
  • Product development
  • Long-term business forecasting

CLV needs more work: cohorts, retention curves and a forecasting model.

Use Both Together

RFM tells you who to target this month. CLV tells you how much they may be worth over time. An At Risk customer with a high CLV forecast is a strong candidate for a win-back offer.

Your turn

Bring your own data and the question you actually need answered.

MCP AnalyticsData science by email Send us your data and your question, and we will reply. ds@mcpanalytics.ai

Common Questions About RFM Segmentation

What is RFM analysis and why does it work for Shopify stores?

RFM analysis scores customers on three behavioral measures: Recency (days since last order), Frequency (total orders), and Monetary value (total spend). Each customer is ranked on each measure, and the ranks are used to give each customer a group label. A customer who bought recently, buys often, and spends a lot is likely worth treating differently from someone who bought once 180 days ago.

How is RFM segmentation different from filtering on one measure?

A filter on total orders or total spend looks at one measure at a time. RFM looks at several together. This can separate customers with high spend but one order long ago from customers with several recent orders, who need different campaigns.

Can I automate RFM segment updates for Klaviyo?

You can repeat the steps on a schedule you choose: export your orders, rerun the scoring, and upload the new segment column to Klaviyo. Follow Klaviyo's own instructions for importing a file. You can also have a script do the scoring.

What's the difference between RFM analysis and customer lifetime value (CLV)?

RFM is a behavioral snapshot: it describes what customers have done so far. CLV is a forecast: how much a customer may spend over the whole relationship. Use RFM for near-term campaign choices, such as who to email this week. Use CLV for longer-term choices, such as how much to spend acquiring similar customers.

How many customers do I need for RFM analysis?

You can run RFM analysis on any customer base. With few customers, each group holds only a few people, as the 20-buyer example above shows. Small groups may be too small for separate campaigns.

Stop Treating VIPs Like One-Timers

Your store has customers who bought 12 times in the last year, and customers who bought once, spent $35, and have not returned in 9 months. If they get the same emails, you are not using what your order export already tells you.

RFM analysis ranks buyers on recency, frequency and spend, then gives each a group: Champions, Loyal, Potential Loyalist, New Customers, Can't Lose Them, At Risk, Hibernating or Need Attention in the example above. Export your orders, run the scoring, upload the groups to Klaviyo, and try campaigns that match customer behavior.