How to use the Marketo forms events in GTM? | Community
Skip to main content
Jamie_West
Level 1
November 15, 2017
Question

How to use the Marketo forms events in GTM?

  • November 15, 2017
  • 1 reply
  • 3037 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

SanfordWhiteman
Level 10
November 15, 2017

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
November 15, 2017

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

SanfordWhiteman
Level 10
November 15, 2017

Probably.  

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