Is there a way to make it so that my testing device doesn't report back on my Google Analytics when I open my Android app? I know with AdMob you can add test devices and those devices will load dummy ads. Is there something similar for Analytics on Android?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can put your analytics client in "debug" mode, so it won't send any data. (If you're using v2: see the official docs, if you're using v1: see the "Testing" section of this overview).
Alternatively, on the server side, you can have GA filter out clients based on domain or IP. See http://support.google.com/analytics/bin/answer.py?hl=en&answer=1033162
回答2:
I know it's already answered, but IMHO that answer is incorrect.
According to: https://developers.google.com/analytics/devguides/collection/android/v2/advanced#opt-out putting the client in demo mode won't stop it sending data, it will just add debug info to LogCat. Instead you could use the setAppOptOut() explained in the same link.