How to Set Up Progressive Profiling in Salesforce Marketing Cloud

Share this article...

As marketers, we know that it’s all about data – the more data you collect, the more you get to know your prospect or customer, building a richer profile of that individual.

Progressive profiling is a great way to gather data, helping you add information to an individual’s profile over time, without overwhelming data collection methods that risk them turning away!

Here’s an important point: Progressive Profiling is an out-of-the-box feature in Pardot. What about us Marketing Cloud Consultants and Admins: how can we achieve Progressive Profiling?

In this guide, I am going to show you how to achieve Progressive Profiling in Marketing Cloud using a custom solution in CloudPages. While I love the out-of-the-box Smart Capture Forms, it is still in the Stone Age, in my opinion. Here’s my solution I developed using SSJS and other elements – enjoy!

Note: to learn about the real basics of Progressive Profiling, here is an article I send to people starting out with this concept.

Progressive Profiling in Salesforce Marketing Cloud Use Case

Let’s first outline the use case. We have a landing page/cloud page, here is the user journey:

  • 1st visit: when a user visits our landing page, we will display a simple form with: First Name, Last Name, Email Address.
  • 2nd visit: we will display the same form but with a ‘Welcome Back’ message.
  • 3rd visit: if the prospect submits the form and visits again in the future, we will show a different form containing fields like company name and service feedback with a question: “do you like our service?”

How the Progressive Profiling Works

  • 1st visit: when a user visits our landing page, we will set a cookie.
  • 2nd visit: we will check if any existing cookie is present. If yes, then we will show the welcome message with the form.
  • 3rd visit and beyond: when a user submits the form, we will add the values into a data extension (including the cookie). Whenever the same user visits, we will check if the cookie is present in data extension. If yes, then we will show different form fields.

How to Set Up Progressive Profiling in Marketing Cloud

Step 1: Create a Data Extension

Create a data extension to store the form values:

Step 2: Create the CloudPage

Here is the code snippet:

<!--Declaring Ampscript variable -->
%%[
var @Page1,@CookieID,@Page2
]%%
<!--Progressive Profile Logic Starts-->
<script runat=server>
Platform.Load("Core", "1.1.1");
var cookie = Platform.Request.GetCookieValue("SFMCCookie"); //Get the cookie value if its present
Variable.SetValue("@CookieID",cookie); //Set the cookie value
var CheckCookie = DataExtension.Init("Progressive Profiling");
var CheckCookieRow = CheckCookie.Rows.Lookup(["CookieID"],[cookie]); //Check if cookie is present in data extension
if(CheckCookieRow){
Variable.SetValue("@Page2","Next"); //Set the Page 2 if the cookie value is present in data extension
}
else{
if( !cookie || cookie == "" ) {
set(); //If there is no cookie set a cookie
}
}
function set() {
var d = new Date("Fri, 31 Dec 9999 23:59:59 GMT"); //Set a longer date so that cookies can be stored longer time
var today = new Date();
var SFMCCookieValue = "";
SFMCCookieValue += "SFMCCookieValue";
SFMCCookieValue += today; //Set Cookie value combination of SFMCCookie Value + today and to be stored in data extension
Platform.Response.SetCookie("SFMCCookie",SFMCCookieValue,d); //Set the cookie value
Variable.SetValue("@Page1","add");
}
</script>
<!--If customer submitted the form-->
%%[
IF RequestParameter("submitted") == "submitted" Then
Set @Email = RequestParameter("email")
Set @firstname = RequestParameter("firstname")
Set @lastname = RequestParameter("lastname")
Set @CookieID = RequestParameter("CookieID")
set @upsertdataex = UpsertDE('Progressive Profiling',1,'email',@Email,'firstname',@firstname,'lastname',@lastname,'CookieID',@CookieID) //Upsert all the value in data extension
Set @showThankYou = "Yes"
EndIF
]%%
<!--If customer filled the form show different section next time-->
%%[
If @Page2 == "Next" Then
]%%
<form action="%%=RequestParameter('PAGEURL')=%%" method="POST">
<label for="CompanyName">Company Name</label><br>
<input type="text" id="CompanyName" name="CompanyName" value=""><br>
<label for="Service">Do you Like Our Service </label><br>
<input type="text" id="Service" name="Service" value=""><br>
<br>
<input id="submitted" name="submitted" type="hidden" value="submitted">
<input type="submit" value="Submit">
</form>
%%[EndIF]%%
<!--If customer didn't fill the form but visits the same page-->
%%[ If @Page1 != "add" AND @Page2 != "Next" AND @showThankYou != "Yes" Then ]%%
Welcome Back! <br>
<form action="%%=RequestParameter('PAGEURL')=%%" method="POST">
<label for="firstname">First name:</label><br>
<input type="text" id="firstname" name="firstname" value=""><br>
<label for="lastname">Last name:</label><br>
<input type="text" id="lastname" name="lastname" value=""><br>
<label for="email">Email:</label><br>
<input type="email" id="email" name="email" value=""><br>
<br>
<input id="CookieID" name="CookieID" type="hidden" value="%%=v(@CookieID)=%%">
<input id="submitted" name="submitted" type="hidden" value="submitted">
<input type="submit" value="Submit">
</form>
%%[EndIF]%%
<!--Customers comes to the form for first time-->
%%[ If @Page1 == "add" and @showThankYou != "Yes" Then ]%%
<form action="%%=RequestParameter('PAGEURL')=%%" method="POST">
<label for="firstname">First name:</label><br>
<input type="text" id="firstname" name="firstname" value=""><br>
<label for="lastname">Last name:</label><br>
<input type="text" id="lastname" name="lastname" value=""><br>
<label for="email">Email:</label><br>
<input type="email" id="email" name="email" value=""><br>
<br>
<input id="CookieID" name="CookieID" type="hidden" value="%%=v(@CookieID)=%%">
<input id="submitted" name="submitted" type="hidden" value="submitted">
<input type="submit" value="Submit">
</form>
%%[EndIF]%%
<!--Show Thank You Page Post Submit-->
%%[ If @showThankYou == "Yes" Then ]%%
<H2> </H2>
%%[EndIF]%%

Step 3: Test the Progressive Profiling

Here is a demo video where I am testing the use case:

 

In this particular video, I didn’t close the browser, however, it works even if you close the browser and come back after a long time. You will see a new form only when you clear all your browser history (cookies) or go to the same landing page using a different browser.

Considerations

  • GDPR and privacy: Make sure you are aware of GDPR law. Always show consent in order to place a cookie and track an individual. Also, check with your legal team if any other information is required in the disclaimer you display.
  • Check out Google Chrome Same Site Cookie change in terms of Marketing Cloud. You would just need to tweak the above code in SSJS according to this Salesforce Doc, else it will not work for Chrome version 76 or later.
  • If you clear your cache, or if you come from a different browser, then it will generate a new cookie and show up the original form.

Summary

This guide has shown you how to achieve Progressive Profiling in Marketing Cloud using a custom solution in CloudPages, developed using SSJS and other elements. Yes, you will gain the Progressive Profiling functionality but you need to have a good idea of which fields you should ask at each stage before implementing any technology. This guide on The DRIP (although for Pardot functionality) shares some ideas to get you started.

Add Comment