Disable Google Analytics from Android pre-launch reports

本秂侑毒 提交于 2020-05-25 06:09:46

问题


I have tested new pre-launch report on Google Play developer console. While it is great and goes trough your all screens and test them it also affects your statistics on Google Analytics.

Is it possible to exclude those testings from Google Analytics and how?

I know that I can upload APK just for testing with disabled GA, but than every time I should upload another APK with enabled GA and switch on and off pre-launch report testing and that is not what I want.


回答1:


Pre-launch reports run in the Firebase Test Lab.

According to their documentation, here is how you could detect that you're being run in the Firebase Test Lab.

String testLabSetting = Settings.System.getString(context.getContentResolver(), "firebase.test.lab");
if ("true".equals(testLabSetting)) {
  // Do something when running in Test Lab
}

source: https://firebase.google.com/docs/test-lab/android-studio




回答2:


One can exclude stats using filters (Administration ›Global Filters› Edit Filter). As I found one can use IP, domain or subdomain that will be excluded by Google Analytics stats.

In my project I have excluded my IP, so my development and test are excluded from Google Analytics. As I can notice, the same filters are applied at Firebase Analytics.




回答3:


I had a similar problem. Wanted to change the welcome screen so all buttons behave like "Terms of Use accepted", otherwise in my case about 66% of the tests end in closing the app. Found nothing in environment which identifies pre-launch report.

The only possible way I found is to determine the time frame when the tests will run. Of course, this is not reliable, but the last submits to Google Play always took at least 25 minutes until update was live.

Pre-Launch tests typically start soon after submitting the new version. So when you are able and willing to schedule the time of submitting the new version, you can use current time to detect whether app is tested or used in production. After Submit-Time + 20 minutes, enable production mode.

Hopefully Google provides us a reliable way to detect this environment. The service is great. Unfortunately I cannot see any screenshots due to permission issues, but the service is still in BETA, so it will be fixed.




回答4:


To expand on @bleuf1shi answer, the following worked for me in Xamarin.

var testLabSettings = Android.Provider.Settings.System.GetString(this.ContentResolver, "firebase.test.lab");
if ("true".Equals(testLabSettings, StringComparison.OrdinalIgnoreCase))
{
    // Do something when running in Test Lab
}


来源:https://stackoverflow.com/questions/37495992/disable-google-analytics-from-android-pre-launch-reports

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