So I just noticed that my event tracking stopped working about the same time I redesigned my site.
I am pretty sure that I am missing a line of code (or two) in the google analytics script.
but there are SO MANY DIFFERENT versions of the GA script (universal / ga.js / asynchronus ) that I am not certain which line(s) of code to add.
I am tracking clicks on internal links (pretty sure the code that is in the href tag is fine.
Here is my script:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-abcdefg-h']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
This is what a link looks like (I have exemplified the category, action and label):
<a onclick="_gaq.push(['_trackEvent', 'CategoryName', 'ActionName', 'LabelName']);" href="http://www.example.com/"><img src="http://www.example.com/images/123.jpg" border="0" width="90"><br>
Text Here</a>
~~~~~
thanks in advance for letting me know what I am missing.
NOTE: I should mention that I am tracking demographics, too, so maybe that is causing a problem? (Or that is what is causing the code to look a bid different?