Re: How to use the Marketo forms events in GTM?

Jamie_West
Level 1

How to use the Marketo forms events in GTM?

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?

Tags (1)
3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: How to use the Marketo forms events in GTM?

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;

  });

});

Jamie_West
Level 1

Re: How to use the Marketo forms events in GTM?

Hi Sanford - is there a way to do this within Tag Manager without adding code to the website?

SanfordWhiteman
Level 10 - Community Moderator

Re: How to use the Marketo forms events in GTM?

Probably.  

But wherever you put the script, this code must run and not the built-in GTM HTML form tracking.