Re: How do you calculate the number of times a form was filled out?

Grégoire_Miche2
Level 10

Re: How do you calculate the number of times a form was filled out?

Hi Natalie Lambert,

I would do it in Google Analytics. I would add a short code to the forms 2.0 embedded javascript to trigger a GA event each time the form is filled out and then go to GA and count the events.

If you use UA, the script will look like this one :

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

<form id="mktoForm_YYYY"></form>

<script>MktoForms2.loadForm("//app-e.marketo.com", "XXX-NNN-XXX", YYYY, function(form) {

  var ga_label = document.location.pathname + '#formId=' + form.getId();

  form.onSuccess(function(){

    ga('send','event','Mkto Form','submit',ga_label);        

  });

});

</script>

As you also could do it on Marketo LPs, you would have all the reporting you need in GA. The GA reporting will much more complete, as you can cross the info with traffic sources, or restrict to certain period of time.

-Greg

SanfordWhiteman
Level 10 - Community Moderator

Re: How do you calculate the number of times a form was filled out?

Greg, you must not do it this way or you'll lose GA hits!  You have to use the hitCallback parameter:

form.onSuccess(function(vals, thankYouURL) {

     ga('send', 'event', {

          eventCategory: 'Mkto Form',

          eventAction: 'submit',

          eventLabel: ga_label,

          hitCallback: function() { document.location.href=thankYouURL; }

     });

     return false;

});

Grégoire_Miche2
Level 10

Re: How do you calculate the number of times a form was filled out?

Hi Sanford,

Thx ! I learnt something today

for those interested, here is the doc : Sending Data to Google Analytics  |  Analytics for Web (analytics.js)  |  Google Developers

-Greg

Grégoire_Miche2
Level 10

Re: How do you calculate the number of times a form was filled out?

Hi Sanford,

What do you put in thankYouURL ? Is it supposed to automatically contain the URL of the follow-up for the form in the LP?

-Greg

SanfordWhiteman
Level 10 - Community Moderator

Re: How do you calculate the number of times a form was filled out?

Yes, the second argument passed to the onSuccess listener is the follow-up/thank you URL.

Jennifer_Borell
Level 2

Re: How do you calculate the number of times a form was filled out?

I added a score that counts the number of form submits, it's  just a total field adding one each time.

SanfordWhiteman
Level 10 - Community Moderator

Re: How do you calculate the number of times a form was filled out?

I added a score that counts the number of form submits, it's  just a total field adding one each time.

But then you would have to sum over the scores for all leads.