I am following this publishing flow to send updates to the Android Play Store: I upload a new build to the Internal testing track and after testing that all's well, I'll promote it to Production. The problem that I'm seeing is that since every build is auto-tested by Play Store's Pre-Launch Report, it immediately brings on 5+ users on to my app which start sending analytics events. This is ending up inflating my analytics data unnecessarily. How can I eliminate this? I do want the automated testing, it helps me overall, but ideally I want zero impact from the bots on my Analytics tracking.

I tried making a checking function to look for "firebase.test.lab" in the system contentResolver, but testing this is super-hard because it requires me to make a test release every time and then wait for like an hour to let the bots finish hammering to get to the next sane test cycle. So far I've not been able to skip turning on the analytics, here's the function I'm trying to build:

using (var actClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
    var context = actClass.GetStatic<AndroidJavaObject>("currentActivity");
    if (context == null) {copOut(); return;}
    AndroidJavaClass system = new AndroidJavaClass("android.provider.Settings$Global");
    if (system == null) {copOut(); return;}
    string inTestLab = system.CallStatic<string>("getString", context.Call<AndroidJavaObject>("getContentResolver"), "firebase.test.lab");
    if (inTestLab == null) {copOut(); return;}
    Debug.Log($"In TestLab:{inTestLab}");
    FirebaseAnalytics.SetAnalyticsCollectionEnabled(inTestLab != "true");


You must log in to answer this question.

Browse other questions tagged .