javascript - GA Event Tracking from localhost - Stack Overflow

I've been trying to track file downloads from localhost, but can't manage to get it working.

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:

.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?

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./__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?

Share Improve this question asked Jun 20, 2013 at 14:04 LightheadedLightheaded 6538 silver badges24 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

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!

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./tracking-events-in-googles-new-universal-analytics/

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745279582a4620214.html

相关推荐

  • javascript - GA Event Tracking from localhost - Stack Overflow

    I've been trying to track file downloads from localhost, but can't manage to get it working.

    2小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信