RFM — Reference
The RFM (Recency, Frequency, Monetary) model segments customers by transactional behaviour:
- Recency — how long since the last transaction.
- Frequency — how many transactions in the observed period.
- Monetary — how much the customer has spent.
RFM is a descriptive model, commonly used for segmentation, churn analysis, and targeting.
Input data: see AI Model Data Requirements → RFM.
Key concepts
- Transactions as events — each row of the event table represents a transaction (or equivalent business event).
- Allowed statuses — optionally restrict to valid statuses (e.g.
"Closed Won","Completed"). - Output — one row per user with R, F, and M scores plus a segment label, linked to
bpp_user_id.
JSON configuration reference
| Field | Type | Description | Example / best practice |
|---|---|---|---|
data_src.region | STRING | Cloud region (auto-populated). | "europe-west8" |
data_src.project_id | STRING | GCP project ID (auto-populated). | "audience-ai-dev" |
data_src.event_table_id | STRING | Event table with transactions (a *_bpp table). | "deal_status_change_bpp" |
data_src.column_price | STRING | Column with the monetary value per transaction. | "Deal_Amount" |
data_src.column_status | STRING | Column with the transaction/deal status. | "Stage" |
data_src.allowed_statuses | ARRAY | Status values considered valid transactions. | ["Closed (Won)"] |
data_src.column_timestamp | STRING | Transaction timestamp column (UTC). | "event_date" |
data_src.sample_interval | INT | Number of days in the analysis window. | 365 |
Example configuration
{
"data_src": {
"region": "europe-west8",
"project_id": "example-project",
"column_price": "Deal_Amount",
"column_status": "Stage",
"event_table_id": "deal_status_change_bpp",
"sample_interval": 365,
"allowed_statuses": ["Closed (Won)"],
"column_timestamp": "event_date"
}
}
Output structure
| Column | Type | Description |
|---|---|---|
bpp_user_id | STRING | User identifier linked via identity resolution |
recency_score | INT | Relative recency score (e.g. 1–5) |
frequency_score | INT | Relative frequency score (e.g. 1–5) |
monetary_score | INT | Relative monetary score (e.g. 1–5) |
rfm_cluster | STRING | Segment label (e.g. Champions, At Risk, Hibernating) |
Business rules by industry
E-commerce — column_price = order value; allowed statuses "Completed", "Paid"; interval 180–365 days.
B2B / CRM — column_price = deal amount; allowed statuses "Closed (Won)"; extend the interval for long sales cycles (e.g. 730 days).
Subscription / SaaS — treat renewals as transactions; allowed statuses "Renewed"; recency helps flag churn risk.
Retail with seasonality — interval should cover at least one full seasonal cycle (e.g. 365 days); allowed statuses "Completed".
Best practices
- Ensure timestamps are in UTC.
- Include only transactions that reflect actual revenue (exclude cancelled/refunded).
- Choose the sample interval by purchase cycle: fast-moving goods 90–180 days, durable goods 365–730 days.
- Use segments to prioritise actions: Champions → loyalty; At Risk → win-back; Hibernating → awareness.