Marketing

RFM analysis for ecommerce: customer segments, LTV and cohorts

RFM analysis for ecommerce: score customers 1 to 5, a worked example, LTV per segment, value cohorts and ready segments for email, ads and GDPR.

The CloudCart team19 min read
Hands sorting small cardboard cards into three stacks of different heights on a light table, next to a notebook with an abstract grid of dots
In this article · 11 sections
  1. What is customer segmentation, and what data does RFM need?
  2. The RFM model: how to calculate R, F and M
  3. Worked example: RFM segmentation of 10 customers, step by step
  4. LTV formula by segment: what a customer is worth
  5. Value cohorts: when a new customer pays back
  6. How to build segments in CloudCart
  7. Email, SMS and Viber by segment: what to send
  8. Segments as audiences in Meta, Google and TikTok
  9. An AI agent runs the RFM and LTV analysis for you
  10. Customer segmentation mistakes to avoid
  11. Frequently asked questions

RFM analysis scores every customer from 1 to 5 on three things: how recently they bought (Recency), how often (Frequency) and how much they spent (Monetary). The scores turn your customer list into a handful of segments, each with its own message. Add LTV (what a customer is worth over the whole relationship) and value cohorts (when a new customer pays back what you spent to win them), and all three come from the orders your store already has.

This guide gives the formulas, a worked example with numbers you can follow, spreadsheet formulas for Google Sheets and Excel, and the steps in the CloudCart admin. It is written for stores selling anywhere in the EU, so it also covers what the GDPR asks of you before a segment gets its first email or becomes an ad audience. The numbers in the examples are illustrations. Retention rate and churn are covered in the article on retention marketing.

What is customer segmentation, and what data does RFM need?

Customer segmentation splits your customer base into groups that share behaviour or value, so each group gets a different message, discount or ad. For people who have already bought from you, behaviour is the most accurate basis, because it comes from real orders rather than from guesses about age or interests.

For RFM, LTV and cohorts you need four fields per customer:

  • Date of the last order (for R and for cohorts).
  • Number of orders in the chosen period (for F).
  • Total order value (for M and for LTV).
  • Date of the first order (for cohorts).

In CloudCart the order count and total spend sit in each customer's profile, and Customers → Export gives them in the Orders Count and Total Spent columns, together with a Marketing column (yes/no) for marketing consent. Which orders count towards a subscriber's revenue is set in Marketing → Subscribers → Settings, in the "Revenue statuses" field; most stores leave returned orders out. The customer profile itself is described in the guide to customer segmentation and CRM in CloudCart.

If you run a separate store for each country, each with its own language and currency, score each store on its own. Order values and buying cycles differ between markets, and one shared threshold would push a whole country into "low value" just because baskets there are smaller.

The RFM model: how to calculate R, F and M

The RFM model gives each customer three scores from 1 to 5: R for how recently they bought, F for how often they buy and M for how much they have spent. A score of 555 is your best customer; 111 bought once, a small amount, a long time ago.

There are two ways to assign the scores:

  • Quintiles, for customer bases above roughly 1,000 people. Sort customers by the metric and split them into five equal parts: the top 20% get a 5, the next 20% a 4, and so on down to 1. For R, the fewest days since the last order gets the 5.
  • Fixed thresholds, for small bases and for anyone who wants a score to mean the same thing every month. The thresholds follow the buying cycle in your niche.

Example thresholds for a store whose customers reorder every 1 to 2 months:

ScoreR: days since last orderF: orders in 12 monthsM: spend in 12 months
5up to 145 or more€400 or more
415 to 304€200 to €399
331 to 603€100 to €199
261 to 1202€50 to €99
1over 1201under €50

A store selling furniture or electronics, where people reorder once a year, needs much longer R windows; a coffee or pet food store, shorter ones. Set R so that a 3 means "around the time a typical customer would order again".

Quintiles in Google Sheets or Excel: with order counts in column C (rows 2 to 1001), the F score in row 2 is =MIN(5, 1+INT(PERCENTRANK.INC(C$2:C$1001, C2)*5)). Use the same formula for spend. For R, where fewer days is better, with days in column B: =6-MIN(5, 1+INT(PERCENTRANK.INC(B$2:B$1001, B2)*5)). Copy the formulas down and join the three scores with =D2&E2&F2 to get the RFM code.

Worked example: RFM segmentation of 10 customers, step by step

Ten customers of a cosmetics store get scores by the thresholds in the table above and land in a segment. The numbers are made up so you can follow the maths.

CustomerDays since last orderOrdersSpendRFMSegment
A56€420555Champion
B124€260544Champion
C203€310434Loyal
D352€95322Promising
E485€530355Loyal
F701€40211About to sleep
G952€120223About to sleep
H1304€380144At risk
I2001€55112Lost
J2901€30111Lost
  1. Choose the period. The last 12 months.
  2. Assign the scores. R, F and M for each customer by the thresholds. Customer E has 48 days, 5 orders and €530, so E is a 355.
  3. Merge the scores into segments. Champions: R and F both 4 or 5. Loyal: everyone else with F of 3 or more and R of 3 or more. Promising: F up to 2, R of 3 or more. About to sleep: F up to 2, R of 2. At risk: F of 3 or more, R of 1 or 2. Lost: R of 1 and F up to 2.
  4. Work out each segment's share of revenue. Of €2,240 in total, champions and loyal customers (A, B, C, E) bring €1,520, or 68%. Customer H brings €380 (17%) and has not ordered for 130 days.
  5. Pick the action. The most urgent is customer H: a regular buyer who is drifting away.

Most RFM guides stop at the segment names. The revenue share is what tells you where to spend your time: here four customers out of ten carry two thirds of the business, and one of the remaining six is worth more than the five weakest put together.

LTV formula by segment: what a customer is worth

LTV (lifetime value, also written CLV) is the revenue or profit one customer brings while they keep buying from you. The basic formula is LTV = average order value × orders per customer per year × expected years as a customer × margin. LTV and CAC as store KPIs are covered in the article on ecommerce KPIs; here the formula is applied per segment.

The calculation for the 10 customers in the example:

  1. Average order value (AOV). €2,240 revenue ÷ 29 orders = €77.24.
  2. Frequency. 29 orders ÷ 10 customers = 2.9 orders per customer per year. A customer's yearly value is €77.24 × 2.9 = €224.
  3. Expected customer lifetime. 1 ÷ yearly churn (the share of customers who stop buying within a year). With 40% churn, a customer buys for 1 ÷ 0.4 = 2.5 years on average.
  4. Revenue LTV. €224 × 2.5 = €560.
  5. Profit LTV. At a 35% gross margin: €560 × 0.35 = €196. That is the ceiling for what you can pay to win a new customer.

An average LTV hides the differences. In the example, champions bring €340 each a year and lost customers €42.50. That is why ad budgets and discounts should be set per segment, not for the store as a whole.

Type of LTVHow it is calculatedWhat it is for
HistoricalThe sum of all the customer's orders so farA list of your most valuable customers, the value column for a Meta audience
PredictedAOV × frequency × expected yearsBudget planning and a target for repeat purchases
ProfitPredicted LTV × gross marginThe maximum you can pay for a new customer (CAC)

In CloudCart Analytics, the Customer Value card divides revenue in the selected period by the number of unique customers. That is LTV for the period; full LTV you calculate from the orders (see analytics in CloudCart).

Value cohorts: when a new customer pays back

A cohort is a group of customers whose first order fell in the same month. Value cohorts show the accumulated revenue per customer in each group after 1, 2 and 3 months, so you see when the profit from a new customer covers what you paid to acquire them. The table with the share of returning customers is in the article on cohort analysis for retention; here the focus is the money.

Example (illustration), accumulated revenue per customer:

First orderNew customersMonth 0Month 1Month 2Month 3
July120€48€58€66€71
August150€45€54€61
September110€52€67
October140€47

How to read it: with a customer acquisition cost of €25 and a 35% margin, the July cohort reaches €71 × 0.35 = €24.85 of gross profit in month 3, so a new customer pays back in about 3 months. The September cohort is already at €67 in month 1: find out what you changed that month and keep it.

You build the table from the order export (Orders → Export) with a pivot table by customer email and month of first order, or by asking an AI agent, as shown further down.

How to build segments in CloudCart

In CloudCart, segments live in Marketing → Segments and are built from more than 60 conditions: orders, spend, average order, date of last order, viewed products, abandoned cart, channel, tags and RFM group. All conditions in one segment are joined with "AND"; for "OR" you create a separate segment. The hint in the editor recommends up to 4 conditions.

The built-in RFM groups

On the CC Pro and CC Master plans (see the comparison on the pricing page), every subscriber is placed automatically into one of 17 RFM groups: Champ, Active Loyal, Active Loyal High-spender, New High-spender, Active Potential, New, Loyal High-spender, Loyal, Potential High-spender, Potential, Occasional High-spender, Occasional, Churned Loyal High-spender, Churned Loyal, Churned High-spender, Churned and "Without RFM Analysis" for people with no history. The groups are recalculated every 12 hours. The look-back period is set in Marketing → Subscribers → Settings, in the "RFM interval (days)" field, and is 90 days by default. A heat map of the groups is at the bottom of the Marketing Suite dashboard.

A segment, step by step

  1. Open Marketing → Segments → Create segment. Choose "New segment from scratch" and then the type. An automated segment updates itself (about every 5 minutes and on every new order), and a campaign aimed at it starts when a customer enters. A one-time segment is a snapshot at the moment of creation. The type cannot be changed afterwards.
  2. Add the conditions. For "At risk" from the example: Order → Count greater than 2, last order more than 120 days ago and Spend greater than €200. On CC Pro or CC Master one condition is enough: RFM group "Churned Loyal" or "Churned Loyal High-spender".
  3. Or start from a template. There are 6: High Spenders, One-timers, Special product fans, Returning customers, Loyal customers and Cart abandoners. They create a one-time segment; for an automated one, repeat the conditions in a segment from scratch.
  4. Or describe the segment in a sentence. "Generate with AI" turns text such as "customers with at least 3 orders who have not ordered for 4 months" into conditions. Check them before you save: the segment is one-time, and the system itself warns that the generated rule may not be 100% accurate.
  5. Check who is inside. The number in the "Subscribers" column opens the list of people in the segment. From there you add a specific customer by hand, and "Generate CSV file" exports the list for ads.

The difference between a segment and a customer group is explained in the article on customer loyalty programs.

Email, SMS and Viber by segment: what to send

Every campaign in CloudCart goes to a segment: in Marketing → Campaigns → Create campaign you choose the segment, the channel and the content. The channels are email, SMS, Viber and Web Push; SMS and Viber are switched on in Marketing → Channels. For email and Viber you see whether the message was read and can branch the next step on it.

SegmentGoalChannelMessage
ChampionsKeep themEmailEarly access to new products, no discount
LoyalBigger ordersEmailComplementary products and bundles
PromisingA third orderEmail, then Web PushBestsellers from the category they bought
About to sleepA reminderEmailWhat is new in the store, "missing anything? write to us"
At riskStop them becoming lostEmail, then Viber if the email is not readA personal message, a discount for this group only if needed
LostWin back, or write less oftenEmailOne win-back message, then a lower frequency

For a discount that only one segment gets, the automated campaign moves the customer into a customer group, and in Marketing → Discounts you limit the discount to that group. Champions are not trained to wait for a sale (see discounts in CloudCart). Set the sending frequency by the segment's opens and clicks, not by a fixed number of emails a week. If you sell in several countries, add a country condition and send each market its own language version. Channel setup is in the guide to SMS, Viber, email and Web Push campaigns, and the overview is on the Campaigns page.

Important: a campaign reaches only a subscriber who gave marketing consent, has a confirmed channel, has not unsubscribed and has no bounced email. Unsubscribing is one-way: the store cannot reverse it, only a new explicit consent can. This also follows Article 21 of the General Data Protection Regulation (GDPR), which applies across the EU since 25 May 2018: people can object at any time to direct marketing, including profiling for it, and after an objection their data may no longer be used for that purpose. The European Commission states plainly that no advertising goes to anyone who objected. Unsubscribed customers receive nothing on any channel.

Segments as audiences in Meta, Google and TikTok

A CloudCart segment becomes an ad audience through a CSV file: you export the list from the store and upload it to the ad platform as a customer list audience. Upload only customers with marketing consent recorded (Marketing column = yes), and state in your privacy policy that you share data with ad platforms.

StepIn CloudCartIn the ad platform
The listMarketing → Segments → "Generate CSV file", or Customers → Export (with Total Spent)A column for email and one for phone with the country code (+49, +43, +39 and so on)
MetaThe Total Spent column as customer valueAudiences → Create audience → Custom audience → Customer list; when uploading, map the column with customer value
Google AdsThe "Champions" segment, or all buyersCustomer Match: a list for observation, or for exclusion from new-customer campaigns
TikTokThe TikTok Ads app in CloudCart creates an audience from an uploaded file and a lookalike audienceTools → Audience Manager → Create Audience → Custom Audience → Customer File

A value-based audience in Meta serves as the source for a value-based lookalike: Meta looks for people who resemble your highest-value customers (Meta help on customer value audiences). Refresh the file every month.

In Google Ads, Customer Match for observation and exclusion is open to every account with a good policy compliance and payment history. Targeting only the list requires 90 days of Google Ads history and more than USD 50,000 in lifetime spend, and a list stays eligible while at least 100 members are added or updated within 540 days (Google's Customer Match policy). For users in the EEA you must also pass consent signals with the data (Google Ads help). For a small store the most useful option is exclusion: your champions stop seeing ads meant for new customers, and the budget goes to people who have not bought yet.

In TikTok the file is CSV or TXT, with at least 1,000 rows, one identifier per row and a header row such as Email or Phone; the audience appears within 24 to 48 hours (TikTok Ads help). Audiences of visitors and people who did not buy are covered in the article on remarketing.

An AI agent runs the RFM and LTV analysis for you

An AI assistant such as Claude Code, ChatGPT/Codex, Gemini CLI or Cursor reads your store's orders and customers through the CloudCart Admin API and calculates RFM scores, LTV by segment and value cohorts from a single sentence. It connects with a PAT token from Settings → PAT Tokens; for the analysis the orders:read and customers:read scopes are enough.

Example prompts for the agent:

  • "Run an RFM analysis of customers for the last 12 months with quintiles from 1 to 5. Give me the number of customers and the share of revenue for champions, loyal, promising, about to sleep, at risk and lost."
  • "Calculate predicted profit LTV for these segments at a 35% margin, with churn taken from the store's data. Show the calculation."
  • "Build a table of accumulated revenue per customer by month of first order for the last 6 months, months 0 to 3."

The agent can also write the result back into the store. Segments are not created through the API, but with a key that has Customers: Read & Write the assistant tags subscribers (for example "ltv-top10"), and in Marketing → Segments you create an automated segment with a condition on that tag. Ask the agent to show you who it will tag before it does. Creating the key is described in the guide to the PAT token.

Customer segmentation mistakes to avoid

  • Too many segments. Six segments with different messages work better than twenty that get the same email.
  • A one-time segment for a flow. A snapshot does not update and new customers never enter it. For behaviour-based emails use an automated segment.
  • Returned orders counted as revenue. If the "returned" status is ticked in "Revenue statuses", M and LTV come out higher than they really are.
  • One threshold for every country. If baskets differ by market, a shared M threshold labels a whole country as low value. Score each store, or each currency, separately.
  • A discount for everyone. Champions buy without one. The discount is for "At risk" and lost customers, limited to their customer group.
  • Messages to people who unsubscribed. A customer who unsubscribed or never consented enters no campaign, on any channel.

Frequently asked questions

RFM analysis scores each customer from 1 to 5 on Recency (days since the last order), Frequency (number of orders) and Monetary value (total spend). The combined scores sort customers into segments such as champions, loyal, at risk and lost, and each segment gets its own message, discount and ad budget.

Export your customers with the date of the last order, the number of orders and total spend. Give each customer a score from 1 to 5 by quintiles with PERCENTRANK.INC or by fixed thresholds, then group the three scores into segments such as champions, at risk and lost. An AI assistant does the same from one sentence.

LTV = average order value × orders per customer per year × expected years as a customer. Expected years are 1 ÷ yearly churn. For advertising decisions, multiply the result by your gross margin: that gives you profit LTV, the ceiling for what you can pay to acquire a customer.

Most stores do well with 5 to 7: champions, loyal, promising, about to sleep, at risk, lost and new. Add a segment only when you have a different message for it.

17 groups, including Champ, Active Loyal, Loyal, Potential, Occasional, New, Churned Loyal and Churned, plus "Without RFM Analysis" for people with no history. The groups update every 12 hours and can be used as a segment condition. RFM analysis is included in the CC Pro and CC Master plans.

Scoring your own customers' orders for marketing is profiling for direct marketing, and under Article 21 of the GDPR every person can object to it at any time. Describe it in your privacy policy, send campaigns only to people with marketing consent, and stop all marketing to anyone who objects or unsubscribes. This is a summary, not legal advice.

Yes. Export the segment as a CSV from Marketing → Segments and upload it to Meta as a Custom audience from a Customer list. If you add a column with customer value, the audience can be the source for a value-based lookalike. Upload only customers with marketing consent.

A cohort is a group of customers whose first purchase fell in the same period, usually a month. Comparing cohorts shows whether new customers come back more often over time and how many months it takes for them to pay back what you spent to win them.

Have a question about segments or campaigns in your store? Write to us at support@cloudcart.com.

Sources

  1. General Data Protection Regulation (GDPR)eur-lex.europa.eu
  2. European Commissioncommission.europa.eu
  3. Meta help on customer value audienceswww.facebook.com
  4. Google's Customer Match policysupport.google.com
  5. Google Ads helpsupport.google.com
  6. TikTok Ads helpads.tiktok.com
The CloudCart teamChecked against the platform documentation. Questions: support@cloudcart.com

Build your online store

The first 3 months on every plan are €1/month. Questions: support@cloudcart.com

Create a store for €1