Marketo Form Submit Push to Google Analytics Partially works, help!

Anonymous
Not applicable

Marketo Form Submit Push to Google Analytics Partially works, help!

I've managed to set up a landing page that pushes to GA and creates an 'Event' upon hitting the submit button on a form. We're wanting to track form submits in GA this way as we prefer to serve content to our leads right away instead of sending a follow up email or providing a link on the thank you page to click.


I'm not a developer or the best with jQuery, but this one has me stumped. The form submit pushes an event to GA when using Chrome, IE and Firefox, but NOT Safari.

The code inserted into an HTML element on the landing page:

<script>
  var $jQ = jQuery.noConflict();
     // Use jQuery via $jQ(...)
     $jQ(window).load(function(){
         $jQ("#mktFrmSubmit").wrap("<div class='buttonSubmit'></div>");
         $jQ(".buttonSubmit").prepend("<span></span>");
         var oldFormSubmit = formSubmit;
         window['formSubmit'] = function(elt){
          _gaq.push(['_trackEvent', 'Doesitwork', 'ACTION', 'OFFERNAME']);
          return oldFormSubmit(elt);
         }
     });
       
</script>

This is referenced from another thread (no my own), and I'm wondering if something needs to be included to make sure this works with Safari. I'd rather not be forced to change the way we deliver our content, but I can't use this method if it doesn't work for Safari.

Anyone have an idea of what's going on here?
Tags (1)
1 REPLY 1
Anonymous
Not applicable

Re: Marketo Form Submit Push to Google Analytics Partially works, help!

Hi,

As i understand right? you can do it simple by the way:

- Customize the function formSubmit of Mkto form:

Ex:

formSubmit(){

// init your GA
    _gaq.push(['_trackEvent', 'Doesitwork', 'ACTION', 'OFFERNAME']);

document.getElementById('formId').submit();
}

- Another way using the jquery to attach one more handle event for GA.