A/B Experiments API
Integrating experiments through the GamePush SDK. Methods of operation.
List of Methods
Properties:
gp.experiments.map- list of experiments. FREE
Checks:
gp.experiments.has()- check which cohort the player is currently in for an experiment. FREE
Recommendations for Working with Experiments
- Make changes to the game for side versions using the
gp.experiments.has()check. - Always have a default version (A) to roll back to if needed.
- In the default version (A), don't rely on the check, consider it the main version. Use overrides for other versions below or leave the A version as else.
- Calibrate the version through an A/A test. Create an experiment and assign percentages to cohorts, but don't make any changes to the game. Make sure the metrics between these two versions are the same, then you can run the test. If there is a significant difference in metrics between the versions, reassign players to cohorts by clicking the "Reshuffle" button.
Example using check:
- JavaScript
- Construct 3
- Unity
let difficulty = 'normal';
if (gp.experiments.has('EASY_LEVEL', 'easy')) {
difficulty = 'easy';
} else if (gp.experiments.has('EASY_LEVEL', 'extra_easy')) {
difficulty = 'extra_easy';
}
runLevel(difficulty);
→
System
On start of layoutAdd action
Add action
Add action
Add action
run level with difficulty
Add action
Legend
System
GamePush
Functions
System›Construct 3 System object
GamePush›GamePush plugin
Functions — Object Functions (Functions)
string difficulty = "normal";
if (GP_Experiments.Has("EASY_LEVEL", "easy"))
difficulty = "easy";
else if (GP_Experiments.Has("EASY_LEVEL", "extra_easy"))
difficulty = "extra_easy";
RunLevel(difficulty);
Example using cohort value:
- JavaScript
- Construct 3
- Unity
const difficulty = gp.experiments.map.EASY_LEVEL || 'normal';
runLevel(difficulty);
→
System
On start of layoutcohort from map; empty string if missing — fall back to normal
Add action
Add action
run level with difficulty
Add action
Legend
System
Functions
System›Construct 3 System object
Functions — Object Functions (Functions)
string difficulty = GP_Experiments.Get("EASY_LEVEL");
if (string.IsNullOrEmpty(difficulty))
difficulty = "normal";
RunLevel(difficulty);
Properties
List of Experiments
FREEYou have access to the full list of experiments with their assigned cohorts upon launching the game and loading the player in key-value format.
- JavaScript
- Construct 3
- Unity
gp.experiments.map;
→
System
On start of layoutcohort for experiment tag (empty if none)
Add action
Legend
System
Text
System›Construct 3 System object
Text — Object Text (Text)
GP_Experiments.Map();
Example structure:
{
EASY_LEVEL: 'easy',
OFFER_ON_START: 'sale_50',
NO_RESTART: 'no_button_after_2nd_death',
EXTRA_REWARD: ''
}
Example usage:
const difficult = gp.experiments.map.EASY_LEVEL || 'default';
Checks
Check Experiment Cohort
gp.experiments.has(tag, cohort) FREE
- JavaScript
- Construct 3
- Unity
// By Tag
const hasEasyLevel = gp.experiments.has('EASY_LEVEL', 'easy');
// Check
if (hasEasyLevel) {
// Cohort easy is active in the EASY_LEVEL experiment
}
cohort easy is active in the EASY_LEVEL experiment
Add action
Legend
GamePush
GamePush›GamePush plugin
// By Tag
bool hasEasyLevel = GP_Experiments.Has('EASY_LEVEL', 'easy');
// Check
if (hasEasyLevel) {
// Cohort easy is active in the EASY_LEVEL experiment
}
Stay in Touch
Other documents of this chapter available Here. To get started, welcome to the Tutorials chapter.
GamePush Community Telegram: @gs_community.
For your suggestions e-mail: official@gamepush.com
We Wish you Success!