Formstack Forms
HandL UTM Grabber / Tracker How to collect and track UTM variables via Formstack Forms step by step
- Capture UTMs using Formstack forms
- Capture UTMs using Formstack forms (V4) - Old
- Capture UTMs using Formstack forms (V4)
Capture UTMs using Formstack forms
This form only works in HandL UTM Grabber V3
After activating the plugin, insert the following code in your custom javascript file:
function FF_OnAfterRender(){
console.log("Form rendered successfully!");
var vars = ["Lead.UTM_Campaign__c","Lead.UTM_Medium__c","Lead.UTM_Source__c","Lead.UTM_Term__c","Lead.UTM_Content__c","Lead.GCLID__c","Lead.FBclid__c"]
for (v of vars){
escape_v = v.replace(/\./g, '\\.')
jQuery("#"+escape_v).val(Cookies.get(v));
}
return true;
}
And the fields will be automatically populated after lead is submitted.
Capture UTMs using Formstack forms (V4) - Old
This form is only compatible with HandL UTM Grabber V3.
Please add the hidden fields as outlined below. Ensure that the hidden field name (either the field label or placeholder) exactly matches our naming convention detailed here: Native WP Shortcodes.
As of version 3.0.59, you do not need to perform any additional steps, as Formstack V4 is natively supported.
If you are using HandL UTM Grabber 3.0.58 and below. Then proceed with the following step:
Upon activating the UTM Grabber V3 plugin, insert the following code into your custom JavaScript file:
setTimeout(function(){
handl_utm_all_params.map(function(v){
var element = document.querySelector('.fsForm [placeholder="'+v+'"]')
if (element){
var curVal = Cookies.get(v) ?? "";
var event = new Event('input', { bubbles: true })
var previousValue = element.value
element.value = curVal
element._valueTracker.setValue(previousValue)
element.dispatchEvent(event)
}
})
}, 500)
This code will automatically populate the fields after a lead is submitted.
Capture UTMs using Formstack forms (V4)
This form is only compatible with HandL UTM Grabber V3.
Please add the hidden fields as outlined below. Ensure that the hidden field name (either the field label or placeholder) exactly matches our naming convention detailed here: Native WP Shortcodes.
Add Embed Code
in FormStack at the top of your form and include the following script there. Make sure to replace <FORM ID>
with your own form id
<script>
var form = window.fsApi().getForm(<FORM ID>);
form.registerFormEventListener({
type: 'ready',
onFormEvent: function (event) {
if (window.handl_utm_all_params){
handl_utm_all_params.map(function(v){
var element = document.querySelector('.fsForm [placeholder="'+v+'"]')
if (element){
var curVal = Cookies.get(v);
if (curVal){
var field_id = element.getAttribute('data-fs-field-id')
var dest_field = form.getField(field_id);
dest_field.setValue(curVal);
}
}
})
}
return Promise.resolve(event);
}
});
</script>
This code will automatically populate the fields after a lead is submitted.