Google Analytics Detects Google Cloud Test Lab Tests as Active Users and New Users

I use Google Analytics and I see that all devices in the Cloud Test Lab are defined as “active users” and “new users” (which makes sense). Is there any way to detect this and not count them?

I see that they are not counted as installations on Google Play, so I expect the same behavior for Google Analytics.

This can be avoided by loading a different version in Alpha / Beta and Production with different tracking identifiers, but the Cloud Test Lab feature will become much more powerful if the same Apk is transferred from Alpha / Beta to Production.

+5
source share
2 answers

Depending on what you mean by "don't count them." If these cloud visits can be identified by source / facility or other unique parameter, I think it would be best practice to create another view in which these visits will be filtered. Otherwise, you can apply the segment to standard views, excluding these visits.

0
source

As already mentioned, you can exclude analytics by the IP addresses indicated on the page https://firebase.google.com/docs/test-lab/android/overview#and_mobile_advertising

Here is some code to handle this (apache commons-net required) This should cover all current cases.

NOTE. You will need to call it only once when the application starts, because the Test Lab device will not change the IP addresses, and the NON Test Lab device will not. I suppose this suggests that a Wi-Fi connection is also established ...

private static boolean isTestLabIpAddress(Context context) { WifiManager wm = (WifiManager) context.getApplicationContext().getSystemService(WIFI_SERVICE); String ip = Formatter.formatIpAddress(wm.getConnectionInfo().getIpAddress()); // Log.i(TAG, "isTestLabIpAddress: ip: " + ip); for diagnosis, you may want this temporarily to be able to check the TestLab device logcat logs // https://firebase.google.com/docs/test-lab/android/overview#and_mobile_advertising List<String> cidrAddrs = new ArrayList<>(); //Physical devices cidrAddrs.add("108.177.6.0/23"); //Virtual devices cidrAddrs.add("35.192.160.56/29"); cidrAddrs.add("35.196.166.80/29"); cidrAddrs.add("35.196.169.240/29"); cidrAddrs.add("35.203.128.0/28"); cidrAddrs.add("35.234.176.160/28"); cidrAddrs.add("199.192.115.0/30"); cidrAddrs.add("199.192.115.8/30"); cidrAddrs.add("199.192.115.16/29"); for (String cidrRange : cidrAddrs) { SubnetUtils utils = new SubnetUtils(cidrRange); // build.gradle - implementation 'commons-net:commons-net:3.6' boolean isInRange = utils.getInfo().isInRange(ip); if (isInRange) { //Log.d(TAG, "isTestLabIpAddress: true: " + ip); return true; } } return false; } 
0
source

Source: https://habr.com/ru/post/1245639/


All Articles