Track UTMs in Marketo form

Our plugin supports Marketo forms out of the box, just make sure the UTM fields are added to your form and the naming convention matches with our plugin.

For example:

As you can see in the picture above, traffic with UTM values will prefill the hidden fields in your form and they will be submitted along with the other prospect data.

Incase your form does not track the UTMs, do the following

Replace this

<script src="//app-ab43.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_1000"></form>
<script>MktoForms2.loadForm("//app-ab43.marketo.com", "<some id>", 1000);</script>

to

<script src="//app-ab43.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_1000"></form>
<script>
MktoForms2.loadForm("//app-ab43.marketo.com", "<some id>", 1000);
MktoForms2.whenReady(function (form) {
    jQuery.each(handl_utm_all_params, function( i,v ) {
		var curval = decodeURI(Cookies.get(v))
		if (curval != 'undefined') {
			jQuery("[name*="+v+"]").val(curval)
		}
	});
});
</script>

Revision #3
Created Mon, Dec 13, 2021 9:32 PM by Leman
Updated Wed, Dec 15, 2021 12:29 AM by Leman