Reputation: 67
I'm having some issues with my Google Analytics onClick events. I obviously have the google analytics code in the header:
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-41953273-1', 'getafreephone.net');
ga('send', 'pageview');
</script>
Now my onclick on the hyperlink looks like the following:
<a href="http://apple.freebiejeebies.co.uk/12545" target="_blank" onclick="_gaq.push(['_trackEvent', 'Click-Through', 'FreebieJeebies', 'Home Page Bottom']);"><span class="calltoaction"><img class='alignleft_action' src='images/Forward.png' alt=''/>Click here to sign up today and receive your free iPhone!</span></a>
However, in Google Analytics it's not picking this up at all (it's picking all page-views etc up, just not events).
Any help will be appreciated, thanks.
Upvotes: 0
Views: 2549
Reputation: 16585
I'm going to imagine after you click on the link, you have a error in the Javascript console.
The analytics tracking code you have seems quite old, and doesn't have the _gaq
variable available to use. I would try upgrading the tracking code that is available t at https://support.google.com/analytics/answer/1008080?hl=en&ref_topic=1008079 which will give you access to _gaq.push()
.
Also take a look at the Google Analytics Debugger which logs a lot of useful information to the Javascript console and can help troubleshoot these issues instead of waiting 24 hours.
Upvotes: 1