Basically, this script needs to replace the old one:

<script type=”text/javascript”>

var queryString = window.location.search;

var urlParams = new URLSearchParams(queryString);

var utm = urlParams.get(‘utm_source’)

var utm_field = document.getElementsByClassName(‘UTM_Source’);

if(utm_field.length > 0)

{

for (let i = 0; i < utm_field.length; i++) {

var utm_input = utm_field[i].getElementsByTagName(‘input’);

if(utm)

{

utm_input[0].setAttribute(‘value’,utm);

}

else

{

utm_input[0].setAttribute(‘value’,window.location.href);

}

}

}

</script>

Long story short, on page load, if the page has a form which has a field called UTM_Source, then it will populate this field with either the utm_source parameter from the URL or the entire URL (as we discussed). This DOES mean, that if someone just goes directly to the form without clicking an add, the UTM_Source field will be populated with “https://econologicsfinancialadvisors.com/exit-planning-checklist/” since an empty parameter value is a valid state.