Does Firebase Analytics help separate out data from TestFlight vs prod builds? - ios

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.

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:)

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.

Related

How to set Firebase install source for ios app?

Information.
IOS app swift, firebase+analytics, bigquery integration, iAd (https://developer.apple.com/documentation/iad)
Problem.
Most of installs are direct/none in firebase - so the same in analytics & bigquery. Main sources are google ads and apple ads. We can get apple ads source and campaign using iAd. But no info how to send this data to firebase (=how to set source for Firebase)
Question.
Is it possible to manually set source/medium/campaign for Firebase? Can't find anything :(
Any other tips how to get install source/medium/campaign and set it to Firebase?
Also, if we will use some tracker - appmetrica, appsflyer etc - there will be the same question - how to get source data from appsflyer and send it to Firebase
Thanks a lot!
As mentioned in the Firebase group conversation :
Setup multiple user properties based on the info you have (like
source, medium, campaign, etc)
Combine 2 or more user properties to
make an audience
Filter your attribution report on the audience
Follow the whole conversation here.
There is one documentation about how to add firebase to your apple project and another on installation of firebase in your apple app.
For more information you can refer to the blog5, medium post and link on how Campaign Attribution Works in Google Analytics for Firebase
Okay. After researches and tests I have this view
(1) First of all - unfortunately look like firebase team doesn't make clear and working method of setting custom sources
(2) There is some possibility to send something directly to source/medium/campaign in Firebase, but it work unstable.
To do this you need
Get somewhere your Source/Medium/Campaign (for example from iAd)
send 'campaign_details' event with source/medium/campaign params
Also, as mentioned Divyani Yadav - You can just send this params anywhere to user_properties
And somehow work with this data (using bigquery or making audiences to make some analysis in Analytics), but this approach doesn't rewrite firebase initial source/medium/campaign params

Can you have more than one iOS application utilizing the same Firebase back end?

I already have an app out with Apple that uses a specific bundle id and Firebase realtime DB for its back end.
Now instead of creating a new Firebase realtime DB project, I wish to use the same project; main reason being is that there will be information in the existing Firebase project that I will also require in the new application, as well as this should/wouild allow users to login to either app with the same credentials.
Now I want to create a NEW iOS bundle identifier id so that the app is separately purchased from the itunes store but access the same Firebase realtime DB data.... is that possible/allowed?
You can add 30 apps to a single project to share data, as described in the documentation.
Firebase restricts the total number of Firebase Apps within a Firebase project to 30.
See also:
Multiple apps in one project or one project per app in Firebase?
Pros and cons of using one project for multiple apps in Firebase Could Messaging
Adding multiple apps in a firebase project
Add multiple apps to single project in Firebase
Is there a way to have 1 Firebase database for 2 apps with different package names?
https://groups.google.com/g/firebase-talk/c/VAtoKx6qJjw

FirebaseAnalytics: logging events to multiple projects

I need to send FirebaseAnalytics events to two separate accounts. I've tried working with pure GAI but it is not showing in Firebase console.
How could I do that?
here it is covered for Android, while on the Firebase console, it is exactly the same:
however, it might be better (unless the goal is to tell apart debug & release builds),
to tell apart by the CAMPAIGN and/or CAMPAIGN_DETAILS.
as the Firebase documentation for Reliable Analytics states:
If runtime configuration is required, please note the following caveats:
If you're using AdMob and request ads at startup as recommended, you may miss some Analytics data to related to mobile ads when not using the resource based configuration approach.
Only ever supply a single Google app ID in each distributed variant of your app. For example, if you ship version 1 of your app with a certain GOOGLE_APP_ID in the configuration then upload version 2 with a different ID, it may cause analytics data to be dropped.
On iOS, do not add GoogleService-Info.plist to your project if you are supplying different configuration at run time, as this can result in an apparent change of GOOGLE_APP_ID and result in lost Analytics.
also see Manage project members ...in order to grant access to another Google account.
telling apart by campaigns makes sense, because alike that one can have several campaigns, while being able to compare their performance - which one otherwise could not, at least not that directly.
You need to first configure two different apps in your project. Then you can log separately to each one of them.
More info here: https://firebase.google.com/docs/configure/#support_multiple_environments_in_your_ios_application
Answering my own question.
Judging by the documentation and heavy personal research: there is no legal (or without the black magic) way to split analytics data into two separate Firebase projects.
Quote:
Note: On Android and iOS, Analytics are only logged for the default app
And switching default app on the fly didn't work.
Therefore, our team has decided to acquire google analytics account as a second analytics channel which solves our needs.
Hope it will help someone.
P.S. If you need to split debug data from release data watch Martin's answer.

Using Firebase with multiple users in an iOS app

A number of iOS apps I develop are used in scenarios where the Organisation has a number of Drivers and the iPhone is shared between them. Each Driver has his own app credentials, logs in to the app, and is presented with his own set of data. The Firebase data is persisted as he is offline most of the day and I use keepSynced(true) to ensure data is up-to-date.
The problem I'm having is that once a user logs out with the Firebase method FIRAuth.auth()!.signOut() then when a different user logs in, he sees the previous users' data. I'm guessing that because the data is persisted it is not cleared from the cache. However, I am retrieving the data by the user id so this doesn't quite explain it.
What is the best pattern to permit multiple users to use the same iOS app with Firebase ?
Try creating multiple instances of FIRApp, each with a different name, using the +configureWithName:options: method. Then use the different apps in FIRAuth +authWithApp and elsewhere as needed.
I haven't actually done this and am too new to Firebase to say it's the best pattern, but it seems like it should work.
One thing to note from the docs is that, "On Android and iOS, Analytics are only logged for the default app." One solution might to keep the __FIRAPP_DEFAULT app, and then make a named app for each user type.

Share data across multiple apps on iOS

I know there are quite a few threads on this, but it seems none of them would satisfy what I am trying to look for. Here's my constraints:
not a hack that uses private API/framework or undocumented
directory access that would run the risk of app being rejected
because of that
being able to share data across different
vendors / app developers
data can persist outside the lifecycle
of the app (even after app is deleted)
UPDATED: I was in general trying to stay away from using a 3rd party cloud-based service to achieve the goal as this would introduce additional external dependency. But if I have to, I was hoping it could satisfy this one constraint
being able to tell which iOS device it is communicating with. It shouldn't have to uniquely identify the device (which will go into that evil UDID discussion route as we all experienced ). But as long as it can differentiate among different iOS devices it should be fine.
I kind of need this too. I use Parse.com as the backend of all my apps — their free tier should satisfy your development needs.
Parse has APIs available for iOS, Android, Windows 8, OS X, JavaScript and .NET, with all your data available on the cloud on any platform (contrary to Core Data and iCloud). They also offer "Cloud Code," which is code you can execute remotely, to process information remotely and get the data back to your app.
You should definitely check Parse.com out for cloud storage for your app. In my experience, it really gets the job done.
For Data Persistence, I think you might want to take a look at FMDB (although if you decide to persist data locally, it will get deleted with your app, but it might help you, anyways). Core Data is an overkill in many cases.
Edit: Parse.com has an "Installation" class, in which all the devices that have your app installed get listed (wether they're running iOS or Android), uniquely, without you having to type any code.
Maybe this blog post by TextExpander authors will help:
Smile has responded to this by discussing the issue with Apple
engineers at WWDC, filing a bug (#14168862), and checking up on the
status of that bug. We also developed a workaround by storing the
TextExpander data in a new place. Reminders requires user consent to
store and retrieve data. Completed reminders are not normally shown in
its interface. Long-past reminders appear at the bottom of the
completed reminders.
TextExpander touch 2.1 (and later) supports storing shared snippet
data in a long-past, completed reminder. We produced an updated SDK
and kept our developers posted on its progress. Our final SDK was
ready within a few hours of the end of Apple's official iOS 7
announcement.
UPDATE (22.11.2013)
This might not be the best way to do that, because TextExpander's team recently had problems with the App Review Team.
Edit: this only works for apps with the same vendor.
You can save a password to the device's keychain, then access that password from any app.
Using the SSKeychain library...
NSString *service = #"com.yourcompany.yourservice";
// read
NSString *password = [SSKeychain passwordForService:service account:#"user"];
// write
[SSKeychain setPassword:password forService:service account:#"user"];
The password string doesn't have a length limit, so encode all your data as a string and save it there. The keychain entry will persist after the user deletes the app.
One of the ways to do this is using THRIFT. This is a data communication protocol that would need a back end server (private) and THRIFT can be compiled into many languages / platforms. There is a meta language to describe the data and then can be thrift compiled into many languages. Write the data definition once and can be used on many platforms.
More information at.
http://thrift.apache.org/
for me (I have 2 apps and a widged) the best solution is using SSKeyChain and do not forget to add Capabilities for your apps like here
or if you don't wanna to use 3rd party library you can use NSUserDefaults and set the group identifier like here but again do not forget to add the group identifier in Capabilities in AppGroups section for all your apps that have share data.

Resources