I would like to track Marketo form events in GTM on my website but am unsure of what steps to take. Could I please get assistance from an expert?
The pattern is the same as when using GA to log successful form submissions, only with GTM you'd use eventCallback where GA uses hitCallback.
MktoForms2.whenReady(function(form){
form.onSuccess(function(vals,tyURL){
dataLayer.push({
'event' : 'formSubmit',
'eventCallback' : function() {
document.location.href = tyURL;
},
'eventTimeout' : 3000
});
return false;
});
});
Hi Sanford - is there a way to do this within Tag Manager without adding code to the website?
Probably.
But wherever you put the script, this code must run and not the built-in GTM HTML form tracking.