Solution Recipe 13: Lead Scoring in Klaviyo
Ben
6min read
Developer recipes
November 15, 2022

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 & technically-advanced users.

Note: We do our best to make sure any code and API references are accurate and current when this is published, but you might need to update code and it’s always a best practice to leverage our latest API versions. If you have questions, feel free to hop over to our Developer Community.

What you’ll learn

How to utilize flow webhooks in order to achieve customized lead scoring in Klaviyo.

Why it matters

First, let’s start with a functional definition of lead scoring. TechTarget defines lead scoring as:
a methodology used by sales and marketing departments to determine the worthiness of leads, or potential customers, by attaching values to them based on their behavior relating to their interest in products or services

Why might this be useful? As most marketers are aware, customizing one’s messaging based on the behavior of their potential customers can lead to higher conversion rates. In this context, it’s a common practice to modify communications to a potential purchaser based on what stage of the purchasing journey they’re currently in. For instance: Have they only just started browsing your site, or have they been actively engaged with your brand for weeks on end, and are imminently close to making a decision? If a prospect is just starting their buying quest, you may want to target them with informational content so that they can narrow their search, whereas if they’re on the precipice of buying, you may want to incentivize them with a time-bound offer.

Now that we’ve identified our goal of determining the purchasing stage of potential buyers, the question becomes how we can most accurately quantify this stage. This is where lead scoring can benefit us — say we’ve resolved that a prospective customer signing up for an email list, reading a blog post, visiting a product page, and beginning a checkout are all indicative of interest in purchasing. Rather than creating a segment for every possible permutation of the above in order to assign your profiles a stage in the purchasing funnel, an easier way to accomplish this is to simply assign lead-score points for the above actions, and add them to a user’s profile as they occur.

This approach also allows you to weight certain actions more heavily than others. For example, if we think that viewing a blog article indicates a higher level of buying interest than signing up for a marketing newsletter, we can assign 3 points to the former, and 2 to the latter. When it finally comes time to target our users with distinctive messaging, we can divvy them up into tiers based on the number of points they have. For instance, 0–5 points might indicate mild/early interest, 5–10 points might indicate moderate interest, and 10+ points might indicate heavy buying interest.

Level of sophistication

Moderate

Prerequisite

Similar to our most recent solution recipe, this recipe builds upon Solution Recipe 10: Use webhooks in flows to send additional event and profile data into Klaviyo. I would highly suggest reading it, in order to familiarize yourself with using webhooks in flows to call Klaviyo’s APIs.

Because this recipe uses webhook flow actions, you will need to enable two-step authentication on your Klaviyo account.

Instructions

Step 1: Build a flow

This step might look different depending on whether you want to add points to a profile only on the first occurrence of an event, or on every occurrence of that event. Using a “Viewed Product” event as our example, setting up a flow under the first scenario would first require setting up a segment with the following definition, and then triggering your flow off of a profile joining that segment:

For the second scenario, you could simply create a metric-triggered flow off of the “Viewed Product” event. Note that you’ll need to create one of these flows for every event that you want to add lead-score points for.

Step 2: Add the webhook

The webhook is actually quite simple in this case: You’re going to be sending a request to the Identify API, that takes the current number of lead-score points for the given user, and adds the amount they’ve earned for the action they’ve just completed. Here’s what that looks like as a JSON body:

{
    "token": "[public key]",
    "properties": {
      "$email": "{{ person.email }}",
      "Lead_Score": {{ person|lookup:'Lead_Score'|default:0|add:'2'}}
    }
}

In the above, you can see that we’re looking up the “Lead_Score” profile property, but are defaulting to a total of “0” if the user moving through the flow doesn’t have that property. Afterwards, we simply add the amount of points we feel this particular action is worth (2 in this case), and update (or create) the “Lead_Score” property. Note that we’re able to either create or update a profile property due to the flexibility of Klaviyo’s data model.

Step 3: Use lead scoring in your campaigns and flows

Once you’ve started tracking lead-score points, it’s relatively easy to start using them in campaigns and flows. Below is one example of how you can use lead scoring as part of a browse-abandonment flow, but the possibilities are endless. For example, if you’re using Klaviyo for SMS you may want to target your higher lead-score contacts with a text — since SMS is a higher-converting, but more expensive channel.

Final thoughts

Lead scoring can be a valuable tool, in terms of allowing you to both more accurately target your users, and visualize their intent to purchase. Although the types of Klaviyo customers most likely to benefit from lead scoring are those with a more sales-oriented or low-volume/high average ticket-price business, any marketer can benefit from the principles outlined above. That being said, effective lead scoring takes a lot of tinkering and iterating to get right, so feel free to use this guide more as a broad overview than a canonical resource. Happy scoring!

Ben
Ben Melito