Docs > Tool Features > A/B Testing > A/B Testing – Integration

A/B Testing – Integration

#

Download Latest SDKs

Copy link to clipboard

All of our SDKs now support A/B Testing and Remote Configs.

Use the link below to download the and integrate our latest SDKs:

SDK Integration Guide

#

Define Experiment Variable

Copy link to clipboard

Select the area of your game that you want to a/b test.

Examples:

  • Difficulty
  • Price of an item
  • Time interval between ads

Then define with your game the variable that you want to a/b test. The maximum allowed length of the variable is 12 characters.

Example:

  • game_diff
  • item_price
  • ad_interval

This variable will be used when creating the experiment config key within GameAnalytics and when retrieving the config value using the SDK calls.

GameAnalytics will push to the player’s device, different values for this config depending on the key/value pairs that you define for the experiment.

For each variable, please ensure there is a default value that the game uses when no value is sent by GameAnalytics’ servers. Players who are allocated to the control group within an experiment will receive no value for the config key.

#

Add SDK Calls

Copy link to clipboard

Use the below SDK calls to retrieve the values for your a/b testing configs.

The below code examples are for Unity, however you can find corresponding documentation for other SDKs within the Remote Configs section of the SDK integration guide.

Register For Events

Register to events for whenever a/b configs are updated with new values:

private static void MyOnRemoteConfigsUpdateFunction() 
{ 
// add your code here 
} 
GameAnlytics.OnRemoteConfigsUpdatedEvent += MyOnRemoteConfigsUpdateFunction;

Manual Check

To manually check if a/b configs are ready (have been populated with values) you can call this:

Call: IsRemoteConfigsReady()
Description: Checks if Remote Configs are ready and have been loaded with values
Returns(bool): True if Remote Configs is ready (loaded with values) else false

Example:

if(GameAnalytics.IsRemoteConfigsReady ()) { //Remote Configs ready add your code here }

Get Specific A/B Config Values

To get values out of a populated a/b configs use the following methods:

Call: GetRemoteConfigsValueAsString (string key)
Description: Gets A/B Config value using the specified key.
Returns(string): A/B Config value at the specified key. This will always return null if it is called before Remote Configs is ready

Example:

string value = GameAnalytics.GetRemoteConfigsValueAsString ("ab_key")

Call: GetRemoteConfigsValueAsString (string key, string defaultValue)
Description: Gets A/B Config value using specified key.
Returns(string): A/B Config value at the specified key. If there is no value at the specified key the call will return the defaultValue. If it is called before Remote Configs is ready it will also return the defaultValue.

Example:

string value = GameAnalytics.GetRemoteConfigsValueAsString ("ab_key”, “myDefaultValue”);

If the specified key is not found in the a/b configs it will return the default value either “normal” or “custom” default value.

Get All A/B Config Values

Call: GetConfigurationsContentAsString()
Description: Gets all available remote configs fetched from the server (including A/B configs values if any)
Returns(string): json with all available configurations

Example:

string json = GameAnalytics.GetConfigurationsContentAsString ();
#

Create and Run A/B Tests

Copy link to clipboard

You are now ready to create and run a/b tests within GameAnalytics. For further information, please check out our guide here.

Contact support

Any queries about the platform are welcome.

Give article feedback

Let us know what you think about the articles.