AnsweredAssumed Answered

Google Tag Manager + Forms + Wordpress

Question asked by f0521396fece2e279b1d4ae61464a3b460edb189 on Aug 6, 2015
Latest reply on Aug 23, 2016 by b7dff3d9ff657f6b707cb936004216254a615bee

I searched through all the current GTM discussions and unfortunately i haven't found one solution that will work for us.

 

My issue is, we are using a shortcode in Wordpress, which calls a marketo form script, to load a form on our page. I want to be able to track certain marketo form submissions in Google Analytics. I currently use Google Tag Manger, but it isn't working the way I have it set up and I think I need to use the marketo script to do this.

 

Specifically, I want to track anyone that downloads an eBook on our website.

 

Here is the marketo script I am using:

-----------------------------------------------------------------------------------------------------------------------------------------------------------------

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

 

<form id="mktoForm_439"></form>

 

<script>MktoForms2.loadForm("//app-aba.marketo.com", "940-UPM-848", 439,function(form){

      form.onSuccess(function(values, followUpUrl){

     

// change location.href to location of document

location.href = "/wp-content/uploads/2015/06/eBook_5-Tips-for-Using-Humor-in-Benefits-Communication.pdf";

       

return false;

      });

 

// set the name of the document name

// change this

var docName = "5 Tips for Using Humor in Benefits Communication";

 

// change the name of the document

var resource = "meetalex_websitedownload_null_ihumorebook_null";

form.vals({"Lead_Source_Detail__c" :  resource });

 

// change the name of the resource

var resource = docName;

form.vals({"Recent_Resource__c" :  resource });

 

    });;</script>

 

--------------------------------------------------------------------------------------------------------------------------------------------------------------

The shortcode on Wordpress is [acf field="form_script"]

 

Any ideas how to get this to load into Google Analytics as a download? I want to track this form specifically, as we have another form on our site for contact us, which we track separately. That has a different formID though, so differentiating between them is a must.

 

Thanks in advance for any help!

Outcomes