Solution Recipes are tutorials to achieve specific objectives in Klaviyo. They can also help you master Klaviyo, learn new third-party technologies, and come up with creative ideas. They are written mainly for developers and technically-advanced users.
This is a guest post written by Elise Davis, senior technical writer @ Klaviyo, who recently built this as part of Klaviyo’s internal Solution Architect mentorship program.
Learn how to use Klaviyo’s Profiles API to identify your top-spending customers.
Segmenting your audience and providing targeted, customized experiences is a proven way to increase loyalty and long-term revenue. Identifying your top customers and offering them exclusive perks is a great way to ensure they remain loyal to your brand over time.
Klaviyo has powerful tools for calculating customer lifetime value (CLV), both historic (i.e., actual purchases minus returns/refunds) and predicted (i.e., potential future spend). You can use this data to target your most loyal customers with specialized messaging and treat them like the VIPs they are.
This data is calculated automatically with Klaviyo’s predictive analytics tools, then stored as properties on a customer profile. You can access this data by exporting a list of contacts, or through the Profiles API endpoint.
CLV data is readily available to you in Klaviyo, but it can be challenging to identify the thresholds that set your best customers apart. This solution recipe will teach you how to identify your top customer groups (e.g., top 25% of customers based on historical spend). Once you’ve identified this threshold, use it to create segments to send personalized marketing to your most loyal contacts.
1 Klaviyo account with purchase data synced from your store
500+ customers who have placed an order
180+ days of order history
2+ orders from the last 30 days
2+ customers who have placed 3 or more orders
At a high level, the steps to execute this recipe are:
- Use the Klaviyo Profiles endpoint to pull the historic CLV for every profile in your account. This endpoint can pull up to 100 profiles at a time, so you’ll need to page through the data.
- Calculate the nth percentile of your non-zero CLVs (where n = the percentage of customers you want to identify, e.g., top 25%).
- Create a segment with the following definition:
Properties about someone > Historic CLV > is at least ___
Fill in the blank with the number found in step 2.
- Repeat the steps and update your segment periodically (perhaps once a month), as your dataset changes with every new order placed on your site.
I used Python to execute steps 1-2, using this script:
Note that depending on the size of your dataset, it may take several minutes to execute this program.
Using this script, you can easily identify the threshold that separates your top n% of customers from the rest of your base of contacts. Consider offering your most loyal customers:
- Early access or sneak peeks to new product launches
- The opportunity to provide feedback on new releases
- Invites to exclusive events
- Coupon codes or special offers to show your appreciation
By providing VIP treatment to your most loyal customers, you can help ensure their commitment to your brand for years to come.