16.15. Shopify, Klavyio RFM Segmentation with BigQuery ML

Introduction

In this lesson, we'll explore a real-life example of how to use Looker Studio and BigQuery ML to analyze customer segmentation for a Shopify store using Klaviyo data. The goal is to understand different customer segments based on Recency, Frequency, and Monetary (RFM) value.

16_page-0015.jpg

RFM Segmentation Concept

RFM segmentation is a method that helps businesses identify different types of customers based on their:

  1. Recency: How recently they made a purchase
  2. Frequency: How often they make purchases
  3. Monetary Value: How much they've spent over their lifetime with the business

Using these three values, we can segment customers into various clusters like high-value spenders or frequent recent customers.

Problem: Undefined Customer Segments

In our example, the business had about 40,000 customers in their database but didn't know how to define the segments or which types of people to target.

Solution: K-means Clustering Algorithm

To solve this problem, we used the K-means clustering algorithm available in BigQuery ML. This algorithm helps find similar clusters of entities within a dataset.

The raw data available for this project included client ID, email address from Shopify, date of purchase, and transaction amount. Using this data:

  1. We created a list of all purchases for every client.
  2. Calculated RFM values for each customer.
  3. Created an intermediary table with these RFM values.