Skip to main content

Game Ops

Remote Configs

You can register a callback to be notified when the RemoteConfigs have been updated with values from the server using the function below:

var myRemoteConfigsListener = {
onRemoteConfigsUpdated: function () {
// add your code here
},
};

GameAnlytics.addRemoteConfigsListener(myRemoteConfigsListener);

Or you can also manually check if the RemoteConfigs are ready (have been populated):

if (GameAnalytics.IsRemoteConfigsReady()) {
// the command center is ready, add your code here
}

Once the RemoteConfigs have been updated you can retrieve values by using the following function:

// A/B testing id
GameAnalytics.getABTestingId((result) => {
console.log("ABTestingId=" + result);
});

// A/B testing variant id
GameAnalytics.getABTestingVariantId((result) => {
console.log("ABTestingVariantId=" + result);
});
info

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

Custom Dimensions

GameAnalytics supports up to 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.

tip

Setting each custom dimension. To reset a set custom dimension simply just set it to empty string.

// sets valid custom dimensions
GameAnalytics.setCustomDimension01("ninja");
GameAnalytics.setCustomDimension02("dolphin");
GameAnalytics.setCustomDimension03("horde");

// clear a custom dimension
GameAnalytics.setCustomDimension03("");
tip

Read more about custom dimensions here.

Custom Event Fields

During the game it is possible to set global custom event fields which you can change at any time. Custom event fields is basically a set of key-value pairs you can add to all your events.

info

It is important to know that the custom event fields will not be visible in the GameAnalytics tool as it is only accessible through raw export.

caution

There is a limit of using 50 custom event fields per event, keys can max consist of 64 characters and values (when strings) can max consist of 256 characters.

Custom event fields can only be used together with raw event export and which they will not visible in the tool. It is also possible to overwrite the global custom event fields by using the optional custom event fields parameter for when sending individual events, please refer to the events documentation page for usage. If you want to merge the specified custom fields from the event method parameter with the global custom event fields set the optional mergeFields event method parameter to true.

Setting global custom event fields:

var fields = {
test: 100,
test_2: "hello_world",
};

GameAnalytics.setGlobalCustomEventFields(fields);
FieldTypeDescriptionExample
customFieldsdictionaryA set of key-value pairs. Values can be strings or numbers{
"test": 100,
"tests": "hello_world"
}
tip

Read more about custom dimensions here.