我一直在尝试从localhost跟踪文件下载,但无法让它运行起来。正在记录访问,但自定义跟踪推送不会。我能看到__utm.gif请求:
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~
使用chrome GA调试插件,我可以看到这个
_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
有什么想法吗?问题可能是因为我从localhost运行它?
答案 0 :(得分:4)
尝试将此行放在第一次网页浏览之前:
_gaq.push(['_setDomainName', 'none']);
您的跟踪器将类似于:
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12345-1']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_trackPageview']);
</script>
此选项直接与cookie配置一起使用,因此仅用于locahost!
答案 1 :(得分:2)
新的&#34;通用分析&#34; API 强>
Google正在将所有人转移到新系统,您可能已经在网页中添加了新的代码段。他们改变了许多API,包括事件跟踪。
请确保在主要代码段
之后使用此调用ga('create', 'UA-XXXXXXXX-X', {
'cookieDomain': 'none'
});
ga('send', 'pageview');
此选项再次直接与cookie配置一起使用,因此仅用于localhost!
关于主题http://blog.tylerbuchea.com/tracking-events-in-googles-new-universal-analytics/
,有一篇完整的博客文章这是关于新API的官方Google文档 https://developers.google.com/analytics/devguides/collection/analyticsjs/events