Tracking Outgoing Links With Google Analytics Events
Posted
by
the_archer
on Pro Webmasters
See other posts from Pro Webmasters
or by the_archer
Published on 2012-06-15T13:36:22Z
Indexed on
2012/06/16
9:23 UTC
Read the original article
Hit count: 259
I've been trying to track clicks on external links on my website using the events tracking method.
So I've got my Google Analytics code setup before body ends as shown below (note: quotes have been entitied by blogger, but it works fine):
<script type='text/javascript'>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXX-X#39;]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
Now I wanted to track a link on the addthis.com follow widget. So there is a link of the type below to which following instructions from here I added the onclick
event.
<a addthis:url='http://feeds.feedburner.com/myfeedburnerlurl' onClick="_gaq.push(['_trackEvent', 'Subscription Clicks', 'RSS']);" class='addthis_button_rss_follow'/>
I clicked on it a couple of times, left it for over a day now, but nothing shows up in google analytics events. It just says zero events. Here's a screenshot of the events page on GA:
Could anybody help me? Am I doing anything wrong?
© Pro Webmasters or respective owner