# RFM Customer Segmentation for PrestaShop: documentation

> The module scores every customer from 1 to 5 on the recency, frequency and monetary value of their orders, places them in one of 11 RFM segments, computes their churn…

- Page: <https://www.datafirefly.com/en/documentation/dfrfmsegment/>
- Language: en
- Last updated: 2026-09-24
- Other languages: [fr](https://www.datafirefly.com/documentation/dfrfmsegment/index.md), [es](https://www.datafirefly.com/es/documentation/dfrfmsegment/index.md), [de](https://www.datafirefly.com/de/documentation/dfrfmsegment/index.md), [it](https://www.datafirefly.com/it/documentation/dfrfmsegment/index.md), [pl](https://www.datafirefly.com/pl/documentation/dfrfmsegment/index.md), [nl](https://www.datafirefly.com/nl/documentation/dfrfmsegment/index.md), [pt](https://www.datafirefly.com/pt/documentation/dfrfmsegment/index.md)
- Index: <https://www.datafirefly.com/en/documentation/llms.txt>

The module scores every customer from 1 to 5 on the recency, frequency and monetary value of their orders, places them in one of 11 RFM segments, computes their churn risk and lets you run measured campaigns with a control group. This page covers installation, settings and every screen of the module.

## Installation

1. In the back office, open **Modules > Module Manager** and click **Upload a module**.
2. Upload the `dfrfmsegment` ZIP file. Installation creates the module tables and three entries in the **Customers** menu: **RFM Segmentation** (dashboard), **RFM Customer Scores** (list) and **RFM Campaigns**.
3. Open **Customers > RFM Segmentation** and click **Compute scores now**. The first run analyses your whole order history: a few seconds, up to a minute on a very large base.

Compatible with PrestaShop 8.0 to 9.x with the same ZIP. To update from an earlier version, simply upload the new ZIP: the upgrade scripts create the new tables without losing your scores.

## Settings

Settings open from the module **Configure** button or the **Settings** button of the dashboard. Fields that do not apply are hidden according to your choices. After a change, run the computation again to apply the new parameters.

### Data source

- **Analysis period**: number of months used for frequency and monetary value (24 by default, 0 for the whole history). Recency always uses the last valid order, even an older one.
- **Monetary value**: products excl. tax minus discounts (default), total paid excl. tax or total paid incl. tax. Amounts are converted to the default currency. Only valid orders count.
- **Include guest accounts**: disabled by default.
- **Real-time update**: rescores a customer as soon as one of their order statuses changes, using the thresholds of the last full computation.
- **CSV separator**: semicolon for Excel in Europe, comma or tab.
- **Campaign tracking window**: period during which orders count in a campaign's results (30 days by default).
- **Voucher code prefix**: for example RFM gives codes such as RFM-7KQ2M9XA.

### Scoring from 1 to 5

Each dimension works in **automatic** mode (customers are split into five groups of equal size) or **manual** mode (four ascending thresholds). For recency, a customer whose last order is within the first value gets 5. For frequency and amount, reaching the fourth value gives 5. Frequency is manual by default (2, 3, 5, 10 orders), because most customers have a single order and quintiles then say little.

### Churn risk

The risk ratio divides the days since the last order by the customer's usual delay between two orders. For a one-time buyer, the module uses the shop's median repurchase delay. By default the customer moves to **Watch** at 1.5, **At risk of churn** at 2.5 and **Critical** at 4.

## The 11 segments

| Segment | Profile | Recommended campaign |
| --- | --- | --- |
| Champions | Recent, frequent, high basket | Early access, VIP perks, review and referral requests |
| Loyal customers | Buy regularly with a good basket | Loyalty rewards, upsell |
| Potential loyalists | Recent, more than one order | Loyalty programme, personalised recommendations |
| New customers | Recent first order | Onboarding sequence, second order incentive |
| Promising | Recent, small basket | Brand content, free shipping threshold |
| Need attention | Average customers whose last order is getting old | Limited time offer based on past purchases |
| About to sleep | Low value, declining activity | Popular products, moderate discount |
| At risk | Used to buy regularly, no longer come back | Personal win-back email with a strong offer |
| Cannot lose them | Former top customers who stopped ordering | Personal contact, survey, best offer |
| Hibernating | Low value, last order long ago | Low cost reactivation, new arrivals |
| Lost | Lowest scores everywhere | Last attempt, then exclude from paid campaigns |

A one-time buyer with a recency score of 4 or 5 is always classified as New customers.

## Dashboard

**Customers > RFM Segmentation** shows the whole state of your base. A navigation bar leads to each section.

- **Key figures**: scored customers and period revenue, share of repeat customers, revenue at risk, typical repurchase delay.
- **Segments**: number and share of customers, revenue share, average basket, average days since last order, share trend over 30 days, entries over 7 days. The **View** and **CSV** buttons open or export the segment.
- **Segment evolution**: share of each segment over 30, 90 or 365 days. It appears after two computations made on different days.
- **Recency and value map**: rows = recency score, columns = average of frequency and monetary scores. Click a cell to open its customers.
- **Churn risk**: customers and revenue per level, with list and export.
- **Movements in the last 30 days**: moves from one segment to another, green arrow for an upgrade, red for a drop, CSV export per movement.
- **Integrations**: status of customer groups and of the last Brevo or Klaviyo push.
- **Valuable repeat customers slipping away**: the 10 at-risk customers who weigh the most.

## Customer list and customer page

**Customers > RFM Customer Scores** lists every scored customer with segment, previous segment, RFM code, R and FM scores, days since last order, period orders and revenue, risk and newsletter subscription. Every column can be filtered and sorted. Tick customers then choose **Export selected to CSV** in the bulk actions.

On a customer page (**Customers > Customers > View**), the **RFM profile** card shows the segment, scores, risk, usual delay between orders, previous segment, last campaign and voucher code, used or not.

## Campaigns

### Create a campaign

1. Open **Customers > RFM Campaigns**.
2. Start from a template (Win back slipping customers, Second order of new customers, Loyal customers who dropped, Reward champions, Reactivate sleeping customers) or build your audience: segments, previous segment, risk level, recent segment change, newsletter consent.
3. The summary on the right shows live the number of matching, targeted and control customers.
4. Click **Create and download CSV**, or **Create and push to Brevo** or **Klaviyo** when the integration is active. The campaign report opens and the file downloads.

Untick **Track results** for a one-off export, without saving the list or measuring anything.

### Control group

The **Control group** slider (0 to 50 %, 10 % by default) sets aside a random part of the list. These customers appear neither in the CSV nor in the Brevo or Klaviyo push. Comparing their purchases with those of targeted customers gives the real effect of the campaign. Aim for at least 100 control customers for a reliable conclusion.

### Personal vouchers

Tick **Create a personal voucher for each customer** and choose the type (percentage or amount), value, validity, minimum order and optionally free shipping. Each targeted customer gets a single-use cart rule reserved to their account. The code is included in the CSV and in the attributes sent to Brevo or Klaviyo. The limit is 10,000 codes per campaign.

### Campaign report

The report compares targeted customers and the control group over the tracking window: conversion, orders, revenue excl. tax, revenue per customer, uplift in conversion points, estimated additional revenue and vouchers used. A two-proportion test at 95 % tells you whether the difference is significant, and a message sums up the conclusion. Deleting a campaign removes its unused vouchers; vouchers already used stay for order history.

## Customer groups

In the settings, section **Customer groups**, enable the sync and map a group to each segment, or click **Create one group per segment** to generate the 11 "RFM - ..." groups named in every language. An optional group can collect every customer above a churn level. The sync runs after every full computation and every real-time update.

Use dedicated groups: members who no longer match the segment are removed. The customer's default group and the native Visitor, Guest and Customer groups are never modified. In PrestaShop, specific prices by group only apply to the default group: use cart rules for segment discounts.

## Brevo and Klaviyo

### Brevo

1. In the settings, section **Email marketing sync**, choose Brevo and paste your API key (Brevo > SMTP and API > API keys).
2. Click **Test connection**: your Brevo lists are shown with their ID. Enter the ID of the list that will receive the contacts.
3. Choose the name attributes: FIRSTNAME / LASTNAME, or PRENOM / NOM for older French accounts.

Attributes created automatically: RFM_SEGMENT, RFM_CODE, RFM_CHURN_LEVEL, RFM_REVENUE, RFM_ORDERS, RFM_LAST_ORDER, RFM_PREV_SEGMENT, RFM_CAMPAIGN, RFM_VOUCHER and RFM_VOUCHER_END.

### Klaviyo

Choose Klaviyo, paste a private API key with write access to Profiles and Lists, and optionally enter a list ID. Properties sent: rfm_segment, rfm_code, rfm_r, rfm_f, rfm_m, rfm_churn_level, rfm_revenue, rfm_orders, rfm_last_order, rfm_previous_segment, rfm_campaign, rfm_voucher and rfm_voucher_expires.

### How the push works

Only contacts whose data changed since the last push are sent. By default only newsletter subscribers are sent. The voucher code is sent only while it can still be used. Then build dynamic segments in your tool, for example RFM_SEGMENT equals `at_risk`, or RFM_CAMPAIGN equals the campaign name. The push runs from the **Push to** button of the dashboard, when a campaign is created, or automatically after each cron when the option is on. The **Resend all contacts** link forces a full push.

## Automate the computation

Schedule a daily computation to keep scores up to date and build the history. The cron URL, with its token, is shown in the dashboard and on the configuration page. It also works when the shop is in maintenance mode. Example cPanel task at 3 a.m.:

```
0 3 * * * curl -s "https://www.your-shop.com/index.php?fc=module&module=dfrfmsegment&controller=cron&token=YOUR_TOKEN" > /dev/null
```

From the command line, at the PrestaShop root:

```
php modules/dfrfmsegment/cli.php
php modules/dfrfmsegment/cli.php --esp
php modules/dfrfmsegment/cli.php --esp-force
```

`--esp` pushes changed contacts to Brevo or Klaviyo after the computation, `--esp-force` resends every contact.

## CSV columns

Columns keep English names so you map them once in your email tool: email, firstname, lastname, company, language, newsletter, optin, segment, segment_label, rfm_code, r_score, f_score, m_score, orders_total, orders_period, revenue_period, avg_basket, first_order, last_order, recency_days, churn_level, churn_label, churn_score, previous_segment, segment_changed_at, id_customer, campaign, voucher_code and voucher_expires. The file is UTF-8 with BOM so that it opens correctly in Excel.

## FAQ and troubleshooting

### A customer does not appear in the scores

They have no valid order, it is a guest account while the option is disabled, or the computation has not run since their order. In multistore, also check the shop context.

### The evolution chart is empty

It needs at least two computations made on different days. Schedule the daily cron.

### The Brevo or Klaviyo test fails

Check the API key and, for Klaviyo, write access to Profiles and Lists. The PHP cURL extension must be enabled on the server. The details of the last error are shown in the Integrations panel of the dashboard.

### Customer groups stay empty

Check that the sync is enabled and that each segment is mapped to a group, then run the computation again. The Visitor, Guest and Customer groups are refused on purpose.

### Uninstallation

Uninstalling deletes scores, history and campaigns. The customer groups created and the cart rules already generated stay in place, as they may be used in your price rules or orders.
