> For the complete documentation index, see [llms.txt](https://lionstudios.gitbook.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lionstudios.gitbook.io/readme/features/remote-configs/firebase/ab-experiments-firebase.md).

# AB Experiments (Firebase)

## Introduction

This document provides instructions for setting up the ***AB Experiments*** exclusively for Firebase only.

## Requirements

1. Lion Remote configs must be installed and setup. You can install the `Lion - Remote Configs` package from the package manager. More info can be found [here](broken://pages/wju7PSkJO17WCsTU5jsX) (only looking at the installation guide in the link will be enough)

2. Ensure that you have the Firebase package configured and setup in your project. More info can be found [here](/readme/features/remote-configs/firebase.md).

3. "Firebase" must be selected for the `Adapter` option in the "Remote Configs" settings. You can access this via the LionStudios/Settings Manager menu. \ <br>

   <figure><img src="/files/rRAWQmJybtcxX0LWlyZg" alt=""><figcaption></figcaption></figure>

4. **LionSDK will automatically fire the `ab_cohort` event to LionAnalytics** if you follow the steps below:
   1. Every experiment needs a unique name to track which variant the player has been assigned for that experiment. LionSDK will automatically check for a parameter with the following naming convention and use that to fire the **required** `ab_cohort` event for you.
      \*

      ```
      ![](/files/sUkVaN49DUGMOf439MZX)
      ```

      * “`exp_[FULL EXPERIMENT NAME]`" (replace `[FULL EXPERIMENT NAME]` with your unique name). Make sure to use the experiment naming convention described [here](/readme/analytics/a-b-testing.md#experiment-naming-convention) for your `Full EXPERIMENT NAME` . Take a look at our example setup below for more details.

<figure><img src="/files/sS6ocXCJfMbKKqUPWO92" alt="" width="563"><figcaption></figcaption></figure>

{% hint style="warning" %}
Make sure the exp\_\[FULL EXPERIMENT NAME] is removed once the experiment is not running, concluded or deleted. If this parameter needs to be kept, then make sure to set its default value to just null or empty.
{% endhint %}

***

## Example Experiment (AB Test) Use Case

### Firebase Remote Config Experiment (AB Test) Example

1. Let's say the product team wants to run an experiment using Firebase Remote Config to optimise the level at which interstitial ads start showing in the game. The Product team wants to run an experiment using Firebase Remote Config on the game named: `King Wing` (3 letter code: `kwi`) to evaluate the impact of different interstitial ad timings. The platform is Android (3-letter code: `and)`. So the full experiment becomes `kwi_and_NewInterTimer`, with the following variants and configurations:<br>

   | Variants   | inter\_between\_time | inter\_start\_time |
   | ---------- | -------------------- | ------------------ |
   | control    | 90                   | 90                 |
   | aggressive | 60                   | 60                 |
   | passive    | 120                  | 120                |

2. Each variant/cohort of the experiment will receive a different value for the `inter_between_time` and the `inter_start_time` parameter, allowing the team to treat users differently by assigning them different values.

3. There will be 3 experiment variants: `“control”` , `“aggressive”`, and `passive`.

4. Users will be equally distributed among the experiment variants.

### Firebase Remote Config Setup

1. In the Firebase dashboard, go to Remote Config/Parameters and click `Add parameter` . Add 3 new parameters called `inter_between_time` , `inter_start_time` , and `exp_kwi_and_NewInterTimer`. These 3 parameters will be used in our experiment setup. A button to publish your new changes will appear, and select "Publish changes".&#x20;

   1. The `exp_kwi_and_NewInterTimer` The parameter serves as an internal identifier to track which cohort variant a player belongs to. This parameter will be set to one of three values: control, aggressive, or passive. Keep the default value clear.\
      \ <img src="/files/uTtlERLtN4oPGKkIqzYv" alt="" data-size="original">      ![](/files/l1XtcLF4JmtZh1NhgnC4)   &#x20;

   &#x20;     ![](/files/VUJafB7E6cUhkehKKx6M)<br>

2. In the Firebase dashboard, go to Remote Config/AB Tests tab and click `Create Remote Config experiment`. Create an experiment  `kwi_and_NewInterTimer` in the Firebase Console. This experiment will be run on a game called `King Wing` (3 letter code kwi), for Android platforms. \
   Note: **You must use your own game code, platform and experiment name.**<br>

   <figure><img src="/files/HHnBtcg7vAYadSol3Zth" alt="" width="563"><figcaption></figcaption></figure>

3. Next, setup your Targeting. You can select which platform (Android or iOS) you want your experiment to run on, as well as what percentage of your player base will be tested. \
   **Note:** You must setup the same experiment separately for both iOS and Android. In our case, we will be using Android.<br>

   <figure><img src="/files/xIoeVdIfmcmiAdDCg3pU" alt="" width="563"><figcaption></figcaption></figure>

4. Setup the "Goals" section.

5. Setup the variants for this experiment. &#x20;
   * Looking back at our initial [guideline here](#firebase-remote-config-experiment-ab-test-example), we want to have 3 groups. The `control`, `aggressive` and `passive`.
   * Each group will have different values for the 3 new parameters (`inter_between_time` , `inter_start_time,` and `exp_kwi_and_NewInterTimer`) we created in Step 1.
   * Create 3 variants and set the values for each of the parameters.&#x20;
   * Make sure to name the `exp_kwi_and_NewInterTimer` parameter to match the group it belongs to. <br>

     ![](/files/sUkVaN49DUGMOf439MZX)

6. Click "Review", and now you can start the experiment when you are ready.
   * Go to `A/B Testing` → `Start Experiment`

7. Once the experiment has concluded, you can apply the best-performing variant as the default value for all users.

{% hint style="info" %}
Once the experiment is finished and not used anymore, you can also remove the remote configs which start with "exp\_" for that specific experiment to keep the list of all remote configs clean in Firebase.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://lionstudios.gitbook.io/readme/features/remote-configs/firebase/ab-experiments-firebase.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
