Marketo Forms 2.0 + Google Tag Manager

Anonymous
Not applicable

Marketo Forms 2.0 + Google Tag Manager

Hello everyone.

This is perhaps a question that everyone has seen or asked but I am having a hard time trying to solve this head-sctacther and would like some assistance from the Marketo Hive Mind.

We're an ad agency who happens to be responsible for a lot of campaign management for a number of clients in the realm of digital marketing. Now, being an ad agency, some clients already have digital assets already in market such as banners, websites, landing pages and forms.

Now I have re-created my client's form already on their website and added one more field (set at hidden) for data capture on our end such as "anonymous IP". The fields that I have generated my form reflects the ones that are on my client's form already on the site (First Name | Last Name | Phone Number | Email | Enquiry) and rather than gaining access to my client's CRM, we would like to see the lead on our end to determine the lead score and quality so we can demonstrate the ROI in terms of their paid media activity which they have entrusted for us to take care of.

This is the code that I have from Marketo:

<script src="//app-sn02.marketo.com/js/forms2/js/forms2.min.js"></script>

<form id="mktoForm_1038"></form>

<script>MktoForms2.loadForm("//app-sn02.marketo.com", "948-LFI-092", 1038);</script>

Now trying to push this via Google Tag Manager has proven to be quite a challenge and I know I have done something wrong despite no bugs being flagged. After running a few tests and reading a few articles on the same issue I am facing, the tags are definitely not firing.

Even the folks at Google's Tag Management team (whom I have spent a lot of time over the phone - bless them) are saying "hey that code, yeah we used that code and its not working" so they are just as stuck as me.

Here is what they are able to create in the interim so I can can at least TRACK if the forms are being filled:

<script>

var myVar = setInterval(function(){

var x= 0;

if(x==0){

if(document.getElementById('enquiry').innerHTML.indexOf('Thanks for your enquiry')!=-1){

  dataLayer.push({'event':'enquiry_submit'});

  clearInterval(myVar);

  x=1;

}

}

},3000)

</script>

So can anyone help this clueless pleb out? Because I am all out of ideas. In the words of Princess Leia "Help me, Obi-Wan Kenobi. You're my only hope."

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo Forms 2.0 + Google Tag Manager

That code makes my eyes hurt.  Nothing that sloppy should ever be in production, and the GTM team should be ashamed of themselves.

Let's go back for a moment.  What do you expect to gain by using GTM to manage the injection of a non-script <FORM> tag as well as the supporting forms library? By definition, you are going to slow down the rendering  of the form to your users  What's the upside? Is your goal only to record conversions?

Anonymous
Not applicable

Re: Marketo Forms 2.0 + Google Tag Manager

In theory, what I am trying to implement should work. Case in point:

Google Tag Manager + Forms + Wordpress (ok this one had wordpress involved but mine is like this WITHOUT the Wordpress)

The reason why I'm, using GTM rather than just implementing the code directly on the site is due to:

1. The site was created by a third party

2. I'm using GTM as a warehouse for all my tags and pixels so that I can avoid impacting the site's speed.

The reason for me wanting to implement the 2.0 Form code is so:

1. We can track those who went from anon to "known leads"

2. Determine the quality of the lead itself in the content provided when they completed the form.

3. Another other info (such as the known lead's geolocation) that we can leverge off so we can populate it into a DMP.

Its not enough for us to see on GA that a form fill activity has been generated. We want to determine the quality of the lead and provide next steps (i.e provide guidelines in terms of content, engagement, proposed offers) so that the client can leverage off and pass our feedback to their partners (which the completed form data is going towards). Keep in mind that the data in which the form captures are being sent towards SMBs.

SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo Forms 2.0 + Google Tag Manager

You're still not actually explaining what you're trying to do.  Whether you load the Forms 2.0 library via GTM (creating one extra level of indirection before the form can be displayed) or via embedding the Forms 2.0 <script> on the page (which is faster and always recommended) has no impact on whether you can log the data in the form.

The Forms 2.0 code you pasted is solely the built-in embed code.  I don't know why why you'd assume that's going to send the data anywhere else but to Marketo. Again, it doesn't matter when and where you load that code.  It's vanilla code with no modifications, designed to render the form in the page and wait for user input.

If you want to send the form data elsewhere, you must hook the Forms 2.0 onSuccess event.

MktoForms2.whenReady(function(form){

  form.onSuccess(function(vals,tyURL){

    // vals is a JS object with the form values

    // tyURL is the form's follow-up (Thank You) URL as set in Marketo; you are responsible for redirecting to the URL after doing whatever else you want with the vals

    return false;

  });

});