【问题标题】:Google Analytics detects Google Cloud Test Lab tests as Active Users and New UsersGoogle Analytics 将 Google Cloud Test Lab 测试检测为活跃用户和新用户
【发布时间】:2020-10-04 15:29:51
【问题描述】:

我正在使用 Google Analytics,并且我看到云测试实验室中的所有设备都被检测为“活跃用户”和“新用户”(这是有道理的)。有什么方法可以检测到这个并且不计算它们?

我发现它们在 Google Play 中未被计为安装,因此我希望 Google Analytics(分析)的行为相同。

可以通过将具有不同跟踪 ID 的不同版本上传到 Alpha/Beta 和 Production 来避免这种情况,但是如果将同一个 Apk 从 Alpha/Beta 提升到 Production,Cloud Test Lab 功能会更加强大。

【问题讨论】:

    标签: android google-analytics google-cloud-test-lab


    【解决方案1】:

    根据this 的回答,您可以检查"firebase.test.lab" 系统变量是否设置为"true",这表明您是否在测试实验室设备上运行。

    【讨论】:

      【解决方案2】:

      取决于您所说的“不计算它们”是什么意思。如果这些云访问可以通过来源/媒介或其他独特参数来识别,我认为最佳做法是创建另一个视图,在其中过滤掉这些访问。否则,您可以将细分应用到排除这些访问的标准视图。

      【讨论】:

      • 知道如何排除这些访问或如何识别它们吗?
      • 来自云测试实验室的会话应通过 GA 作为 108.177.6.0.x - 108.177.6.24.x 范围内的 IP。如引用here。您应该在 GA 中创建一个过滤视图,用于过滤或子集范围内的 IP。使用过滤器类型=自定义。查看云访问的 IP 地址结构,您需要创建一个包含范围 (0-24) 和子网 (x) 的 reg 表达式以包含所有 IP。这会产生以下 reg 表达式 ^108\.177\.6\.[6-24]\.*$
      • 根据Catherine发布的链接,当前测试设备的IP范围为108.177.6.0/23,因此IP地址将以108.177.6.108.177.7.开头。使用这些前缀设置两个 IP 过滤器对我有用。
      【解决方案3】:

      如上所述,您可以通过页面https://firebase.google.com/docs/test-lab/android/overview#and_mobile_advertising 中列出的 IP 地址排除分析

      这里有一些代码来处理这个(需要 apache commons-net) 这应该涵盖所有当前的案例。

      注意:您只需在应用启动时调用一次,因为测试实验室设备不会更改 IP 地址,而非测试实验室设备也不会变成一个。我想这有点假设wifi连接也建立了......

      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;
      }
      

      【讨论】:

      • 还有 35.243.2.0/27(添加 7-2019)
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多