How to Segment Customers for Marketing with K-means
Identify personas and tailor your marketing with K-means Clustering. Use this practical case study to get started with your own projects.
K-means clustering is a technique for classifying and segmenting audiences into groups or clusters. It seems very sophisticated to marketers because it is typically discussed by data scientists. This is understandable given that the analysis can be complex. Working with data analysts or data scientists on large databases can provide more information, but marketers can contribute with our domain knowledge.
If marketers can perform even basic analysis on customer segmentation, we can get a good start on improving our strategies by using this effective technique.
In this tutorial, I’ll walk through a simple case study to help you get started with K-means clustering in Tableau. By the end of this guide, you’ll know how to segment your customers based on their purchasing behaviour and demographics.
Customer Segmentation for a Lita’s Retail Company
You’re working with Lita, a retail company looking to improve its marketing by better understanding its customers. Lita wants to create targeted marketing strategies by segmenting customers based on their purchasing behaviour.
We are going to use K-Means clustering in Tableau to divide customers into groups with similar purchasing patterns and suggest campaigns.
If you’d like to follow along, you can view the dataset here.
Dataset Overview
Here are the variables you’ll be working with in this tutorial:
- Customer ID: Unique identifier for each customer.
- Age: Customer’s age.
- Gender: Male, Female.
- Annual Income (USD): Total income per year.
- Spending Score (1–100): A metric indicating how much they spend relative to their income.
- Product Categories Purchased: Counts of products bought in categories (e.g., electronics, fashion, home).
- Frequency of Purchases: Number of purchases made in the last 6 months.
- Online vs. In-Store Ratio: Percentage of purchases made online compared to in-store.
If you’re new to variables, learn more on this variables for marketers guide.
Step 1: Setting Up Tableau
To follow along, you’ll need an account on Tableau Public. It’s free to sign up here. Once you’ve created your account, download the desktop app.
This is a public version of Tableau, so don’t upload any real personal data. For this tutorial, I’ve generated a a dummy dataset generated using ChatGPT.
Step 2: Importing Your Dataset into Tableau
- Open Tableau Desktop and go to the “Files” section.
- Select Microsoft Excel, then browse to find your dataset.
- After uploading, check that all the necessary variables are properly formatted.
Step 3: Create Visualisations
- Click on the tab at the bottom labeled Sheet 1 to start your analysis.
- Drag and drop variables from the left sidebar into the columns and rows section to explore relationships.
For example:
- Drag Age into the Columns field.
- Drag Annual Income into the Rows field.
3. If you see only one dot, it means the numbers are being aggregated. To switch off aggregation, click Analysis in the top navigation and uncheck Aggregated. Now you’ll see a scatter plot, where each dot represents a customer.
Step 4: Observe the Clusters
Once you’ve created the scatter plot, it’s time to view the different clusters:
- Click on the Analytics tab in the sidebar and drag Cluster into your scatter plot.
- A small window will appear with a list of the variables and number of clusters. If you leave it empty, Tableau will automatically group customers into clusters based on the data. However, you can manipulate this yourself to explore how many groups you can find.
- Tableau will display your clusters in different colors. If the dots don’t cluster together to form circle-shaped groups, there might not be clear segments.
- To explore deeper, drag more variables (e.g., Spending Score or Frequency of Purchases) into the Rows and Columns fields to view relationships and groups.
Step 5: Explore and Describe Clusters
Once you’ve found meaningful groups, it’s time to understand them and identify characteristics.
- Click on the “Cluster” option in the left sidebar under Marks.
- Click “Describe Clusters” and you’ll see a summary of your clusters and variables.
- Take a close look at the summary table and find patterns.
In Lita’s dataset, I noticed the trends below:
- Cluster 1: This group purchased the most electronics. They shop moderately and lean more toward in-store purchases than online.
- Cluster 2: This group is older, with more online activity. They have the lowest number of purchases in the past 6 months, but they purchase many fashion items.
- Cluster 3: This group has a relatively lower income though a high purchase frequency. They purchase more home and electronic products than fashion.
- Cluster 4: This group appears to focus on high fashion purchases and home improvements.
Step 6. Create Personas and Marketing Strategies
Now that you know what your clusters are, it’s time to give them descriptive names and come up marketing strategies tailored to each group.
- To rename , drag the ‘Clusters’ to the left sidebar under ‘Tables’.
- Click ‘Rename’ and edit the name for each group
Cluster 1 -> Tech-Savvy Shoppers
Highly interested in electronics and enjoys staying on top of the latest gadgets.
- In-Store Exclusive Campaigns: highlight in-store events like product launches, exclusive offers, or try-before-you-buy promotions.
- Loyalty Program for In-Store Shopping: offer points or discounts that are only valid for in-store visits.
Cluster 2 -> Value-Oriented Minimalists
Strong online shoppers but might be more price-sensitive or less engaged. Their low purchase could suggest a preference for practicality or minimalism.
- Online Flash Sales: limited-time discounts on fashion items to align with their preference for online shopping.
- Convenience-Focused Marketing: emphasise delivery speed, easy returns, or subscription boxes.
Cluster 3 -> Home-Tech Upgraders
The high frequency of purchases suggests active shoppers. With a greater focus on home purchases and electronics, this group likely enjoys creating comfortable living spaces with technology.
- Home and Tech Bundles: promote themed bundles, such as smart home devices paired with decor.
- VIP perks: personalised recommendations or incentives tied to their higher engagement.
Cluster 4: Style-Focused Homemakers
These customers shop for both fashion and home décor. They’re likely interested in style and trends.
- Fashion-Focused Campaigns: Offer VIP experiences such as early access to fashion lines or personal stylist consultations.
- Home Decor Style Guides: Use digital guides or in-store setups showcasing curated home items to drive purchases.
Increasing customer engagement and generating sales involves recognising the requirements and preferences of each group. Using the audience segments you created with K-means clustering, you can feel more confident about tailoring your advertising campaigns.