RFM analysis for Shopify stores: a comprehensive guide

RFM analysis is a powerful tool for understanding how your customers behave.

Once you understand how they behave, you can work to encourage or adjust their behavior towards goals that benefit your store. e.g. place another other, write a product review, etc.

What is RFM analysis?

RFM analysis at its core is a data analytics algorithm that looks at behavior. Specifically customer behavior.

Don't let the jargon scare you off.

By the time you finish reading this article, you'll know plenty about RFM. I promise I won't get into too much math.

RFM is pretty flexible as far as data models go. It can be used by a wide variety of ecommerce stores:

It can also be used to measure a wide variety of behavior:

Like the 80/20 principle, it can be applied to almost any behavior.

That said, for ecommerce and Shopify stores there's one primary purpose:

measure customer purchase behavior for RFM segmentation.

RFM customer segmentation, it's all about the buckets

RFM when used for customer segmentation will group customers into different buckets based on their behaviors.

Customers who buy a lot go into one bucket.

Customers who spend a lot of money go into another bucket.

Etc, etc.

The difference between RFM segmentation and other segmentation methods is that RFM is only looking at customer behavior. It doesn't look at demographic data (e.g. age, gender), psychographic data (e.g. hobbies, values, attitudes), or anything else other than ordering data.

As you'll see soon, this makes it incredibly easy to understand the scoring once you get past the basics.

(Also, for those privacy-minded people: by avoiding all of that data you can avoid a lot of the headaches that come from personally identifiable information (PII), which can reduce your risk from GDPR-like laws)

Calculating RFM and the RFM analysis

Let's jump right into RFM by looking at what customer ordering data it uses. You might be surprised at how little it needs, which is why it works even for small stores without a data scientist on staff.

The three components of the RFM score

RFM is composed of three different components that each measure something different. Let's define them really quick as we'll come back to them often.

Now that those have been defined we can get into calculating them. RFM gets a bit tricky here.

Calculating Recency

Recency is measuring the customer's last order only so data-wise, all you need is the last order date (or date and time) for each customer.

But RFM doesn't just use the dates as they are, it groups them. Sidebar time...

Grouping customers, or why quintiles are so cool

Using the raw order date gets funky because how would you score someone who ordered last Monday vs the 4th of last month?

You'd end up making a bunch of judgments or guesses and end up having a model that needs a lot of tuning before it worked.

RFMs groups solve that by making a set number of groups the same size.

Let's say you have six customers who ordered: last Monday, last Tuesday, last Wednesday, last Thursday, last Friday, and last Saturday (they had Sunday off...).

First thing RFM does is sort the customers by the ordering dates.

For Recency specifically, customers who ordered the most recent are more active so RFM reverses the sort (newest, the most recent at the top)

Now RFM distributes customers into buckets so each bucket is roughly equal. We'll use three buckets because there's only six customers and that'll make for a simple example.

Next each bucket gets a value, with higher values better. The values are based on the number of buckets used, three in this example. So Bucket one which has last Saturday's and last Friday's customers in it, is assigned the value of 3. Bucket two gets the next lowest value (2) and Bucket three gets the lowest value (1).

Three buckets isn't good enough for most stores. You only get three recency segments (and you'll find you only get nine total RFM segments). Not a lot of variety or options to work with customer behavior.

That's why most real-world RFM models use quintiles, aka five buckets. (Funny how math people like to use complex names to describe basic things...)

With five buckets, you balance power (lots of segments) with ease of understanding (only five numbers).

Back to Recency itself...

Calculating Recency (continued)

After that sidebar, you've already seen how to calculate recency for three groups. It's the exact same process for five groups, only you have more buckets to distribute those sorted customers into.

The easiest way to do this distributing is to find out how many customers you have in total and then divide by five. This is how many customers should be in each bucket (ignore rounding).

If you have your customers sorted by their last order date, with the most recent at the top, just count down that many customers for your first bucket. Give them the recency score of 5.

Count down the next set of customers, give them a recency score of 4.

Continue on until the last group which gets a score of 1. You might have some leftover customers at the bottom, just give them a score of 1.

(RFM analysis doesn't have to be super-precise with this rounding as you'll see later. There'll be a lot of activity over-time that balances out any rounding errors).

So if you had 20 customers, each quintile group would have 4 customers in it. The top four would be scored with a 5, the next four would be scored with a 4, the next four a 3, the next four a 2, and the final four a 1.

At this point, you should have sorted and scored all of your customers for Recency. Onto the next component.

Calculating Frequency

The second component of RFM is Frequency. Remember the definition of frequency is how many times a customer has placed orders.

As you might suspect by now, you don't use the actual number of orders for the frequency score. If Harry ordered 7 times and Sally ordered 8 times, their frequency score isn't 7 or 8.

Just like you did with recency, you're going to want to sort your entire customer base. This time though, you'll use their number of orders from highest to lowest. e.g. Sally with 8 orders will be above Harry's 7.

Don't worry about the size of the order or any of that. Just how many orders has each customers placed.

Once they are sorted, follow the same process as before and count down the customers to distribute to each bucket. Start with 5 for the first set, then 4, etc.

There are two modifiers I like to make to Frequency.

Cancelled and fully ordered

When counting orders, if an order has been fully cancelled or refunded then I like to skip it. Additionally if an order's total is 0 like if an order if comped or a replacement order, I'll skip it too.

Most cancelled orders are due to some customer behavior you don't want to measure or reward. e.g. returns, replacements, fraud, etc.

By excluding them in the analysis, that helps frequency measure the actual orders which is the point of the RFM analysis.

Ecommerce store frequency

The vast majority of customers for Shopify and other ecommerce stores only place one order. This means many of your buckets will be filled with these one-time ordering customers. I've seen them fill up all of the 4, 3, 2, and 1 buckets in many stores.

If all of those buckets are filled with similar customers, it weakens your analysis and RFM as a whole.

In my app I use a modified version of Frequency. Basically, if a customer only has one order then they get a score of 1. Then the remaining customers are distributed into the 5, 4, 3, and 2 buckets. This spreads out your repeat customers across four scores with lets you detect a lot more behavior.

It's a little bit more math but you get way better results this way.

Calculating Monetary

With two of your RFM component's scored, there's only two steps left.

As you might suspect, calculating Monetary follows the same process as before. It's also a straight-forward calculation if you have the customer's Lifetime Value already (CLTV or LTV). If you don't track that, just total up all orders for each customer.

Sort the customers as before with the higher amounts on the top and start distributing them into buckets.

Calculating the RFM score

At this point, every customer should have three scores with values from 5-1: recency, frequency, and monetary.

Turning that into the final RFM score is easy but be careful as there's a potentially big mistake here.

Take each of the scores and combine them together into a three-digit score. Don't add the three scores, just smash them together like a runonsentence.

This is the final RFM score for each customer.

If you've had trouble calculating everything or scoring the customers, my app Repeat Customer Insights will do all of the calculations for your Shopify store.

Making sense of the RFM score

Now that you've scored all of your customers, it's time to interpret what the scores mean.

This is the fun part and the whole point of the RFM analysis.

Each column matters

When reading a score, don't read it as a three-digit number. Each column or place-value should be looked at separately. The three digit score is just a shorthand.

Let's use the examples from above:

Based on this, Harry's score of 531 isn't better than Sally's 444. Harry's Recency is better (5__ vs 4__) due to them ordering more recently. But Sally's Frequency beats Harry's (_4_ vs _3_) and as well as their Monetary (__4 vs __1).

What I like to do in my head is to read down the column when comparing the score across customers. It makes the changes easier to spot.

Deciding is Harry is a better customer than Sally requires a talk about what your goals are with the RFM analysis. Different goals will give you different answers.

What makes a good or healthy RFM Score?

With multiple components coming out from the analysis, now is the time to figure out what's a good score.

Since we used five buckets, anyone with a score of five in any of the three components could be considered strong in that area. But what about fours? Can a pair of fours make up for a five? What about straight threes, can that beat a single five?

Sounds like poker game invented by statisticians.

Let's dig into the analysis portion.

Every store's analysis should be guided by their goals. That means every store's analysis will be different and even the same store will have different results depending on how their goals change over time. That's okay and totally fine.

Option 1: Analyzing one RFM component

If your goal matches what one of the three RFM components measures, you'll have an easy time with the analysis. You just pick the component that matches your goals and then customers with a score of 5 are your best, 4 are good, 3 are so-so, etc.

By using one component, you'll get five customer segments corresponding to the five buckets from earlier.

You might notice that you'll end up ignoring the other two components of the score, and that's fine in some cases. The RFM analysis is designed to give you multiple customer segmenting options but it could be that all you need is one component's score for your purposes.

Before you commit though, you might want to consider Option 2 as it might give you even better goals to use.

Option 2: Analyzing two RFM components together

If your goals don't exactly match the components, can you combine two components to describe the customers you're looking for?

Oftentimes one of these combinations will get really close to your goal (or you'll be attracted to one of these as a replacement to your goal).

In these cases, you're going to end up ignoring one component and using the other two. This will give you 25 customer segments (5 * 5) in total, of which four or five will be your top segments.

To figure out who'd be your best customers, you'll need to decide which scores to use. My advice would be to do the following:

This breakdown is easy to remember and gives you four different segments that you can consider with your marketing. You can group them all into one larger segment ("best customers") or send each one different marketing campaigns tailored to their specific scores.

Size-wise, the three segments would be about 16% of your customer base which is really close to the 80/20 concept.

You can also decide to favor one component more than another. Let's say you're goals are around repeat customers who spend a lot. You'd decide that Frequency and Monetary are the two components you'll target but put a higher emphasis on Monetary. Using the same segment descriptions, you might come up with this analysis:

Notice how with this setup, customers with an improved Monetary jump up to a higher segment right away (Monetary 4 -> 5 would go from Potentially -> Great) while an improvement in Frequency might not cause a jump.

However you do it and whatever pair of components you use, you can always add more. Maybe you have the four segments from Recency and Frequency for your customer loyalty goals and then four segments from Frequency and Monetary to chase after larger ordering customers.

Option 3: Analyzing all three RFM components at once

If analyzing one component of the RFM score is useful, two are better, you'd think three would be even more powerful.

You'd be right but with that power comes great responsibility.

Instead of working with 5 segments (one-score) or 25 segments (two-scores), three scores gives you 125 segments (5 * 5 * 5).

That can be overwhelming for any ecommerce store except for the largest. Even then, the big ones can run into trouble trying to keep all of the segments straight.

The reason is because someone has to think about how all three scores relate to each other and use that in their analysis. Difficult, but do-able with 25 scores, but complex with 125. Software can help but you'd still need to explain to the software what all 125 scores mean to your business.

But there's a simple solution, one you might have guessed at from the last section.

That's combining the scores into super-segments.

Option 4: Super-segments

Super-segments are where you take each score combination and put it into groups with similar scores. For example, you might put 533, 534, 544, and 555 into the super-segment "recent buyers"

This will still require a lot of tedious analysis work and fine-tuning but in the end, it can be a powerful way to use RFM to segment your customers.

But the million-dollar question is, will you make use of that power?

In order for customer segmenting and RFM analysis to be valuable to the business as a whole, it needs to help make decisions that drive results. The activity of grouping RFM scores itself is worthless. The value comes from the decisions made when building campaigns, segmented emails, or copywriting for those segments.

With that in mind, try analyzing two components at a time but give each customer multiple segments. You might have a Great customer based on Recency and Frequency but lousy on Frequency and Monetary.

Segmenting based on two components at a time is the idea behind my customer grids and it's surprising how intuitive they can be. Add in historical versions of the analysis (e.g. how were they 12 months ago) and the customer insights go deep without becoming overwhelming.

What are the bad RFM scores?

With so much on the good RFM scores, it's easy to describe the bad RFM scores.

Basically they are the bottom scores of whatever analysis method you used.

One caveat, if you're using the modified Frequency score I mentioned above: make those Frequency 1 one-timers their own segment. It helps to keep them all in one area for ease of analysis.

Shortcut for smaller stores: Add up the RFM scores

For smaller stores without a lot of customers (say under 25,000 customers), one shortcut you can do is to add up each of the RFM components into a final number.

This will give you a number from 3 to 15 which can be used to quickly compare customers.

For our example customers

This method has a lot of drawbacks so be careful using it, especially if you're a larger Shopify store.

The root problem is that for ecommerce stores, the three scores aren't equally valued. Recency and Frequency are usually more important then Monetary. Frequency is a better descriptor of long-term behavior. Recency changes rapidly causing wild swings in the total score.

With regular RFM scores, keeping them separate reduces their impact on each other.

But I wanted to highlight this approach in case you wanted a shortcut. If you want to go further, you can start work on customer grading by building a custom model (or use my app which comes with one pre-built for you).

Applying RFM segmentation to your marketing strategies

Now you have customers scored and segments created, it's time to use all this new information.


Personalization of your Shopify store

Often the first step after the analysis is hooking up customer personalization. This is where specific customers will see different things in your offers.

To start, you'll want to add this sort of personalization to your Shopify online store. Shopify has a lot of customer personalization potential built-in once the customer signs-in.

You'll need:

  1. the RFM scores or segments added to the customers (think: data import in your Shopify admin or tagging)
  2. the data coming through in the storefront, which is provided by Shopify (the customer object in Liquid)
  3. code in your theme to check that segment data and setup the personalizations

Problem is the third part. Most Shopify themes don't invest much effort or code into it. If a theme hasn't coded in personalization, then you'll have to do it all yourself.

That's why some Shopify apps take over personalization and handle all three for you at the expense of a slower store, odd-looking sections, or even sending customers off-site.

While personalization in your online store is often the first step stores reach for, it's a huge first step. It's easier to start with email marketing.

Email marketing - segmented offers

With email marketing you have the ability to control the "code" for personalization.

Even the simple email service providers can send an email to only a section of a list. This customer segment-based emails can get you 90% of the benefits of customer segmenting, all without writing any code at all. You just need to get your RFM scores and segments into your email system and then use their tools to send to a partial segment.

Personally, I think stores should give up on web-based personalization in Shopify until either

  1. their emails are cranking out the sales or
  2. Shopify and themes get together and create a standard for how to do personalization in Shopify themes.

Email marketing - behavioral marketing

One step beyond segmented offers is what's called behavioral marketing. Better described as behavioral email marketing, this is putting logic into your emails so each customer sees something different in each email.

Most modern email marketing providers have offered this for years, though there's been a revival in their usage.

In summary, all you do with this is to use simple logic to change how the emails look or what content is included. Example:

if customer.monetary_score > 3
  An offer for customers who have spent the most
  An offer for everyone else

This two-way logic using an if statement is the most simple option but it unlocks a lot of power for one reason:

You can use these all over the email.

You can also expand the logic to handle a whole bunch of RFM segments:

if customer.monetary_score == 5
  Offer for the top scorers
else if customer.monetary_score == 4
  Offer for just under the top scorers
else if customer.monetary_score == 3
  Offer for the average customers
else if customer.monetary_score == 2
  Offer for below average buyers
  Offer for the bottom customers or non-buyers

Copying this large block of code along with all of the offer code can be cumbersome though. That's why I recommend limiting how many RFM segments you actually use (Option #2 or #4 above).

Really, three offers might be good enough:

  1. Great customers
  2. Average customers
  3. Low-quality customers

Spend your time on making the offers the best they can be instead of segmenting with finer and finer slices.

Behavioral marketing can take some time to setup, develop, and test so it's not the best first step but it can be a powerful use of the RFM analysis.

Email marketing - behavioral marketing workflows

The next most advanced way of using and benefiting from a RFM analysis is to hook up behavioral marketing workflows.

These are extremely advanced, no matter how much pretty UI and polish your email marketing vendor puts on them.

In these you are coding a system where customers move through workflows or steps based on their data and behavior.

The problem is that workflows are extremely complex. Even as a developer with decades of software and ecommerce experience (and someone who enjoys logic puzzles), it can be difficult to create a workflow that works perfectly. (Not to include platform bugs like double emails, subscribers getting stuck, unsubscribes not working...)

That said, email workflows can be combined with RFM analysis. After you finishing scoring your customers, you update their data which should change where they are in the workflow.

Workflows are complex but powerful. Are you willing to invest the time and effort though? They are probably best to leave them until all of your other efforts are producing.

Personalized promotions and discounts

With customers analyzed by RFM and placed into segments, sending personalized promotions or discounts can become trivial.

You can send different discount codes to your best customers, your upcoming customers, or even customers who haven't bought in awhile (a win-back campaign).

Perhaps you use email marketing, SMS, or even paper mailings to deliver the messages. How it gets there doesn't matter, each method will have its pros and cons and tooling.

This is what most loyalty programs are, just cranked up to 11 on the automation side and with pretty paint for the UI.

RFM analysis tools and analytics

When it comes to RFM tools, there are a few different categories to consider. You might not need any to start but often they can complement or speed up the analysis.

I'm going to avoid mentioning any specific vendors because they get acquired, merged, or close often.

Tools to perform the RFM analysis

This first group of tools will help you perform the RFM analysis itself. You can do it all by hand or in a spreadsheet yourself but that can be prone to errors and will take a long time.

Custom software or Shopify apps can use the RFM algorithm and perform the analysis for you. All they need is the customer data from your Shopify store.

Using software for the analysis will also let you perform it more often. It's common to have RFM re-analyzed regularly with fresh data which software can do easily.

My app, Repeat Customer Insights loads the data from Shopify and performs the RFM analysis for Shopify stores automatically every day. That keeps the analysis up-to-date and can lead to faster decision-making.

Building segments

Once the customers are scored with RFM, some tools will automatically put them into customer segments. This might be specific segments defined by the app (like my automatic segments), segments defined by you, or even the full 125 RFM segments.

I've already mentioned some problems with the full 125 RFM segments previously (i.e. too many for any human to use).

It can also be a problem if a tool requires you to define the segments. You'd need to either do all the thinking about the segments and defining them (explained above) or you might segment customers who shouldn't be together. This can cause all manner of odd behavior if you don't have a data background.

The ideal option to is have the tool create segments for you but give you the ability to define your own or slice-and-dice the data yourself. Then you can use the automatic ones for awhile and add custom ones after you have experience with the system.

Visualizing the RFM data

Another category of tools will take your scored customers, segments, and other data used in the analysis to create visualizations.

These could be as simple as aggregate tables (e.g. 2,398 customers with a score of 514) or as complex as an interactive 3D graph in virtual reality.

I've found the best visualizations are the simple ones that let you see 1) an overview of the data and 2) compare the data to itself. RFM already allows you to get in the weeds on a per-customer basis so having support when looking at your customer base a whole can be beneficial and fill an analysis gap.

The ability to compare segments vs segments is useful to benchmark how different groups are behaving (and performing). If your very best customers are spending 2x as much as your loyal customers, that can help you decide how much resources to dedicate to your best customers.

In Repeat Customer Insights I've been adding more visualizations including the 2-D customer grids and customer grading.

RFM vs AI and machine learning

Now for the tool category that is in the news every single day.

Artificial Intelligence (AI).

When it comes to customer segmenting, not many beat RFM analysis. AI tools like machine learning are making progress but they require a lot of resources to use correctly. You'd need a lot of data, plenty of staff, and the ability to fine-tune the machine learning model before it can produce results. For big ecommerce companies like Amazon, Walmart, or Target that's no big deal. But it's outside the reach of the majority of stores.

Even the full 3-individual score RFM analysis pushes many stores to their marketing limit and that doesn't even include a AI making decisions on data you have no clue on.

A generic machine learning setup that's offered by a tool vendor could augment the RFM analysis but you'll need to be cautious. If they tuned their AI models on the customer behavior for other clients, it might misinterpret your data. The best option is a model tuned for your business, but now you're required to know a laundry list of programming, data, and modeling ideas.

AI and machine learning has potential for customer segmenting, it's just over-hyped right now (and will cycle back away from hype like it always does). Especially when RFM analysis has been proven to work really well for many stores.

RFM analysis for fun and profit

Using RFM analysis in your Shopify store will help you better understand your customer behavior. The more you understand, the more effective your ideas will be on how to grow your store, improve customer metrics, and overall make more profit.

It can be technical to perform but there are tools to make the tedious parts easier. Once setup, you can use the advice over-and-over again for months before needing to re-analyze.

(Or use a tool that provides automatic re-analysis and skip that whole part).

When are your best customers defecting?

Are your best customers defecting? Use Repeat Customer Insights to find out where in their lifecycle you're losing them and what you can do to win them back.

Learn more

Topics: Rfm Repeat customers Customer segmenting

Would you like a daily tip about Shopify?

Each tip includes a way to improve your store: customer analysis, analytics, customer acquisition, CRO... plus plenty of puns and amazing alliterations.