来自本地主机的 GA 事件跟踪 [英] GA Event Tracking from localhost

查看:22
本文介绍了来自本地主机的 GA 事件跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试从 localhost 跟踪文件下载,但无法使其正常工作.访问被记录,但自定义跟踪推送没有.我可以看到 __utm.gif 请求:

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~

使用 chrome GA 调试插件,我可以看到这一点

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?

推荐答案

试着把这行放在第一个页面浏览之前:

Try put this line before the first pageview:

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

您的跟踪器将类似于:

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

此选项直接与 cookie 配置一起使用,因此仅用于 locahost!

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

这篇关于来自本地主机的 GA 事件跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆