Question

I've been trying to track file downloads from localhost, but can't manage to get it working. Visits are being recorded, but the custom tracking pushes do not. I am able to see __utm.gif request:

http://www.google-analytics.com/__utm.gif
?utmwv=5.4.3d
&utms=10
&utmn=1689575639
&utmhn=localhost
&utmcs=UTF-8
&utmsr=1920x1080
&utmvp=1358x565
&utmsc=24-bit
&utmul=en-us
&utmje=1
&utmfl=11.7%20r700
&utmdt=Something-something-something
&utmhid=1913734755
&utmr=0
&utmp=%2Fsomething
&utmht=1371735965300
&utmac=UA-XXXXXXX-X
&utmcc=__utma%3D1.515487588.1371735687.1371735687.1371735687.1%3B%2B__utmz%3D1.1371735687.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B
&utmu=qh~

And with the chrome GA debug plugin, I can see this

_gaq.push processing "_trackEvent" for args: "[APK,Download,Filetodownload.pdf]":          ga_debug.js:24
Track Event ga_debug.js:24
Tracking beacon sent!
Account ID               : UA-XXXXXX-X
Page Title               : Blabla
Host Name                : localhost
Page                     : /in-app-payments
Referring URL            : 0
Hit ID                   : 1913734755
Hit Type                 : event
Event Name               : APK
Event Type               : Download
Event Label              : Filetodownload.pdf
Visitor ID               : 515487588
Session Count            : 1
Session Time - First     : Thu Jun 20 2013 16:41:27 GMT 0300 (EEST)
Session Time - Last      : Thu Jun 20 2013 16:41:27 GMT 0300 (EEST)
Session Time - Current   : Thu Jun 20 2013 16:41:27 GMT 0300 (EEST)
Campaign Time            : Thu Jun 20 2013 16:41:27 GMT 0300 (EEST)
Campaign Session         : 1
Campaign Count           : 1
Campaign Source          : (direct)
Campaign Medium          : (none);
Campaign Name            : (direct)
Language                 : en-us
Encoding                 : UTF-8
Flash Version            : 11.7 r700
Java Enabled             : true
Screen Resolution        : 1920x1080
Browser Size             : 1358x565
Color Depth              : 24-bit
Ga.js Version            : 5.4.3d
Cachebuster              : 222517617 

Any ideas? May the problem be caused by the fact that I'm running it off of localhost?

Was it helpful?

Solution

Try put this line before the first pageview:

_gaq.push(['_setDomainName', 'none']);

Your tracker will be similar this:

<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12345-1']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_trackPageview']);
</script>

This option works directly with the cookie configuration, so use only for locahost!

OTHER TIPS

The New "Universal Analytics" API

Google is transitioning everyone over to a new system and you probably already have the new code snippet in your pages. They have changed many of the APIs including the event tracking.

Make sure you use this call after the main snippet

ga('create', 'UA-XXXXXXXX-X', {
  'cookieDomain': 'none'
});
ga('send', 'pageview');

Again this option works directly with the cookie configuration, so use only for localhost!

There is a thorough blog post on the subject http://blog.tylerbuchea.com/tracking-events-in-googles-new-universal-analytics/

And here is the official Google documents on the new API https://developers.google.com/analytics/devguides/collection/analyticsjs/events

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top