Introduction
This guide will enable you to encode the custom fields being passed via the Results node Exit URL going to your External thank you page.
In some cases you’ll need this to comply with your ad platform’s data privacy requirements. Example: Here’s a violation notice from Facebook…
Take note, Leadshook will encode it on our side before sending, but you will need to encode it on your page builder. So you need to make sure if your Page builder is capable of using Javascripts upon receiving the URL payload.
TIP! Please edit your variables to something not easily recognizable. So don’t use names like firstname, first_name, name etc in your exit urls.
Please watch this short video for the flow of data and be sure to import the sample decision trees in your LeadsHook account. Download files are included below…
Download Sample Decision Trees
Data Encode & Decode Steps
Step 1: Add the Encode script below on the node before your results node which has the redirect.
Make sure to set it to “ENTER”
<script>
var fname = '{first_name}';
var lname = '{first_name}';
var enc = window.btoa(fname);
var enc2 = window.btoa(lname);
DT.setField('first_name', enc);
DT.setField('last_name', enc2);
</script>
With this code example, it basically encodes them one by one so you can use them on your Exit URL. You can also add and encode as many custom fields to the URL.
Step 2: Edit your Results page “Exit URL” to something like this.
“https://www.yourdomain.com?first_name={first_name}&last_name={last_name}”
Where you need to add the custom fields that you want to pass at the end just like how you would set it up as a normal Exit Redirect passing URL parameters.
This will basically redirect to your landing page domain + the URL parameters that you encoded previously.
Step 3: Save and republish and this should redirect with an encoded custom field via the URL params.
Step 4: Last step is to decode it within your Landing page. You can use the script below.
<script>
var fname = '{first_name}';
var lname = '{last_name}';
var dec = window.atob(fname);
var dec2 = window.atob(lname);
DT.setField('first_name', dec);
DT.setField('last_name', dec2);
</script>
So what’s happening here is that your landing page is decrypting the custom field being passed from Leadshook. It should then print out the values.
In case if you want to pass and Encode the whole Exit URL, then you will need to use this Encode Script.
<script>
var URL = 'https://www.yourdomain.com?field1={field1}&field2={field2}';
var enc = window.btoa(URL);
DT.setField('URL', enc);
</script>