Integration
Downloading latest SDK
Make sure you have your chosen SDK integrated and initialized, and you can see events in the web-tool.
You can see our available SDKs here.
Define Experiment Variable
Select the area to focus on testing:
Area | Variable example |
---|---|
Difficulty | Game_diff |
Price of an item | item_price |
Time interval between ads | 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.
The variable will be used when creating the experiment config key within GameAnalytics and when retrieving the config value using the SDK calls.
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.
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;
Functions
The following functions can be used to check if the remote configs are ready, and to get specific A/B config values:
These functions are for the Unity SDK only. Please visit our integration guides on information on each SDK.
Action | Call | Description | Returns | Example |
---|---|---|---|---|
Manual check | IsRemoteConfigsReady(); | Checks if the Remote Configs are ready and have been loaded with values. | Returns a boolean which is true if the Remote Configs are ready, false otherwise. | if(GameAnalytics.IsRemoteConfigsReady ()) { //Remote Configs ready add your code here } |
Get specific A/B testing value | GetRemoteConfigsValueAsString (string key) | Gets A/B Config value using specified key | Returns a string that specifies the A/B Config value at the specified key. This will always return null if it is called before Remote Configs is ready. | string value = GameAnalytics.GetRemoteConfigsValueAsString("ab_key") string value = GameAnalytics.GetRemoteConfigsValueAsString ("ab_key", "myDefaultValue"); |
Get All A/B Config Values | GetConfigurationsContentAsString() | Gets all available remote configs fetched from the server (including A/B configs values if any). | Returns a jSON string with all available configurations. | string json = GameAnalytics.GetConfigurationsContentAsString(); |