UTM collection and automatic form filling

13.02.2019

Standard UTM parameters

UTM is URL address parameter, which helps to sort information about collected leads. You can track generated data according to them. UTM help to collect links information for tracking software, like Google Analytics. All standard UTM parameters are automatically collected and added to lead.

EXAMPLE:
when you go to the website: www.example.com?utm_source=google&utm_medium=123&utm_campaign=1
and someone completes the form with email field, the lead will look like:

email: (filled email address)
utm_source: hello
utm_medium: 123
utm_campaign: 1

Non-standard UTM parameters

You can capture any parameter using hidden form fields and paste to JavaScript tab a code below:

<script>
    var urlParam = getUrlVars();


    for (var prop in urlParam) {
      if (urlParam.hasOwnProperty(prop)) {
        var input = document.querySelector('[name="' + prop + '"]');
        
        if (input) {
          if (input.type === 'checkbox' && urlParam[prop] === '1') {
          input.checked = true;
        } else {
          input.value = urlParam[prop];  
        }
        }
       
      }
    }
</script>

EXAMPLE:
When you have the domain: http://www.domain.co /?ref=website&name=mike, you can capture ‘ref’ and ‘name’ parameters using hidden fields with the same attribute names.
A hidden field with the name attribute will capture the name parameter, and a hidden field with the ref attribute will capture the ref parameter.

Was this article helpful?

You might also check:

custom Javascript form's option UTM

Can’t find what you need?

Let us help you!
Send us a message
We are using cookies for analytical purpose. Learn more.