How do I check that my coding is correct for onclick button tracking?
I have confirmed with Google that my analytics goal implementation is correct. So where did I go wrong in my coding?
<h2><a href="locations/" >Everywhere you go! </a></h2>
<p class="hidden-phone">No matter where life takes you, we are nearby! </p>
<a class="btn btn-red btn-small hidden-phone" href="locations/" onClick="ga(‘send’, ‘event’, ‘button’, ‘click’, ‘locations/’);" ><i class="icon-angle-right"></i>Learn More</a>
How do I check that my coding is correct for onclick button tracking?[ Edited ]
December 2016 - last edited December 2016
Could you please share the URL of your website where you've implemented this code?
We'll take a look and give you actionable advice. You can modify or remove this URL later on in your post if you want.
I guess the problem is that you have used invalid quotes in your code.
This code should work:
<a class="btn btn-red btn-small hidden-phone" href="locations/" onClick="ga('send', 'event', 'button', 'click', 'locations/');" >
Looking forward to hearing from you.