2

We use Firebase Analytics to track usage of our iOS app. We found that Firebase was tracking usage data of development builds, thus corrupting our data by showing inflated numbers. To fix that, we wrote:

if debugBuild || installedThroughXcode || TestFlight || simulator {
  AnalyticsConfiguration.shared().setAnalyticsCollectionEnabled(false)
}

This prevents our production data from being corrupted, but we'd still like data from TestFlight. Does Firebase offer a way to collect this data but partition it from production data?

We can't change the bundle ID because we need to test IAPs in TestFlight.

Kartick Vaddadi
  • 4,818
  • 6
  • 39
  • 55

2 Answers2

1

The Google App ID is used to keep track of all data, so if you use the same Google App ID for both Dev and Release, all of your data will end up in the same place on Firebase Dashboard. You might want to divert your traffic of TestFlight to a different Google App ID at runtime by using [FIRApp configureWithOptions:] (https://firebase.google.com/docs/reference/ios/firebasecore/api/reference/Classes/FIRApp#/c:objc(cs)FIRApp(cm)configureWithOptions:)

adbitx
  • 2,019
  • 8
  • 13
0

If you don't want to use multiple Firebase Projects, another workaround solution I found for this is by using UserProperties as your "custom filter". So after initializing Firebase, call:

Analytics.setUserProperty(isDebugBuild, forName: "debug")

isDebugBuild represents the if-clause you defined in your question to find out if this is a production-build or not. Here are some ways to find this out.

Now, in Firebase or Datastudio you can apply this property as a filter/comparison to filter out debug-build analytics and events from production-builds.

Dominik Seemayr
  • 830
  • 2
  • 12
  • 30