Skip to main content

Game Ops

Remote Configs

GameAnalytics offers the option to setup remote configs in your dashboard that can be changed on the whim without needing to release a new version of the game. The remote configs are a custom set of key-pair values.

public class MainActivity extends Activity implements IRemoteConfigsListener
{
public void onRemoteConfigsUpdated()
{
// add your code here
}

protected void onCreate(Bundle savedInstanceState)
{
GameAnalytics.addRemoteConfigsListener(this);
}
}

To manual check if Remote Configs is ready (has been populated with values) you can call this:

if(GameAnalytics.isRemoteConfigsReady())
{
// the remote configs is ready, add your code here
}

To get values out of a populated Remote Configs use the following methods:

// Without custom default value (using normal default value)
String value = GameAnalytics.getRemoteConfigsValueAsString("key");
// With custom default value
String valueWithCustomDefaultValue = GameAnalytics.getRemoteConfigsValueAsString("key", "myDefaultValue");

If the specified key is not found in the Remote Configs it will return the default value either “normal” or “custom” default value.

A/B Testing

To get the value of A/B testing id or variant id use the following methods:

// A/B testing id
String abTestingId = GameAnalytics.getABTestingId();

// A/B testing variant id
String abTestingVariantId = GameAnalytics.getABTestingVariantId();

Custom Dimensions

GameAnalytics support the use of 3 custom dimensions:

  • Custom01
  • Custom02
  • Custom03

During the game it is possible to set the active value for each custom dimension dynamically. Once a dimension is set it will be persisted across sessions/game-start and automatically be added to all event categories. Remember you have to set the custom dimensions before initialzing the SDK (but after setting the available custom dimensions) to be able to add the dimensions to the first session start event.

Setting each custom dimension:

GameAnalytics.setCustomDimension01("ninja");
GameAnalytics.setCustomDimension02("dolphin");
GameAnalytics.setCustomDimension03("horde");

To reset a set custom dimension simply set it to empty string or null:

GameAnalytics.setCustomDimension01("");
GameAnalytics.setCustomDimension02(null);
GameAnalytics.setCustomDimension03("");
FieldTypeDescriptionExample
customDimensionstringOne of the available dimension values set in the configuration phase. Will persist cross session. Set to null to reset.ninja
tip

Read more about Custom Dimensions here.

Error Reporting

By default the SDK will automatically send error events for uncaught exceptions. This can be disabled by calling this before the SDK has been initialized:

GameAnalytics.setEnabledErrorReporting(false);

If you are using other crash/error reporting services like for example Crashlytics together GameAnalytics’ automatic error reporting it can in some cases give problems but the SDK makes sure to call any error handlers set prior to GameAnalytics error handler.