Remote Config Parameters and Conditions

When using Remote Config, 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 service-side parameter values using the Firebase console. 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, you can create new default values for your parameters, as well as conditional values that are used to target groups of app instances. 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, and 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.

A conditional value consists of a condition, and a value that is fetched by app instances targeted by that condition. 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

  1. First, conditional values are applied, if any have conditions that evaluate to true for a given app instance. If multiple conditions evaluate to true, 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 service. You can change the priority of conditions by dragging and dropping conditions in the Conditions tab.
  2. If there are no conditional values with conditions that evaluate to true, the service-side default value is provided when an app fetches values from the service. If a parameter doesn't exist in the service, 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

  1. If a value was fetched from the service and then activated, the app uses the fetched value. Activated parameter values are persistent.
  2. If no value was fetched from the service, or if values fetched from the service have not been activated, the app uses the in-app default value.
  3. If no in-app default value has been set, the app uses a static type value (such as 0 for int and false for boolean).

This graphic summarizes how parameter values are prioritized in the service, and in your app:

Rule types

The following rule types are supported:

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:
  • For iOS: Use the app's CFBundleIdentifier. You can find the Bundle Identifier in the General tab for your app's primary target in Xcode.
  • For Android: Use the app's applicationId. You can find the applicationId in your app-level build.gradle file.
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 android:versionName. 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
 
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 Firebase 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.
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:
=, ≠, >, ≥, <, ≤
Select from a list of available Firebase Analytics user properties. To learn how you can use user properties to customize your app for very specific segments of your userbase, 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 100 conditions. Parameter keys can be up to 256 characters long, and must start with an English letter character (A-Z, a-z). The total length of parameter value strings within a project cannot exceed 500,000 characters.

Next steps

To get started configuring your Firebase project, see Set up a Firebase Remote Config Project.

Send feedback about...

Need help? Visit our support page.