Re: GA Event Tracking for form submits

Anonymous
Not applicable

GA Event Tracking for form submits

Hi Marketing Nation,

I've been working with my teammate who runs the GA side of things. He wants to do event tracking based on the class of the button of the Marketo form. He said he needs a unique class name for the button. So instead of the standard class="mktoButton" he'd like something like class="mktoButton-catalog-request" and I can't figure out how to edit the class name of the button in Marketo. Is there a way to do this? Or is there a way to do event tracking to track form submits without changing the class name of the button?

Many thanks.

1 REPLY 1
SanfordWhiteman
Level 10 - Community Moderator

Re: GA Event Tracking for form submits

Delwin, you can't track form submits based on clicking the Submit button, because clicking the button doesn't mean the form was ever posted. Every attempt to submit the form with required fields unfilled would trigger a false form fillout activity. So it's not about adding the class on the button but accounting for actual events.

The correct way is to use the Forms 2.0 JavaScript event onSuccess. In the onSuccess listener, use _ga('_send') with the hitCallback parameter to log the form fill. If you search the Community for "hitCallback" you should find examples.