UTM Tracking in Order 2 Step
As you know you can't add fields in Order 2 Step. But you can do this via adding some JavaScript code...
Add the following code on "Head Tracking Code"
The code looks like below. DON'T forget to change <YOUR_LICENCE_KEY> with your license key.
<!-- Global site UTM Simple Tracking Start-->
<script>
handl_custom_params=['_fbc','_fbp'];var handl_js=document.createElement("script");handl_js.setAttribute("src","https://track.utmsimple.com/utm.js?license=<YOUR_LICENCE_KEY>"),document.head.appendChild(handl_js),
handl_js.onload=function(){
setTimeout(
function(){
all = HandL.getAll()
Object.keys(all).forEach( (x) => {
if ( all[x] ){
if ($('.o2step_step1').length > 0){
$('.o2step_step1').prepend(`<input type="hidden" data-custom-type="handl_${x}" class="elInput" name="custom_type" value="${all[x]}" />`)
}
}
})
}, 1000
)
};
</script>
<!-- Global site UTM Simple Tracking End-->
BONUS: Trigger Zapier when checkout initiated...
Add the following code under Settings > Tracking Code (Footer Section)
<script>
setTimeout(
function(){
document.getElementsByName("email")[0].addEventListener('change', function(evt) {
var data = {};
handlj(handlj('form')[2]).serializeArray().map(function(x){data[x.name] = x.value;});
data = Object.assign(data,HandL.getAll())
var names = handlj('[name="name"]').val().split(" ")
data['fname'] = names[0]
names.shift()
data['lname'] = names.join(" ")
data['email'] = handlj('[name="email"]').val()
data['cur_url'] = window.location.href
data['product_id'] = $("input[name='purchase[product_id]']")[0].value
console.log(data)
var json = JSON.stringify(data);
var xhr = new XMLHttpRequest();
data = new URLSearchParams(data).toString()
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", 'https://hooks.zapier.com/hooks/catch/xxxxxxxx/yyyyyy/?' + data, true);
xmlHttp.send(null);
});
}, 500
)
</script>