> [!NOTE]
> **Note:** This feature is supported for Android, iOS and Web applications.

When you use Firebase Remote Config to deploy settings for an application
with an active user base, you want to make sure you get it right. You can use
A/B Testing experiments to best determine the following:

- **The best way to implement a feature to optimize the user experience.** Too often, app developers don't learn that their users dislike a new feature or an updated user experience until their app's rating in the app store declines. A/B Testing can help measure whether your users like new variants of features, or whether they prefer the app as it exists. Plus, keeping most of your users in a baseline group ensures that most of your user base can continue to use your app without experiencing any changes to its behavior or appearance until the experiment has concluded.
- **The best way to optimize the user experience for a business goal.** Sometimes you're implementing product changes to maximize a metric like revenue or retention. With A/B Testing, you set your business objective, and Firebase performs the statistical analysis to determine if a variant is outperforming the baseline for your selected objective.

> [!NOTE]
> **Note:** Real-time updates are supported for A/B Testing experiments. Ensure your application uses the latest required SDK versions (Firebase SDK for Android v34.13.0+, Firebase SDK for Apple platforms v12.13.0+ and Firebase JavaScript SDK v12.15.0+) to leverage this feature.

To A/B test feature variants with a baseline, do the following:

1. Create your experiment.
2. Manage your experiment.

> [!IMPORTANT]
> **Important:** Make sure you have the minimum SDK version for A/B Testing: Firebase SDK for Android v17.1.1+, Firebase SDK for Apple platforms v4.5.0, and Firebase JavaScript SDK v12.8.0.

## Create an experiment

A Remote Config experiment lets you evaluate multiple variants on one or
more [Remote Config parameters](https://firebase.google.com/docs/remote-config/parameters.md.txt).

1. Verify that Google Analytics is enabled in your project so that the
   experiment has access to Analytics data.

   If you didn't enable Google Analytics when creating your project, you
   can enable it in the
   **Settings** \>
   [**Integrations** tab](https://console.firebase.google.com/project/_/settings/integrations)
   of the Firebase console.
2. In the Firebase console, go to **DevOps \& Engagement** \> [**A/B Testing**](https://console.firebase.google.com/project/_/experiments/list)

3. Click **Create experiment** , and then select **Remote Config** when
   prompted for the service you want to experiment with.

4. In the **Variants** section, choose a baseline and at least one variant for
   the experiment. You can add one or more parameters to experiment with. You
   can repeat this step to add multiple parameters to your experiment.

5. (optional) To add more than one variant to your experiment, click **Add
   another variant**.

6. Change one or more parameters for specific variants. Any unchanged
   parameters are the same for users not included in the experiment.

7. Expand **Variant Weights** to view or change variant weight for the
   experiment. By default, each variant is weighted equally. Note that uneven
   weights may increase data collection time and **weights cannot be changed
   after the experiment begins**.

8. Define the **Targeting** criteria for your experiment using
   Remote Config conditions:

   - **Reuse an existing condition:** If an existing condition in your
     Remote Config template already matches your target audience, select
     it from the list.

     > [!IMPORTANT]
     > **Important:** If you reuse an existing condition for an experiment, **you cannot edit that condition until the experiment has completed or
     > stopped**. Modifying a shared condition while an experiment is actively running can alter variant assignment and invalidate experiment measurements.

   - **Verify condition evaluation order:** Make sure your conditions on the
     **Conditions** page are organized in the correct priority order. Because
     Remote Config evaluates conditions sequentially from top to bottom,
     other higher-priority condition(s) can prevent sufficient users from
     reaching the condition associated with your experiment.

   - **Create a new condition:** If no existing condition satisfies your
     targeting requirements, or if you prefer to duplicate an existing
     condition (for example, to avoid locking a condition that is shared by
     other parameters), create a new condition by first choosing the app that
     uses your experiment. If the parameter you are testing also uses the
     existing (or another overlapping) condition, make sure the new
     experiment condition is placed **above** the existing condition on the
     **Conditions** tab (giving it higher evaluation priority); otherwise,
     users will match the existing condition first and won't flow into the
     experiment.

     You can then target a specific subset of users by clicking **and** and
     selecting one or more options from the following list:
     - **Version:** One or more versions of your app
     - **Build number:** The build number (Apple) or version code (Android) of your app
     - **Platform:** One or more platforms (iOS, Android, or Web) to target
     - **Operating system:** Target web app users based on their operating system and version
     - **Browser:** Target web app users based on their web browser and browser version
     - **Device category:** Target web app users based on whether their device is mobile or non-mobile
     - **Languages:** One or more languages and locales used to select users who might be included in the experiment
     - **Country/Region:** One or more countries or regions for selecting users who should be included in the experiment
     - **User audience:** Analytics audiences used to target users who might be included in the experiment
     - **User property:** One or more Analytics user properties for selecting users who might be included in the experiment
     - **User in random percentage:** Target a randomly selected percentage of users within a defined percentile range
     - **Imported segment:** Target users who belong to custom imported segments uploaded to your project
     - **Date/Time:** Target users based on a specified date and time window
     - **First open:** Target users based on the first time they ever opened your app
     - **Installation ID:** Target specific test devices or client instances using their Firebase Installation IDs (FIDs)
     - **User exists:** Target all users across all apps in the project
     - **Custom signal:** Target users based on custom client-side key-value signals passed at runtime

   > [!NOTE]
   > **Note:** Due to Google Analytics [data processing
   > latency](https://support.google.com/analytics/answer/1070983#DataProcessingLatency), experiments that target Analytics user audiences may require more time to accumulate data. To learn more about this and other targeting options, see [User targeting](https://firebase.google.com/docs/ab-testing/abtest-config.md.txt#user-targeting).

9. Set the **Exposure:** Enter the percentage of your app's user base matching
   the criteria set under **Targeting** that you want to evenly divide
   between the baseline and one or more variants in your experiment. This can
   be any percentage between 0% and 100%. Users are randomly assigned to each
   experiment, including duplicated experiments.

10. Optionally, set an activation event to ensure that only the data from users
    who have first triggered some Analytics event are counted in your
    experiment. Note that *all* users matching your targeting parameters will
    receive Remote Config experimental values, but only those who trigger an
    activation event will be included in your experiment results.

    > [!NOTE]
    > **Note:** Activation events are not supported for A/B Testing web implementations.

    To ensure a valid experiment, make sure that the event you choose occurs
    *after* your app activates fetched configuration values. In addition, the
    following events cannot be used because they always occur before fetched
    values are activated:
    - `app_install`
    - `app_remove`
    - `app_update`

    The Analytics event you select as the activation event must not also be
    used as the primary metric (or as an additional metric) in the same
    experiment. Doing so will trigger a validation error in the Firebase
    console and prevent your experiment from launching.
11. For the experiment's
    [**Goals**](https://firebase.google.com/docs/ab-testing/abtest-config.md.txt#goal-metrics), select the primary
    metric to track, and add any additional metrics you want to track from the
    list. These include built-in objectives (purchases, revenue, retention,
    crash-free users, etc.), Analytics conversion events, and other
    Analytics events. When finished, click **Next**.

12. Click **Save** to save your experiment. You must publish the template to
    start running your experiment.

> [!NOTE]
> **Note:** Once the experiment is running, you can monitor the fetch percentage for your test variants versus the default value in the **DevOps \& Engagement** \> **Remote Config** \> [**Parameters** page](https://console.firebase.google.com/project/_/config) of the Firebase console.

You are allowed up to 300 experiments per project (including rollouts),
which could consist of up to 24 running experiments and rollouts, with the rest as completed
experiments.

## Manage your experiment

When you create an experiment with Remote Config, you can start your
experiment, monitor your experiment while it is running, and increase the number
of users included in your running experiment.

When your experiment is done, you can take note of the settings used by the
winning variant, and then roll out those settings to all users. Or, you can run
another experiment.

### Edit an experiment

1. In the **DevOps \& Engagement** section of the [Firebase console](https://console.firebase.google.com/) navigation menu, click **Remote Config**.
2. Click the **A/B Tests** tab.
3. Click **Running**, click an experiment that you want to edit.
4. Click the context menu () and click **Edit running experiment**.
5. To validate that your app has users who would be included in your experiment, expand the details and check for a number greater than **0%** in the **Targeting and distribution** section (for example, **1% of users
   matching the criteria**).

### Monitor an experiment

Once an experiment has been running for a while, you can check in on its
progress and see what your results look like for the users who have participated
in your experiment so far.

1. In the **DevOps \& Engagement** section of the [Firebase console](https://console.firebase.google.com/) navigation menu, click **Remote Config**.
2. Click the **A/B Tests** tab.
3. Click **Running** or **Completed**, and then click, or search for, the
   title of your experiment. On this page, you can view various observed and
   modeled statistics about your experiment, including the following:

   - **% difference from baseline**: A measure of the improvement of a metric for a given variant as compared to the baseline. Calculated by comparing the value range for the variant to the value range for the baseline.
   - **Probability to beat baseline**: The estimated probability that a given variant beats the baseline for the selected metric.
   - **<var translate="no">observed_metric</var> per user**: Based on experiment results, this is the predicted range that the metric value will fall into over time.
   - **Total <var translate="no">observed_metric</var>** : The observed cumulative value for the baseline or variant. The value is used to measure how well each experiment variant performs, and is used to calculate **Improvement** , **Value range** , **Probability to beat baseline** , and **Probability to
     be the best variant**. Depending on the metric being measured, this column may be labeled "Duration per user," "Revenue per user," "Retention rate," or "Conversion rate."
4. After your experiment has run for a while (14 days for Remote Config),
   data on this page indicates which variant, if any, is the "leader." Some
   measurements are accompanied by a bar chart that presents the data in a
   visual format.

> [!TIP]
> **Tip:** You can sort by column and filter your A/B Testing experiments by name and experiment status.

### Roll out an experiment to all users

After an experiment has run long enough that you have a "leader," or winning
variant, for your goal metric, you can release the experiment to 100% of users.
This lets you select a variant to publish to all users moving forward. Even if
your experiment has not created a clear winner, you can still choose to release
a variant to all of your users.

1. In the **DevOps \& Engagement** section of the [Firebase console](https://console.firebase.google.com/) navigation menu, click **Remote Config**.
2. Click the **A/B Tests** tab.
3. Click **Completed** or **Running** , click an experiment that you want to release to all users, click the context menu () **Roll out variant**.
4. Roll out your experiment to all users by doing the following:
   - For a **Remote Config** experiment, select a variant to determine which Remote Config parameter values to update. The targeting criteria defined when creating the experiment is added as a new condition in your template, to ensure the rollout only affects users targeted by the experiment. After clicking **Review in Remote Config** to review the changes, click **Publish changes** to complete the rollout.

### Expand an experiment

If you find that an experiment isn't bringing in enough users for A/B Testing
to declare a leader, you can increase distribution of your experiment to reach a
larger percentage of the app's user base.

1. In the **DevOps \& Engagement** section of the [Firebase console](https://console.firebase.google.com/) navigation menu, click **Remote Config**.
2. Click the **A/B Tests** tab.
3. Select the running experiment that you want to edit.
4. In the **Experiment overview** , click the context menu (), and then click **Edit running experiment**.
5. The **Targeting** section in the sidebar displays an option to increase the percentage of users who are in the running experiment. Select a number greater than the current percentage and click **Publish**. The experiment will be pushed out to the percentage of users you have specified.

### Duplicate an experiment

1. In the **DevOps \& Engagement** section of the [Firebase console](https://console.firebase.google.com/) navigation menu, click **Remote Config**.
2. Click the **A/B Tests** tab.
3. Select the running or completed experiment that you want to stop.
4. Click **Completed** or **Running** , hold the pointer over your experiment, click the context menu (), and then click **Duplicate experiment** or **Stop experiment**.

### Stop an experiment

1. In the **DevOps \& Engagement** section of the [Firebase console](https://console.firebase.google.com/) navigation menu, click **Remote Config**.
2. Click the **A/B Tests** tab.
3. Select the running or completed experiment that you want to stop.
4. Click **Completed** or **Running** , hold the pointer over your experiment, click the context menu (), and then click **Stop experiment**.

## Web client identification and experiment persistence

> [!NOTE]
> **Note:** This section is relevant only for web applications.

When a user launches a web application using Firebase A/B Testing in a
browser for the first time, a unique Firebase installation ID (
FID) is generated. This FID is
persistently stored in the browser's IndexedDB to identify the app instance
across sessions.

Firebase A/B Testing uses the FID to assign users to
experiment variants, and Google Analytics uses it for event aggregation to
measure and analyze user behavior within each variant.

Because the FID is stored in IndexedDB,
Firebase A/B Testing treats a user as a new user if they access your app from
a different browser or in an incognito window, or if they clear their
browser's IndexedDB. This means that a user might be included in different
experiment variants when using different browsers or browsing sessions.

## User targeting

You can target the users to include in your experiment using the following
user-targeting criteria.

The following rule types are supported in the Firebase console. Equivalent
features are available in the Remote Config REST API, as detailed in the
[conditional expression reference](https://firebase.google.com/docs/remote-config/condition-reference.md.txt).

|---|---|---|---|
| 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 a bundle ID or Android package name that defines an attribute that's exposed as **App ID** in Remote Config rules. <br /> Use this attribute as follows: - **For Apple platforms:** Use the app's [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070). 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](https://developer.android.com/build/configure-app-module#set-application-id). You can find the `applicationId` in your app-level `build.gradle(.kts)` file. |
| App version | **For string values:** exactly matches, contains, does not contain, contains regular expression <br /> **For numeric values:** \<, \<=, =, !=, \>, \>= | Specify the version(s) of your app to target. Before using this rule, you must use an **App ID** rule to select an Android/Apple app associated with your Firebase project. | **For Apple platforms:** Use the app's [CFBundleShortVersionString](https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring). **Note:** Make sure your Apple app is using Firebase Apple platforms SDK version 6.24.0 or higher, as CFBundleShortVersionString is not being sent in earlier versions (see [release notes](https://firebase.google.com/support/release-notes/ios.md.txt#remote-config_4)). **For Android:** Use the app's [versionName](https://developer.android.com/guide/topics/manifest/manifest-element.html#vname). **Note:** Numeric comparison operators (`<`, `<=`, `=`, `!=`, `>`, `>=`) support only numeric semantic versions (such as `1.2.3`). They do not support pre-release suffixes or hyphens (such as `-beta` or `-rc`). For version strings with non-numeric suffixes or hyphens (such as `1.5-beta`), use string operators instead (such as **contains regular expression** , **contains** , or **exactly matches**). String comparisons for this rule are case-sensitive. When using the **exactly matches** , **contains** , **does not contain** , or **contains regular expression** operator, you can select multiple values. When using the **contains regular expression** operator, you can create regular expressions in [RE2](https://github.com/google/re2/wiki/Syntax) 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. |
| Build number | **For string values:** exactly matches, contains, does not contain, regular expression <br /> **For numeric values:** =, ≠, \>, ≥, \<, ≤ | Specify the build(s) of your app to target. Before using this rule, you must use an **App ID** rule to select an Apple or Android app associated with your Firebase project. | This operator is available for Apple and Android apps only. It corresponds to the app's [CFBundleVersion](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102364) for Apple and [versionCode](https://developer.android.com/studio/publish/versioning#appversioning) for Android. String comparisons for this rule are case-sensitive. When using the **exactly matches** , **contains** , **does not contain** , or **contains regular expression** operator, you can select multiple values. When using the **contains regular expression** operator, you can create regular expressions in [RE2](https://github.com/google/re2/wiki/Syntax) 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. |
| Platform | == | iOS Android Web |   |
| Operating system | == | Specify the operating system(s) to target. Before using this rule, you must use an **App ID** rule to select a **Web app** associated with your Firebase project. | This rule evaluates to `true` for a given Web app instance if the operating system and its version matches a target value in the specified list. |
| Browser | == | Specify the browser(s) to target. Before using this rule, you must use an **App ID** rule to select a **Web app** associated with your Firebase project. | This rule evaluates to `true` for a given Web app instance if the browser and its version matches a target value in the specified list. |
| Device category | is, is not | mobile | This rule evaluates whether the device accessing your web app is mobile or non-mobile (desktop or console). This rule type is only available for web apps. |
| Languages | is in | 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. |
| Country/Region | is in | 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). |
| User audience(s) | Includes at least one | 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 on the actions of app users, it may take some time for a **User in audience** rule to take effect for a given app instance. This means that even if a user technically qualifies for an audience, if Analytics has not yet added the user to the audience when `fetchAndActivate()` is executed, the user won't match the condition. |
| User property | **For string values:** contains, does not contain, exactly matches, contains regular expression <br /> **For numeric values:** =, ≠, \>, ≥, \<, ≤ <br /> 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](https://firebase.google.com/docs/remote-config/config-analytics.md.txt#remote_config_and_user_properties). <br /> To learn more about user properties, see the following guides: - [Set user properties on Apple](https://firebase.google.com/docs/analytics/ios/properties) - [Set user properties on Android](https://firebase.google.com/docs/analytics/android/properties) When using the **exactly matches** , **contains** , **does not contain** or **contains regular expression** operator, you can select multiple values. When using the **contains regular expression** operator, you can create regular expressions in [RE2](https://github.com/google/re2/wiki/Syntax) 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](https://support.google.com/firebase/answer/6317486) are not available when creating Remote Config conditions. |
| User in random percentage | Slider (in the Firebase console. The [REST API](https://firebase.google.com/docs/remote-config/condition-reference.md.txt) uses the `<=`, `>`, and `between` operators). | 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 slider widget to segment randomly-shuffled users (app instances) into groups. Each app instance is persistently mapped to a random whole or fractional number, according to a *seed* defined in that project. Seed values can contain between one and 32 characters containing alphanumeric values, dots, hyphens, and/or underscores. A rule will use the default key (shown as **Edit seed** in the Firebase console) unless you modify the seed value. You can return a rule to using the default key by clearing the **Seed** field. To consistently address the same app instances within given percentage ranges, use the same seed value across conditions. Or, select a new randomly-assigned group of app instances for a given percentage range by specifying a new seed. For example, to create two related conditions that each apply to a non-overlapping 5% of an app's users, you could configure one condition to match a percentage between 0% and 5% and configure another condition to match a range between 5% and 10%. To allow some users to randomly appear in both groups, use different seed values for the rules within each condition. |
| Imported segment | is in | Select one or more imported segment. | This rule requires setting up custom [imported segments](https://firebase.google.com/docs/projects/import-segments.md.txt). |
| Date/Time | Before, After | 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. |
| First open | Before, After | Target users based on the first time they open your app: - Select **New users** to target users who first open your app after a specified future date and time. - Select **Time range** to target users who first open your app within the range before or after the date and time you specify. Combine **Before** and **After** conditions to target users within a specific time range. | User targeting by first open is available after you select an Android, iOS, or Web app. Requires the following SDKs: - Firebase SDK for Google Analytics - Apple platforms SDK v9.0.0+ or Android SDK v21.1.1+ (Firebase BoM v30.3.0+), and JavaScript SDK v12.8.0+. Analytics must also have been enabled on the client during the first open event. |
| Installation ID | is in | Specify one or more Installation IDs (up to 50) to target. | This rule evaluates to `true` for a given installation if that installation's ID is in the comma-separated list of values. <br /> To learn how you can get installation IDs, see [Retrieve client identifiers](https://firebase.google.com/docs/projects/manage-installations.md.txt#retrieve_client_identifiers). |
| User exists | (no operator) | Targets all users of all apps within the current project. | Use this condition rule to match all users within the project, regardless of app or platform. When using [Remote Config personalization](https://firebase.google.com/docs/remote-config/personalization.md.txt), you can use this operator to ensure that all users within the project receive personalized values. |
| Custom signal | **For string values:** contains, does not contain, exactly matches, contains regular expression <br /> **For numeric values:** =, ≠, \>, ≥, \<, ≤ <br /> **For version values:** =, ≠, \>, ≥, \<, ≤ | String comparisons for this rule are case-sensitive. When using the exactly matches, contains, does not contain, or contains regular expression operator, you can select multiple values. When using the contains regular expression operator, you can create regular expressions in [RE2](https://github.com/google/re2/wiki/Syntax) 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. The following data types are supported for client environments: - iOS: int, double - Android: int, long, double - Web: number Numeral that represents the version number(s) to match (for example, 2.1.0). | For more information on custom signal conditions and conditional expressions to use, see [Custom signal conditions](https://firebase.google.com/docs/remote-config/parameters.md.txt?template_type=client#custom_signal_conditions) and [Elements used to create conditions](https://firebase.google.com/docs/remote-config/condition-reference.md.txt#elements_used_to_create_conditions). |

> [!NOTE]
> **Note:** Experiments that target Analytics user audiences are subject to Analytics [data processing latency](https://support.google.com/analytics/answer/1070983#DataProcessingLatency). Even if a user technically qualifies for an audience, if Analytics has not yet added the user to the audience when `fetchAndActivate()` is executed, the user won't be included in the experiment.

## A/B Testing metrics

When you create your experiment, you choose a primary, or *goal* metric, that is
used to determine the winning variant. You should also track other metrics to
help you better understand each experiment variant's performance and track
important trends that may differ for each variant, like user retention, app
stability and in-app purchase revenue. You can track up to five non-goal metrics
in your experiment.

For example, say you're using Remote Config to launch two different game
flows in your app and want to optimize for in-app purchases and ad revenue, but
you also want to track the stability and user retention of each variant. In this
case, you might consider choosing **Estimated total revenue** as your goal
metric because it includes in-app purchase revenue and ad revenue, and then, for
**Other metrics to track**, you might add the following:

- To track your daily and weekly user retention, add **Retention (2-3 days)** and **Retention (4-7 days)**.
- To compare stability between the two game flows, add **Crash-free users**.
- To see more detailed views of each revenue type, add **Purchase revenue** and **Estimated ad revenue**.

> [!NOTE]
> **Note:** Analytics events *only* appear in metrics lists if your app has triggered them. However, you can type the metric name in the **Select goal metric** field and click **Create event** to add it, and it will be used when your app triggers these events in the future.

The following tables provide details on how goal metrics and other metrics are
calculated.

### Goal metrics

| Metric | Description |
|---|---|
| Crash-free users | The percentage of users who have not encountered errors in your app that were detected by the Firebase Crashlytics SDK during the experiment. **Note:** Firebase Crashlytics is not supported for web applications. |
| Estimated ad revenue | Estimated ad earnings. |
| Estimated total revenue | Combined value for purchase and estimated ad revenues. |
| Purchase revenue | Combined value for all `purchase` and `in_app_purchase` events. |
| Retention (1 day) | The number of users who return to your app on a daily basis. |
| Retention (2-3 days) | The number of users who return to your app within 2-3 days. |
| Retention (4-7 days) | The number of users who return to your app within 4-7 days. |
| Retention (8-14 days) | The number of users who return to your app within 8-14 days. |
| Retention (15+ days) | The number of users who return to your app 15 or more days after they last used it. |
| first_open | An Analytics event that triggers when a user first opens an app after installing or reinstalling it. Used as part of a conversion funnel. |

### Other metrics

| Metric | Description |
|---|---|
| notification_dismiss | An Analytics event that triggers when a notification sent by the Notifications composer is dismissed (Android only). |
| notification_receive | An Analytics event that triggers when a notification sent by the Notifications composer is received while the app is in the background (Android only). |
| os_update | An Analytics event that tracks when the device operating system is updated to a new version.To learn more, see [Automatically collected events](https://support.google.com/firebase/answer/6317485). This metric is not supported for web applications. |
| screen_view | An Analytics event that tracks screens viewed within your app. To learn more, see [Track Screenviews](https://firebase.google.com/docs/analytics/screenviews.md.txt). |
| session_start | An Analytics event that counts user sessions in your app. To learn more, see [Automatically collected events](https://support.google.com/firebase/answer/6317485). |

## BigQuery data export

In addition to viewing A/B Testing experiment data in the
Firebase console, you can inspect and analyze experiment data in
BigQuery. While A/B Testing does not have a separate
BigQuery table, experiment and variant memberships are stored on every
Google Analytics event within the Analytics event tables.

The user properties that contain experiment information are of the form
`userProperty.key like "firebase_exp_%"` or `userProperty.key =
"firebase_exp_01"` where `01` is the experiment ID, and
`userProperty.value.string_value` contains the (zero-based) index of the
experiment variant.

You can use these experiment user properties to extract experiment data.
This gives you the power to slice your experiment results in many different
ways and independently verify the results of A/B Testing.

To get started, complete the following as described in this guide:

1. [Enable BigQuery export for Google Analytics in the Firebase
   console](https://firebase.google.com/docs/ab-testing/abtest-config#enable-bigquery-export)
2. [Access A/B Testing data using BigQuery](https://firebase.google.com/docs/ab-testing/abtest-config.md.txt#access-abtesting-data)
3. [Explore example queries](https://firebase.google.com/docs/ab-testing/abtest-config.md.txt#explore-example-queries)

### Enable BigQuery export for Google Analytics in the Firebase console

If you're on the Spark plan, you can use the
[BigQuery sandbox](https://cloud.google.com/bigquery/docs/sandbox) to
access BigQuery at no cost, subject to
[Sandbox limits](https://cloud.google.com/bigquery/docs/sandbox#limitations).
See
[Pricing and the BigQuery sandbox](https://firebase.google.com/docs/projects/bigquery-export.md.txt?product=analytics#pricing)
for more information.

First, make sure that you're exporting your Analytics data to
BigQuery:

1. In the Firebase console, go to the
   **Settings** \>
   [**Integrations** tab](https://console.firebase.google.com/project/_/settings/integrations).

2. In the **BigQuery** card, click **Manage** and verify that
   your project is exporting Analytics data to BigQuery.

   If the card says **Link**, then you need to set up the export (continue to
   the next step).
3. If you need to set up export:

   1. Review **About Linking Firebase to BigQuery** , then click
      **Next**.

   2. In the **Configure integration** section, enable
      **Google Analytics**.

   3. Select a region and choose export settings.

      > [!NOTE]
      > **Note:** For more information about Google Analytics for Firebase settings, see [Data collection](https://support.google.com/analytics/answer/11593727).

   4. Click **Link to BigQuery**.

Depending on how you chose to export data, it may take up to a day for the
tables to become available. For more information about exporting project data to
BigQuery, see
[Export project data to BigQuery](https://firebase.google.com/docs/projects/bigquery-export.md.txt?product=analytics).

### Access A/B Testing data in BigQuery

Before querying for data for a specific experiment, you'll want to obtain some
or all of the following to use in your query:

- **Experiment ID:** You can obtain this from the URL of the **Experiment overview** page. For example, if your URL looks like `https://console.firebase.google.com/project/my_firebase_project/config/experiment/results/25`, the experiment ID is **25**.
- **Google Analytics property ID** : This is your 9-digit Google Analytics property ID. You can find this within Google Analytics; it also appears in BigQuery when you expand your project name to show the name of your Google Analytics event table (`project_name.analytics_000000000.events`).
- **Experiment date:** To compose a faster and more efficient query, it's good practice to limit your queries to the Google Analytics daily event table partitions that contain your experiment data---tables identified with a `YYYYMMDD` suffix. So, if your experiment ran from February 2, 2026 through May 2, 2026, you'd specify a `_TABLE_SUFFIX between
  '20260202' AND '20260502'`. For an example, see [Select a specific experiment's values](https://firebase.google.com/docs/ab-testing/abtest-config.md.txt#select-a-specific-experiment).
- **Event names:** Typically, these correspond with your [goal metrics](https://firebase.google.com/docs/ab-testing/abtest-with-console.md.txt#ab-testing-metrics) that you configured in the experiment. For example, `in_app_purchase` events, `ad_impression`, or `user_retention` events.

> [!TIP]
> **Tip:** If you're on the Blaze plan, Firebase can generate a sample query to extract the experiment name, variant, event name, and number of events for the experiment you select. Learn more at [Query experiment data using the Firebase console's auto-generated query](https://firebase.google.com/docs/ab-testing/abtest-config.md.txt#query-experiment-data-generated)

After you gather the information you need to generate your query:

1. In the Google Cloud console, go to [BigQuery](https://console.cloud.google.com/bigquery?project=_).
2. Select your project, then select **Create SQL query**.
3. Add your query. For example queries to run, see [Explore example queries](https://firebase.google.com/docs/ab-testing/abtest-config.md.txt#explore-example-queries).
4. Click **Run**.

> [!TIP]
> **Tip:** While these steps describe using the Google Cloud console, you can also use the CLI or client libraries to query BigQuery. Find out more in the [BigQuery documentation](https://cloud.google.com/bigquery/docs).

#### Query experiment data using the Firebase console's auto-generated query

If you're using the Blaze plan, the **Experiment overview** page provides a
sample query that returns the experiment name, variants, event names, and the
number of events for the experiment you're viewing.

To obtain and run the auto-generated query:

1. In the Firebase console, go to **DevOps \& Engagement** \> [**A/B Testing**](https://console.firebase.google.com/project/_/experiments/list).
2. Select the A/B Testing experiment you want to query to open the **Experiment overview**.
3. From the Options menu, beneath **BigQuery integration** , select **Query experiment data** . This opens your project in BigQuery within the Google Cloud console console and provides a basic query you can use to query your experiment data.

The following example shows a generated query for an experiment with
three variants (including the baseline) named "Winter welcome experiment."
It returns the active experiment name, variant name, unique event, and
event count for each event. Note that the query builder doesn't specify
your project name in the table name, as it opens directly within your project.

```sql
  /*
    This query is auto-generated by Firebase A/B Testing for your
    experiment "Winter welcome experiment".
    It demonstrates how you can get event counts for all Analytics
    events logged by each variant of this experiment's population.
  */
  SELECT
    'Winter welcome experiment' AS experimentName,
    CASE userProperty.value.string_value
      WHEN '0' THEN 'Baseline'
      WHEN '1' THEN 'Welcome message (1)'
      WHEN '2' THEN 'Welcome message (2)'
      END AS experimentVariant,
    event_name AS eventName,
    COUNT(*) AS count
  FROM
    `analytics_000000000.events_*`,
    UNNEST(user_properties) AS userProperty
  WHERE
    (_TABLE_SUFFIX BETWEEN '20260202' AND '20260502')
    AND userProperty.key = 'firebase_exp_25'
  GROUP BY
    experimentVariant, eventName
```

For additional query examples, proceed to
[Explore example queries](https://firebase.google.com/docs/ab-testing/abtest-config.md.txt#explore-example-queries).

### Explore example queries

The following sections provide examples of queries you can use to extract
A/B Testing experiment data from Google Analytics event tables.

#### Extract purchase and experiment standard deviation values from all experiments

You can use experiment results data to independently verify
Firebase A/B Testing results. The following BigQuery SQL statement
extracts experiment
variants, the number of unique users in each variant, and sums total revenue
from `in_app_purchase` and `ecommerce_purchase` events, and standard deviations
for all experiments within the time range specified as the `_TABLE_SUFFIX` begin
and end dates. You can use the data you obtain from this query with a
statistical significance generator for one-tailed t-tests to verify that the
results Firebase provides match your own analysis.

For more information about how A/B Testing calculates inference, see
[Interpret test results](https://firebase.google.com/docs/ab-testing/ab-concepts.md.txt#interpreting-test-results).

```sql
  /*
    This query returns all experiment variants, number of unique users,
    the average USD spent per user, and the standard deviation for all
    experiments within the date range specified for _TABLE_SUFFIX.
  */
  SELECT
    experimentNumber,
    experimentVariant,
    COUNT(*) AS unique_users,
    AVG(usd_value) AS usd_value_per_user,
    STDDEV(usd_value) AS std_dev
  FROM
    (
      SELECT
        userProperty.key AS experimentNumber,
        userProperty.value.string_value AS experimentVariant,
        user_pseudo_id,
        SUM(
          CASE
            WHEN event_name IN ('in_app_purchase', 'ecommerce_purchase')
              THEN event_value_in_usd
            ELSE 0
            END) AS usd_value
      FROM `PROJECT_NAME.analytics_ANALYTICS_ID.events_*`
      CROSS JOIN UNNEST(user_properties) AS userProperty
      WHERE
        userProperty.key LIKE 'firebase_exp_%'
        AND event_name IN ('in_app_purchase', 'ecommerce_purchase')
        AND (_TABLE_SUFFIX BETWEEN 'YYYYMMDD' AND 'YYYMMDD')
      GROUP BY 1, 2, 3
    )
  GROUP BY 1, 2
  ORDER BY 1, 2;
```

#### Select a specific experiment's values

The following example query illustrates how to obtain data for a specific
experiment in BigQuery. This sample query returns the experiment name,
variant names (including Baseline), event names, and event counts.

```sql
  SELECT
    'EXPERIMENT_NAME' AS experimentName,
    CASE userProperty.value.string_value
      WHEN '0' THEN 'Baseline'
      WHEN '1' THEN 'VARIANT_1_NAME'
      WHEN '2' THEN 'VARIANT_2_NAME'
      END AS experimentVariant,
    event_name AS eventName,
    COUNT(*) AS count
  FROM
    `analytics_ANALYTICS_PROPERTY.events_*`,
    UNNEST(user_properties) AS userProperty
  WHERE
    (_TABLE_SUFFIX BETWEEN 'YYYMMDD' AND 'YYYMMDD')
    AND userProperty.key = 'firebase_exp_EXPERIMENT_NUMBER'
  GROUP BY
    experimentVariant, eventName
```