Trigger API Reference\DCEI Functions\Event
Used for live game analytics.
Notes: there are some restrictions on event names, parameter names, and values:
- Event and parameter names must be between 2 and 40 characters,
- Event and parameter names must consist of alphanumeric characters, underscores (_), or spaces,
- Parameter value must be less than 100 characters.
void Event.Log(string key, object table)
void Event.Log(string key, object table)
Description
Parameters
- string
key
the key for the event. - object
table
a table with the event data.
Example Usage
local key = "Stats"
local table = {
health = DCEI.GetHealth(unit),
shield = DCEI.GetShield(unit),
mana = DCEI.GetMana(unit)
}
DCEI.Event.Log(key, table)
void Event.SetUserProperty(string key, object value)
void Event.SetUserProperty(string key, object value)
Description
Parameters
- string
key
the key for the user property. - object
value
the value for the user property.
Example Usage
local key = "level"
local value = 10
DCEI.Event.SetUserProperty(key, value)
void Event.SetGameState(string state)
void Event.SetGameState(string state)
Description
Sets the user's game state. Useful for doing things like tracking the amount of time users spend in a particular game mode or game state, to gather relevant data and make charts on Amplitude.
Parameters
- string
state
the string to set the state to.
Example Usage
function Log.State:Set(name)
local state_id = STATE[name]
Core.Assert(state_id, "Invalid state name " .. tostring(name))
DCEI.Event.SetGameState(state_id)
-- DEBUG
if Debug:IsPrintingEventState() then
DCEI.LogWarning("> LOGGING STATE [" .. state_id .. "]")
end
end