Alex Fortin
Alex Fortin

Reputation: 1

Add a google events tracking to a submit form

I search everywhere and I couldnt find my answer. I am running universal analytics on my site. I am using formforall plugins for my submission forms.

I add the folowing code to the javascript file:

onClick="_gaq.push(['_trackEvent', 'Contact', 'Information Request', 'Contact form', 1]);"

and that's what my button looks like once i added the code to it:

<input type="button" id="formforall-submit" class="button-primary" value="' + ed['settings']['formforall_trans_addform'] + '" name="submit" onClick="_gaq.push(['_trackEvent', 'Contact', 'Information Request', 'Contact form', 1]);" />\

My analytic is not tracking any clicks that i get through it.

Thank you so much for helping on this!

Alex

Upvotes: 0

Views: 106

Answers (1)

nyuen
nyuen

Reputation: 8907

You are using the wrong syntax if you have UA tracking your site. The correct syntax for the onclick should be:

onclick="ga('send', 'event', 'Contact', 'Information Request','Contact form', 1);"

One you have that changed, you can trigger the event and immediately check your Real-time reports to see if the hit is successfully sent.

Upvotes: 1

Related Questions