Skip to main content

GameOps

Remote configs

Register to events for whenever the Remote Configs is updated with new values:

local function my_remote_configs_listener(self)
-- add your code here
end

gameanalytics.setRemoteConfigsListener(my_remote_configs_listener)

Remember if you sets the remote configs listener you will probably want to use manual intialization to get the first update of remote configs. You need to add this to the game.project file:

[gameanalytics]
manual_initialize = 1

After that call this to initialize the SDK (probably same place where you will set the listener):

gameanalytics.initialize()

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

if gameanalytics.isRemoteConfigsReady() then
-- the remote configs is ready, add your code here
end

Remember the remote configs can be populated with an empty dictionary if the device is offline and there are no cached remote configs from a previous session.

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

-- Without custom default value (using normal default value)
local value = gameanalytics.getRemoteConfigsValueAsString {
key = "key"
}
-- With custom default value
local valueWithCustomDefaultValue = gameanalytics.getRemoteConfigsValueAsString {
key = "key",
defaultValue = "myDefaultValue"
}
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 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. To reset a set custom dimension simply just set it to empty string


gameanalytics.setCustomDimension01("ninja")
gameanalytics.setCustomDimension02("dolphin")
gameanalytics.setCustomDimension03("horde")

-- reset custom dimension 3
gameanalytics.setCustomDimension03("")