A/B Testing
The A/B Testing module allows you to manage feature flags and experiment values remotely.
Configuration is done via the Settings Inspector in Unity.
Configuration is applied automatically at build time for each platform.
Platform markersโ
The following markers are used to indicate platform availability of parameters and features:
- (no marker) โ Shared parameter or feature
- ๐ โ iOS-specific parameter or feature
- ๐ค โ Android-specific parameter or feature
- โ ๏ธ โ Not implemented in the Unity plugin yet
Ask your release manager for the required parameters before configuring the SDK.
Configureโ
Configuration is done via the Settings Inspector.
Settings Inspectorโ
| Field | Description |
|---|---|
| A/B Testing Enabled | Enables/disables A/B testing functionality |
| A/B Default Values | JSON string containing default A/B parameter values |
| Firebase A/B Enabled ๐ค | Enables Firebase Remote Configโbased A/B testing |
| Firebase Fetch Interval ๐ค | Minimum interval (in seconds) between Firebase config fetches |
A/B Default Values are used when remote values are unavailable or before the first fetch.
Usageโ
A/B Testing values are loaded automatically during SDK initialization.
You can request values at any time after initialization.
Get String Valueโ
string value = P101XP.GetInstance().GetABTestingValue("test_key", "default_value");
Get Boolean Valueโ
bool enabled = P101XP.GetInstance().GetABTestingBool("feature_enabled", false);
Get Integer Valueโ
int count = P101XP.GetInstance().GetABTestingInt("max_lives", 3);
Get Float / Double Valueโ
float multiplier = P101XP.GetInstance().GetABTestingFloat("reward_multiplier", 1.0f);
Refresh A/B Values ๐คโ
On Android, values can be fetched from Firebase Remote Config manually if needed:
P101XP.GetInstance().FetchABTestingValues();
Values are cached according to Firebase Fetch Interval ๐ค.
Automatic Behaviorโ
A/B values are cached locally
Default values are returned if:
- Remote config is unavailable
- Fetch has not completed yet
- A/B testing is disabled
Values may differ per user depending on experiment assignment
Naming Rulesโ
- Keys are case-sensitive
- Use snake_case for keys
- Keys must be agreed upon with backend / analytics teams
Exampleโ
if (P101XP.GetInstance().GetABTestingBool("new_shop_ui", false))
{
ShowNewShop();
}
else
{
ShowOldShop();
}
Notesโ
- A/B Testing works independently from Analytics but integrates automatically when enabled
- Changing default values requires rebuilding the application
- Remote changes do not require app updates
Troubleshootingโ
If A/B values are not updating:
- Verify A/B Testing Enabled is ON
- On Android: verify Firebase A/B Enabled ๐ค
- Check Firebase Fetch Interval ๐ค
- Confirm keys exist in the remote configuration
- Ensure default values are valid JSON