问题
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.
来源:https://stackoverflow.com/questions/14116475/google-analytics-in-android-filter-out-test-device