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 sever-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 server. 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 server-side default value is provided when an app fetches values from the server. If a parameter doesn't exist on the server, 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 server and then activated, the app uses the fetched value. Activated parameter values are persistent.
  2. If no value was fetched from the server, or if values fetched from the server 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 on the server, 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 .01%), using the <= and > operators to segment users into non-overlapping groups.

Each app instance is consistently mapped to a random whole or fractional number within a project, so you can use a rule of this type to consistently address the same app instances.

For example, to create two related conditions that each apply to a non-overlapping .05% of an app's user base, you could have one condition include a <= .05% rule, and another condition include both a > .05% rule and a <= .10% rule.

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. 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.