Re: How To Guide: Use scoring to calculate what your leads are interested in and use in segmentation

Anonymous
Not applicable

How To Guide: Use scoring to calculate what your leads are interested in and use in segmentation

Hi guys,

I've originally posted this post as an answer to a question that occured in the comments to Rajiv Ahuja blogpost 'Use "Use “Interest Scoring” to target like a bull​, which details the idea of scoring leads' engagement with different parts of your product/service etc. The idea is to track a leads' engagement with a specific area of your website or emails, increase their score in a matching scoring field, and use that knowledge to target your content. Edward Unthankcomment to Rajiv's blogpost is also very informative on this matter.

But it leaves us with a challenge: How do we know, if our lead is most interested in product A vs. product B, when Marketo has no way of logically acting on this? E.g. if the lead score of product A is 30, and the lead score of product B is 55, I'll want to send them information on product B, but there is no native way in Marketo to go use the knowledge that way, and this post is the solution for that problem.

My community status does not allow me to post this as a blogpost nor as a document, so I'm posting it as a debate post, and it will hopefully show up when other Marketo peers are searching for my solution.

My first solution is doable if scoring in each field is below 20 or so and can be done in Spark, while the other is more flexible and scalable, but requires a webserver and a Marketo license with webhooks. You could also build this with the API, but I'm not that strong in coding to do so. Go to solution two to read about that.

This example is for a client, who's a travel agency, and we're scoring leads' interest all the different tours they offer - that's why fields are called "Tours - XYZ..."

Here goes:

Solution 1: Request campaigns

Create the following four new fields:

Tour - Temp Max Score (integer field)

Tour - Temp Max Score Name (string field)

Tour - Max Score (integer)

Tour - Max Score Name (string field)

The temporary fields ("Temp") are updated every time a interest/tour score is updated. That means if a lead is interested in tour A and have visited that tour webpage 3 times, the temp score will be 3, but when a lead visits a tour B for the first time, the temp score will change to 1. This is done by using the lead score token to update the temp score field. See the score flow here:

pastedImage_0.png

The same thing goes with the Tour - Temp Max Score Name, which will update every time an interest score has been updated. So in the above example, Tour - Temp Max Score name will have been set to "Tour A" three times in a row, but then be set to "Tour B".

We will then setup a system that checks to see if the updated "Tour - Temp Max Score" field is larger than the real "Tour - Max Score". If so, update the "Tour - Max Score" with the value from the "Tour - Temp Max Score" and also update the string "Tour - Max Score Name" with the content of "Tour - Temp Max Score Name".

This would be easy to do, if tokens could be used in flow step choices, but unfortunately that doesn't work, so I've build the following system:

1. Create a smart campaign called the "Max Score Handler" that is requested in each interest scoring smart campaign. The flow of the campaign checks how large the "Tour - Temp Max Score" is, and request the corresponding Smart Campaign, like this:

pastedImage_3.png

The smart list of the corresponding smart campaign for choice 6 looks like this:

pastedImage_5.png

The "Tour - Max Score" filter is key here. Let's say that a lead has visited tour A 12 times. That means the "Tour - Max Score" is 12 and the "Tour - Max Score Name" is "Tour A". When a lead has engaged with tour B for the 6th time, the smart campaign "Max Score Handler" will request the above corresponding smart campaign, but since the smart campaign will only run if "Tour - Max Score" is 6 or less, nothing more will happen, since the max score is 12 at the time.

If - however - the "Tour - Max Score" is only 5, then the smart campaign will run, and this flow will be executed:

pastedImage_6.png

How high a score you can handle, is only a matter of how much time you wanna put into creating corresponding smart campaigns and add choices in the handler. In this case, we've set it to 15, and every time the "Tour - Temp Max Score" is above 15, it overwrites the real Max score and Max name, even though it might have been 40 i.e.

We can now create a segment based on what tour leads are most interested in, and use this in all the emails we send out, and automatically include the most relevant tour in the email etc.

Solution 2: Using webhooks
This requires access to a webserver that supports PHP and at least the STANDARD Marketo license, because we're using webhooks.

The basic idea is to send all the scores to a script outside of Marketo with a webhook. The script then compares the scores and returns a name of the interest that scores the highest back to Marketo, which is automatically added to the lead in a pre-determined field.

Here goes:

Create a PHP file on your webserver, and input the following content. Please take into account that I'm not a seasoned programmer, so I'm not 100% sure about the security of data send between Marketo and this PHP file. However, the data that I send between Marketo and the script isn't that secret, so I'm okay with the following security. If you're sending sensitive data, please consult someone, who can validate the data security:

<?php

/* The first part is basically making sure that it's only our webhooks from Marketo that's allowed to access the script */

  $key = $_GET['key'];

  if ($key != 'SECRET KEY THAT YOU CHOOSE') {

    header('HTTP/1.0 403 Forbidden');

    exit();

  } else {

/* If the secret key in the script matches one from our Webhook, execute the following script */

/* The following simply means: Get the value from the URL parameter "url_param_dogsledge", and save it to the array - etc. Copy paste the below lines to match the scores you want to compare: */

  $interest_scoring_arr["exp_dogsledge"] = $_GET['url_param_dogsledge'];

  $interest_scoring_arr["exp_whales"] = $_GET['url_param_whales'];

  $interest_scoring_arr["exp_ice_cap"] = $_GET['url_param_ice_cap'];

  $interest_scoring_arr["exp_ice_bergs"] = $_GET['url_param_ice_bergs'];

  $interest_scoring_arr["exp_northern_lights"] = $_GET['url_param_northern_lights'];

/* The following finds the maximum score, and returns the name of the score, that we defined in the above lines. Lets say the interest for dogsledging is the max score: The output will be "exp_dogsledge" */

  $max_interest_exp["max_interest_exp"] = array_search(max($interest_exp_arr),$interest_exp_arr);

/* Send the name of the max score back to Marketo */

  echo json_encode($max_interest_exp);

}

?>

When this is setup, go to Marketo and create the following webhook:
pastedImage_5.png

The URL is the URL of your PHP file, and include the following URL-parameters:

?key=THIS SHOULD MATCH THE KEY, YOU DEFINED IN THE PHP SCRIPT&url_param_dogsledge={{lead.dogsledge_score}}&url_param_whales={{lead.whales_score}}...etc...

Basically you the names of the URL parameters should match the names you defined in the PHP script:
pastedImage_6.png

The value of each URL parameter is the lead token that references the lead field with the score.

An example could be:

URL.com?key=secret &
url_param_dogsledge = 4 &
url_param_whales = 8 & url_param_ice_cap = 2 &
url_param_ice_bergs = 12 &
url_param_nothern_lights = 4

The PHP script gets the values and saves it to the array, figures out what score is the highest (ice bergs), and returns the JSON:

{
   max_interest_exp :  exp_ice_bergs
}

In the webhook settings in Marketo, you map the result JSON from the PHP script to the field, where you want to save the name of the max score:pastedImage_14.png

We're now almost done. Now everything is setup and ready, and we just have to create the smart campaigns that will call the webhook. Remember that a webhook can only be called in a trigger campaign, so we have to setup two smart campaigns to combine a batch campaign every 24 hours, and a trigger campaign to call the webhook.

Trigger campaign:

Smart list: "Campain is requested"
Flow: Call webhook
Schedule: Each lead can run through the flow every time

Batch campaign:

Smart list: Add "Data value changed" for each of the scoring fields you want to compare. In each "data value changed" you find each scoring field, and set the date of activity to "in past 24 hours", and smart list to "Use any filters" (below scoring field names is in Danish)
pastedImage_21.png

Flow: Request the trigger campaign you just created previously.

Schedule: Each lead can run through the flow every time - and schedule it for every 24 hours sometime at night.

This way all the leads, who's interest value has changed in the last 24 hours, will be sent to the trigger campaign that will call the webhook, which sends the scores to the PHP script, which calculates the max value and returns the name of the max score to the field you chose in the webhook settings.

Fully scalable and with no limitations on lead score. 🙂

After all your smart campaigns are setup and activated, create a smart campaign that will run all leads through the trigger smart campaign with the webhook, if any of their score fields is not empty. Then you've setup your baseline, and the 24 hourly batch smart campaign will update segments every night.

NOTE: You can of course setup it up to call the webhook every time a scoring field is changed, but I don't recommend doing so, since a webhook call might take 1-2 seconds and depending on your traffic and leads can clock up your webserver. But in theory it would be possible to do so.

I've then created segments based on the value in lead field max score names, which I use in personalizing email content and flows:pastedImage_23.png

1 REPLY 1
Anonymous
Not applicable

Re: How To Guide: Use scoring to calculate what your leads are interested in and use in segmentation

Hey Thomas! Thanks for this. I am implementing it at my job and have some questions. What is the best way to reach you? Thanks!