Welcome to WebmasterWorld Guest from 54.196.224.166

Forum Moderators: DixonJones & mademetop

Message Too Old, No Replies

Event Tracking (GA) Stopped Working After Site Redesign

     

Planet13

11:57 pm on Jul 19, 2014 (gmt 0)

WebmasterWorld Senior Member planet13 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



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?

bumpski

7:45 pm on Jul 21, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not an expert but I don't see anything missing. I believe the first block of code must be before the second block (your links).

Planet13

9:28 pm on Jul 21, 2014 (gmt 0)

WebmasterWorld Senior Member planet13 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



Thanks for taking a look, bumpski:

I think I found the error and it was basically a brain cramp on my part. I just was looking at the wrong place for event tracking.

I probably need to go our and freebase some Centrum Silver...