When using Firebase console or the Remote Config REST API, you define one or more parameters (key-value pairs) and provide in-app default values for those parameters. You can override in-app default values by defining server-side parameter values. Parameter keys and parameter values are strings, but parameter values can be cast as other data types when you use these values in your app.
Using the Firebase console or the Remote Config REST API, you can create new default values for your parameters, as well as conditional values that are used to target groups of app instances. Each time you update your configuration in theFirebase console, Firebase creates and publishes a new version of your Remote Config template. The previous version is stored, allowing you to retrieve or rollback as needed. These operations are also available to you via the REST API.
This guide explains parameters, conditions, rules, conditional values, and how various parameter values are prioritized on the Remote Config Server and in your app. It also provides details on the types of rules used to create conditions.
Conditions, rules, and conditional values
A condition is used to target a group of app instances. Conditions are made
up of one or more rules that must all evaluate to true
for the condition to
evaluate to true
for a given app instance. If the value for a rule is
undefined (for example, when no value is available), that rule will evaluate to
false
.
For example, a parameter that defines an
app's splash page could display different images based on OS type using the
simple rule if device_os = Android
:
Or, a time condition could be used to control when your app displays special promotional items.
A parameter can have multiple conditional values that use different conditions, and parameters can share conditions within a project.
Parameter value priority
A parameter might have several conditional values associated with it. The following rules determine which value is fetched from the Remote Config Server, and which value is used in a given app instance at a particular point in time:
Server-side parameter values are fetched according to the following priority list
First, conditional values are applied, if any have conditions that evaluate to
true
for a given app instance. If multiple conditions evaluate totrue
, the first (top) one shown in the Firebase console UI takes precedence, and conditional values associated with that condition are provided when an app fetches values from the backend. You can change the priority of conditions by dragging and dropping conditions in the Conditions tab.If there are no conditional values with conditions that evaluate to
true
, the server-side default value is provided when an app fetches values from the backend. If a parameter doesn't exist in the backend, or if the default value is set to No value, then no value is provided for that parameter when an app fetches values.
In your app, parameter values are returned by get
methods according to
the following priority list
- If a value was fetched from the backend and then activated, the app uses the fetched value. Activated parameter values are persistent.
- If no value was fetched from the backend, or if values fetched from the Remote Config backend have not been activated, the app uses the in-app default value.
- If no in-app default value has been set, the app uses a static type
value (such as
0
forint
andfalse
forboolean
).
This graphic summarizes how parameter values are prioritized in the
Remote Config backend, and in your app:
Condition rule types
The following rule types are supported in the Firebase console. Equivalent functionality is available in the Remote Config REST API, as detailed in the conditional expression reference.
Rule type | Operator(s) | Value(s) | Note |
---|---|---|---|
App | == | Select from a list of App IDs for apps associated with your Firebase project. | When you add an app to Firebase, you enter an iOS bundle ID or Android
package name that defines an attribute that's exposed as App ID in
Remote Config rules.
Use this attribute as follows:
|
App version |
exactly matches, contains, does not contain, regular expression |
Enter a value to specify a specific version (or related versions) of your app. Before using this rule, you must use an App ID rule to select an app that is associated with your Firebase project. | For iOS apps, this is the app's CFBundleVersion. For Android apps, this is the app's version name. String comparisons for this rule are case-sensitive. When using the exactly matches, contains or does not contain operator, you can provide a comma-separated list of values. When using the regular expression operator, you can create regular expressions in RE2 format. Your regular expression can match all or part of the target version string. You can also use the ^ and $ anchors to match the beginning, end, or entirety of a target string. |
OS type | == | iOS Android |
|
Date/Time | <=, > | A specified date and time, either in the device timezone or a specified timezone such as "(GMT+11) Sydney time." | Compares the current time to the device fetch time. |
User in random percentile | <=, > | 0-100 | Use this field to apply a change to a random sample of app instances (with sample sizes as small as .0001%), using the <= and > operators to segment users (app instances) into groups. Each app instance is persistently mapped to a random whole or fractional number, according to a key defined in that project. A rule will use the default key (shown as DEF in Firebase console) unless you select or create another key. You can return a rule to using the default key by clearing the Randomize users using this key field. You can use a single key across rules to consistently address the same app instances within given percentage ranges. Or, you can select a new randomly-assigned group of app instances for a given percentage range by creating a new key. For example, to create two related conditions that each apply to a non-overlapping 5% of an app's users, you could have one condition include a <= 5% rule, and another condition include both a > 5% rule and a <= 10% rule. To make it possible for some users to randomly appear in both groups, use different keys for the rules in each condition. |
User in audience | == | Select one or more from a list of Google Analytics audiences that you have set up for your project. | This rule requires an App ID rule to select an app associated with your Firebase project. Note: Because many Analytics audiences are defined by events or user properties, which can be based the actions of app users, it may take some time for a User in audience rule to take effect for a given app instance. |
Device in region/country | == | Select one or more regions or countries. | This rule evaluates to true for a given app instance if the
instance is in any of the regions or countries listed. The device country code
is determined using the device's IP address in the request or the country code
determined by Firebase Analytics (if Analytics data is shared with Firebase).
|
Device language | == | Select one or more languages. | This rule evaluates to true for a given app instance if that
app instance is installed on a device that uses one of the languages listed.
|
User property |
For string values:
contains, does not contain, exactly matches, regular expression For numeric values: =, ≠, >, ≥, <, ≤ Note: On the client, you can set only string values for user properties. For conditions that use numeric operators, Remote Config converts the value of the corresponding user property into an integer/float. |
Select from a list of available Google Analytics user properties. | To learn how you can use user properties to customize your app for
very specific segments of your user base, see
Remote Config and user properties.
To learn more about user properties, see the following guides: When using the exactly matches, contains or does not contain operator, you can provide a comma-separated list of values. When using the regular expression operator, you can create regular expressions in RE2 format. Your regular expression can match all or part of the target version string. You can also use the ^ and $ anchors to match the beginning, end, or entirety of a target string. Note: Automatically collected user properties are not currently available when creating Remote Config conditions. |
Searching parameters and conditions
You can search your project's parameter keys, parameter values, and conditions from the Firebase console using the search box at the top of the Remote Config Parameters tab.
Limits on parameters and conditions
Within a Firebase project, you can have up to 2000 parameters, and up to 500 conditions. Parameter keys can be up to 256 characters long, must start with an underscore or English letter character (A-Z, a-z), and may also include numbers. The total length of parameter value strings within a project cannot exceed 800,000 characters.
Next steps
To get started configuring your Firebase project, see Set up a Firebase Remote Config Project.