Disable Google Analytics from Android pre-launch r

2020-06-09 07: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.

4条回答
smile是对你的礼貌
2楼-- · 2020-06-09 08:07

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.

查看更多
该账号已被封号
3楼-- · 2020-06-09 08:11

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
}
查看更多
一纸荒年 Trace。
4楼-- · 2020-06-09 08:18

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

查看更多
小情绪 Triste *
5楼-- · 2020-06-09 08:22

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.

查看更多
登录 后发表回答