Google Analytics(分析)事件跟踪:如何避免发送数据进行本地测试? [英] Google Analytics Event tracking: how to avoid sending data for local test?
问题描述
我正在使用本地服务器测试Google Analytics(分析)事件跟踪.
I'm testing Google Analytics Event tracking with my local server.
我正在使用ga.js的调试版本, ga_debug.js ,以便在我的浏览器控制台中自动打印调试文本. 此外,我将域名设置为"none",这应该不会将数据发送到您的Google Analytics(分析)帐户(
I'm using the debug version of ga.js, ga_debug.js, in order to print debug text automatically in my browser console. Furthermore, i set domain name to none, which is supposed not sending the data to your Analytics account (stackoverflow post):
_gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
_gaq.push(['_setDomainName', 'none']);
...
但是我跟踪的事件仍会发送到我的Google Analytics(分析)帐户,所以我的问题是如何避免这种情况?
_gaq.push(['_setDomainName', 'none']);
是否仅针对页面浏览而不是事件跟踪禁用数据发送?
But my events tracked are still sent to my Analytics Account, so my question is how to avoid this?
Is the _gaq.push(['_setDomainName', 'none']);
disable data sending only for page view and not event tracking?
感谢您的帮助,
泽维尔
推荐答案
将以下代码段添加到您的开发环境中:
Add the following snippet to your dev environment:
window['ga-disable-UA-XXXXXX-Y'] = true;
有关更多信息,请阅读 https://developers.google.com/analytics /devguides/collection/gajs/#disable
For more information read https://developers.google.com/analytics/devguides/collection/gajs/#disable
这篇关于Google Analytics(分析)事件跟踪:如何避免发送数据进行本地测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!