Purpose of the article: To educate the beginner and react native developers to work with the Firebase by using different features like A/B testing, remote config.
Intended Audience: React Native Enthusiasts
Tools and Technology: React Native, Visual Studio
Keywords: Firebase, Analytics, split test, remote config
Why A/B Testing?
As a developer, we are constantly challenged to satisfy customer expectations, particularly with regular product changes, by learning about their interests and demands. We may use A/B testing to improve the App’s productivity and usability.
What is A/B testing?
A/B testing is a sort of user research that entails a randomized experiment with two versions, A and B. The term “split test” is another way of referring to this method of comparing two variations of a single variable, usually by comparing a subject’s response to variant A versus variant B and concluding which is more successful.
How to implement A/B testing?
Okay, so an A/B Test has only two variants, whereas a Split Test has more than two variants. Nice, but how can I begin an experiment now?
There are a lot of simple ways to build experiments into Web Environments, but it’s not so simple in React Native Apps. We have a problem with releases. Fortunately, we still have options, and Firebase is one of them.
Firebase is a cloud-based mobile and web app development platform that is connected with Google Cloud Platform and uses a collection of tools for project creation and synchronization. We’ll leverage two features provided by Firebase. The first is the “Remote Config Values” tool, which is nothing more than variables in the Firebase cloud that we can access from our App, and the second is the “A/B Testing” tool, which will be in charge of dividing the users and changing the value of that Remote Config variable for each one as needed. On our App’s side, we’ll simply be in charge of conditioning the code based on the value of that variable, and that’s it.
We have well organized official document even though I have mentioned the following steps to configure the firebase app as well as to integrate the remote config in react native App.
To use Firebase in our React Native app, we’ll need to install @react-native-firebase/app as well as add firebase configs first, followed by @react-native-firebase/remote-config to exploit the “Remote Config” feature. Because the installation and initial configuration are well documented in the official documentation (App QuickStart and Remote Config Quick Start), I will not address them in this article.
I highly suggest creating a “/firebase” folder in our “/src” directory (assuming you don’t already have one) to keep this and other files containing reusable methods or hooks. So, we’ll have something like “src/firebase/index.js,” with mainly three methods:
- SetDefaultSettings: Setting default values ensures that the local device and the Firebase servers are both up to date.
- Get All: In addition to reading all arguments by key, the API provides a getAll method.
- FetchAndActivate: We must first pull the values from Firebase (fetching) and then enable them on the device before reading them from Firebase (activating). Both tasks are combined into a single flow with the fetchAndActivate API.
1. Set Remote config Values on firebase console
2. Create an experiment by using remote config values
The aim of this blog is how to explore the A/B testing feature using remote config values; in upcoming blogs, I will explain how to use push notification as well as in-App messaging features. So, as I mentioned above, in short, A/B testing is a randomized experimentation process in which two or more versions of a variable are shown to different segments of website or mobile app visitors at the same time to see which version has the greatest impact and drives the most business metrics.
Note: Firebase A/B testing is still in beta version; it is not targeting custom audiences.
References/ Sources of the information referred: