A/B testing tools: How to integrate Firebase

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ricardo Ferreira

I recently developed an iOS application that compares two HTTP libs (NSURLSession and Alamofire) and I decided to use an A/B testing tool to gather information on which one performs better.

As I explore here, I defined my research parameters (them being easy to use and easy to gather support information), made some research to see which tools could fit my goals better and ended up with three platforms I was willing to test: Optimizely, Firebase and Kii.

As I know that many of you are often in my shoes, I decided to share all the struggles I had during the process of integrating their SDK’s with my mobile app; as well all the benefits that these tools have, from my point of view. Here's my experience with Firebase!

Firebase is Google's mobile platform, which helps you quickly develop high-quality apps and grow your business. Being a Google platform, there is no need to create an account: you can simply log in with your Google account.

Firebase provides a complete and quite useful documentation to help any developer creating an A/B testing and to integrate their framework with multiple platforms. I was a happy developer at that time, since the Firebase SDK also provided an API for my Swift application.

When you create an experiment with Firebase, you test out one or more variants of a testable action and measure how well the variants perform toward a goal that you want to achieve. Your targeted user group can be defined by multiple criteria chained with "AND" logic.

Even though you can install the Firebase SDK using the Carthage way or the manual way, I have used the CocoaPods. You just need to add the SDK to your Podfile and run the pod install command, and you’ll be ready to use it:

The next step was to create a new project for the app and get access to the dashboard. It allowed me to download the GoogleServices-info.plist file to be used on the app, so I just had to access Firebase console, create a new project by specifying the project id and the target platform, and I immediately had access to the dashboard.



To use the Firebase SDK in an application you need to validate your experiment on the test device, and each Firebase app installation has an instance ID token (or registration token) associated with it. You can use this token to test specific experiment variants on a test device with your app installed. To validate your experiment on a test device, use the following code:

On the Firebase console navigation bar, click in A/B testing and select the Remote Config or Notifications, depending on which experiment fits you better. Now, on the Draft tab select your experiment, click on the Manage test devices options, enter the instance ID token for a test device and choose the experiment variant to send to that test device. Finally, run the app and confirm that the selected variant is being received on the test device.

As I mentioned before, I've tried and integrated three different tools. Here's my overview on the three of them, here's a tutorial on how to integrate Kii and here's everything you need to know to integrate Optimizely.

Ricardo Ferreira

Written by Ricardo Ferreira


More Posts