Hey Marketo.
I recently inherited an existing instance of Marketo, as our resident Marketo expert resigned from our organization. During my initiation period, I realized some landing pages didn't have our Google Tag Manager code on it. I then went through every Marketo landing page we use, and updated the GTM codes across the board (both pages that were missing it and pages that already had it, but it was an older version of the GTM code). After I finished, we were collecting use behavior on all Marketo pages - victory! This was Friday the 15th of June.
However, I noticed two unusual bits:
Here's the code that was on the subscriber page, and worked perfectly until Friday. We use this same bit of code, and just rename the eventLabel.
<script language="javascript">
MktoForms2.whenReady(function(form) {
form.onSuccess(function(vals, tyURL) {
ga('send', 'event', {
eventCategory: 'marketo',
eventAction: 'form-fill',
eventLabel: 'subscribe',
hitCallback: function() {
document.location.href = tyURL;
}
});
return false;
});
});
</script>
Being new to Marketo, I have no clue what to troubleshoot. Any and all ideas would be GREATLY appreciated!
Cheers,
Steve
Solved! Go to Solution.
Hi Steve,
One thing to definitely do when posting code here is highlight it using the Advanced Editor's syntax highlighter (highlight as JavaScript in your case). Otherwise it isn't readable.
Anyway, your problem is indeed that you aren't initializing the Google (Universal) Analytics library correctly anymore.
Thus this call to ga("send") to send a hit fails to complete.
ga('send', 'event', { ... });
And the GA hitCallback function never fires.
And because it never fires, you never get redirected (document.location.href = ...) after successful form submission, though as you noted these errors do happen after the form is processed by Marketo.
Hi Steve,
One thing to definitely do when posting code here is highlight it using the Advanced Editor's syntax highlighter (highlight as JavaScript in your case). Otherwise it isn't readable.
Anyway, your problem is indeed that you aren't initializing the Google (Universal) Analytics library correctly anymore.
Thus this call to ga("send") to send a hit fails to complete.
ga('send', 'event', { ... });
And the GA hitCallback function never fires.
And because it never fires, you never get redirected (document.location.href = ...) after successful form submission, though as you noted these errors do happen after the form is processed by Marketo.
Hi Sanford, thank you for looking at my question. I appreciate the help on both the ticket and on the syntax highlighter.
Your response gives me a few ideas, which I'll try right now. I shall update with my progress.
Cheers,
Steve
Hey Sanford, I was able to fix it all up! I removed all the now-obsolete GA scripts, and the Thank You pages began appearing again. I then used GTM to create the same Event Tracking as before, without any hassle! So it was a win-win today.
Thanks again for the help,
Steve
Ah... but are you using the native GTM HTML form trigger now? Because that won't actually work -- watch what happens if you try to submit a Mkto form whose fields aren't valid/filled.
Hey Sanford, actually we set it up for an Event to fire on a specific landing page when a user clicks the submit button. I'll have tags for all our specific landing pages, basically.
I know this is hardly ideal, but it's the way we track form fills since before I got here and I've kept it consistent over the years.
Yeah, the thing is, you'll never know how much that's inflating your numbers if you trust GA. Forms that require a business address, for example, will fire the GA event twice or more as a matter of course. Using the Forms 2.0 onSuccess event is always accurate.