Google Analytics Event tracking: how to avoid sending data for local test?

本秂侑毒 提交于 2019-12-11 03:08:51

问题


I'm testing Google Analytics Event tracking with my local server.

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']);
...

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?

Thanks for your help,

Xavier


回答1:


Add the following snippet to your dev environment:

window['ga-disable-UA-XXXXXX-Y'] = true;

For more information read https://developers.google.com/analytics/devguides/collection/gajs/#disable



来源:https://stackoverflow.com/questions/17165594/google-analytics-event-tracking-how-to-avoid-sending-data-for-local-test

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!