How to track Marketo forms in Google Analytics using using API and Google Tag Manager (GTM)

dkonig
Level 1

Re: How to track Marketo forms in Google Analytics using using API and Google Tag Manager (GTM)

Would this be better than say using {{Page URL}} as the label in the GTM/GA tag for the event?

SanfordWhiteman
Level 10 - Community Moderator

Re: How to track Marketo forms in Google Analytics using using API and Google Tag Manager (GTM)

A built-in token is fine, too, I just like to have direct control.

dkonig
Level 1

Re: How to track Marketo forms in Google Analytics using using API and Google Tag Manager (GTM)

Ok. So if I go the route of adding through a push I need one more line of code such as:

 

"marketo.form_url": document.location.href

 

SanfordWhiteman
Level 10 - Community Moderator

Re: How to track Marketo forms in Google Analytics using using API and Google Tag Manager (GTM)

Yep!

dkonig
Level 1

Re: How to track Marketo forms in Google Analytics using using API and Google Tag Manager (GTM)

Excellent! Thanks.

 

Pardon this non-programmer question but is there any significance to the naming convention? For example could:

marketo.form_id

 be simply

form_id
SanfordWhiteman
Level 10 - Community Moderator

Re: How to track Marketo forms in Google Analytics using using API and Google Tag Manager (GTM)

It's just a convention to create a namespace-like/hierarchy-like/object-like feel.  You don't have to use it.

 

In other words, it simulates a complex object like:

{
  "marketo" : {
     "form_id" : 123
  }
}

 

But it isn't really like that under the hood, it's just flat.

dkonig
Level 1

Re: How to track Marketo forms in Google Analytics using using API and Google Tag Manager (GTM)

When it comes to implementing tracking in Google Tag Manager (GTM) what is the process?

SanfordWhiteman
Level 10 - Community Moderator

Re: How to track Marketo forms in Google Analytics using using API and Google Tag Manager (GTM)


When it comes to implementing tracking in Google Tag Manager (GTM) what is the process?

Well... what are your goals? GTM + Data Layer seems like something you're already using.

dkonig
Level 1

Re: How to track Marketo forms in Google Analytics using using API and Google Tag Manager (GTM)

Sorry for the delay. The goal would be to track successful form submissions in Google Analytics