Reputation: 3141
UA-*-1I'm trying to track file downloads on my site using GA Event Tracking. Here's my GA code, just before </head>
:
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-*******-1']);
_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);
})();
Here's my script to do the download tracking:
$('a.track-dl').click(function(){
_gaq.push(['_trackEvent', 'testcategory', 'testaction', 'testlabel']);
})
I've checked in Chrome Google Analytics debugger, and see this (identifying info hidden):
Account ID : UA-*******-1
Page Title : ************
Host Name : ************
Page : ************
Referring URL : 0
Hit ID : 961963542
Hit Type : event
Event Name : testcategory
Event Type : testaction
Event Label : testlabel
But the events never show up in GA. If it matters, I'm using a profile with a filter to only show traffic to a particular subdomain (this event is occuring on that subdomain). All my pageviews show up in about 10 mins of me performing them.
I'm seeing this on the Events overview page:
Total Events: 0
Unique Events: 0
Event Value: 0
Avg. Value: 0.00
Visits with Event: 0
Events / Visit: 0.00
Upvotes: 1
Views: 904
Reputation: 3141
Figured out my problem. The download was canceling the request for __utm.gif.
Used the method suggested here: http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55527 to add a setTimeout()
to the download request.
Hacky, but I guess it's currently the only way to do it.
Upvotes: 2