Re: Sumbission of marketo forms showing as events in GA, preferably using GTM

SanfordWhiteman
Level 10 - Community Moderator

Re: Sumbission of marketo forms showing as events in GA, preferably using GTM

Add return true; after the _gaq.push line.
Anonymous
Not applicable

Re: Sumbission of marketo forms showing as events in GA, preferably using GTM

its still not working for me,
I was not entirly sure what you meant by return true; , I am not very technical
I tried a few variations of what i thought you might mean but non worked. 

Here is the exact code I am trying: 
<div class="FormLightbox">
<a class="btCloseLightbox" href="javascript:;"><span>X</span></a>
<h1>Tell us about yourself</h1>

<p>
This ebook is yours for free. Just enter your details below, and you'll have access to the entire RED resource library!</p>

<script src="//app-sj07.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_456"></form>
<script>MktoForms2.loadForm("//app-sj07.marketo.com", "801-TVW-591", 456, function(form){
    form.onSuccess(function(form){
        _gaq.push.
 true;('_trackEvent' 
            , 'PDF' 
            , 'Downloaded' 
            , 'PDF On HOw To Turn HR into a Profit Center Downloaded');
        });
});
SanfordWhiteman
Level 10 - Community Moderator

Re: Sumbission of marketo forms showing as events in GA, preferably using GTM

You must still be leaving something out of the exact code. 🙂  Or you deleted the final </script>.

This is where you put return true; to tell Forms 2.0 to also redirect to the Thank You URL:

function(form){
    form.onSuccess(function(form){
        _gaq.push('_trackEvent' 
            , 'PDF' 
            , 'Downloaded' 
            , 'PDF On HOw To Turn HR into a Profit Center Downloaded');
        });
        return true;

});


 
Anonymous
Not applicable

Re: Sumbission of marketo forms showing as events in GA, preferably using GTM

this is what i have now but it still isnt letting the form submit...


<div class="FormLightbox">
<a class="btCloseLightbox" href="javascript:;"><span>X</span></a>
<h1>Tell us about yourself</h1>

<p>
This ebook is yours for free. Just enter your details below, and you'll have access to the entire RED resource library!</p>

<script src="//app-sj07.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_456"></form>
<script>MktoForms2.loadForm("//app-sj07.marketo.com", "801-TVW-591", 456, function(form){
    form.onSuccess(function(form){
        _gaq.push
 true;('_trackEvent' 
            , 'PDF' 
            , 'Downloaded' 
            , 'PDF On HOw To Turn HR into a Profit Center Downloaded');
        });
return true;
});
</script>

 
SanfordWhiteman
Level 10 - Community Moderator

Re: Sumbission of marketo forms showing as events in GA, preferably using GTM

Well, you have an errrant "true;" in your code, so there's probably a syntax error.  I hope you're looking at your browser's console/developer tools to see such things.

The correct code is demoed here.  The onSuccess is called as expected.  However since that page doesn't have your GTM code, it fails (understandably) on the line that calls _gaq.push().  

If you post the actual URL of your page I could take another look.
Anonymous
Not applicable

Re: Sumbission of marketo forms showing as events in GA, preferably using GTM

I have fixed it now so that the code is firing, however the event is not coming through in GA......

here is what i am using:
<script src="//app-sj07.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_456"></form>
<script>MktoForms2.loadForm("//app-sj07.marketo.com", "801-TVW-591", 456, function(form){
 form.onSuccess(function(form){
     ga('send', 'event', {
      eventCategory: 'PDF',
      eventAction: 'Downloaded',
      eventLabel: 'PDF On HOw To Turn HR into a Profit Center Downloaded'
       });
     });
    return true;
  });
</script>

 
Anonymous
Not applicable

Re: Sumbission of marketo forms showing as events in GA, preferably using GTM

the page we are running it on is this one:
http://www.recogniseeveryday.com.au/why-recognition/articles-videos/turning-hr-into-a-profit-centre-how-to-calculate-the-roi-of-your-recognition-program/
SanfordWhiteman
Level 10 - Community Moderator

Re: Sumbission of marketo forms showing as events in GA, preferably using GTM

On that page, I don't see any onSuccess handler.

I only see the default embed code:

<script>MktoForms2.loadForm("//app-sj07.marketo.com", "801-TVW-591", 456);</script>
Anonymous
Not applicable

Re: Sumbission of marketo forms showing as events in GA, preferably using GTM

i have it in there, or is there an additional element that needs to go in?

<script src="//app-sj07.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_456"></form>
<script>MktoForms2.loadForm("//app-sj07.marketo.com", "801-TVW-591", 456, function(form){
 form.onSuccess(function(form){
     ga('send', 'event', {
      eventCategory: 'PDF',
      eventAction: 'Downloaded',
      eventLabel: 'PDF On HOw To Turn HR into a Profit Center Downloaded'
       });
     });
    return true;
  });
</script>
SanfordWhiteman
Level 10 - Community Moderator

Re: Sumbission of marketo forms showing as events in GA, preferably using GTM

That looks right (I'm on my mobile, though, so I can't check the console). What do you see in the console when you submit now?