SDK Module: Analytics

The analytics module is responsible for sending analytics events to the intended services. It abstracts calls to the analytics service APIs.
It works in sync with various modules of the SDK.
By default, this module tracks some predefined events. This module automatically tracks ad events coming from the Ad Management Module, game events dispatched through Game Event Management Module, and UI events coming from the UI Management Module.

Ad related events are completely automated when you use Ad Manager to show your ads.

UI Events are partially automated. If you have created your UI system using Coda SDK's UI module, then those events are also handled. In the case you have a custom UI system, you have to send the following UI events where applicable:

// This should be dispatched when sound setting is toggled.
// isOn should be "true" or "false" depending on the toggle.
// 0 is for "disabled" and 1 is for "enabled" state.
CodaGameManager.Instance.UIManager.DispatchUIEvent(Common.Interfaces.UIEventType.OnSoundButtonClicked, new string[] { isOn });
// Similar to the sound event. This is used when vibration setting
// toggle is invoked.
CodaGameManager.Instance.UIManager.DispatchUIEvent(Coda.Common.Interfaces.UIEventType.OnVibrationButtonClicked, new string[] { isOn });

There are two events that need to be called, once a level is started and once failed or passed. You have to use them in the proper places in your game logic.

// This event should be sent whenever a new level is started by the
// user.
// currentLevel is the level user is on.
(currentLevel, playerCoins)
// This is to be sent after a user has completed a level.
// levelSuccess is boolean, if a user has successfully completed a level. It should be true when level is successfully completed, false if the level is failed.
// currentLevel is the level user is on.
//levelProgressRatio is a float between 0 and 1, should be used to define how much the player has progressed in the current level. It can be left empty if a level is successfully completed thus will have a default value of 1.
(levelSuccess, currentLevel, playerCoins, levelProgressRatio)

Custom Events are used for game specific analytics events. It requires an array of strings which it uses to decide the id of the event and its parameters.

// Custom events can be used for any analytics events that are not
// predefined. You can define the event's id/key and the custom parameters
// that it sends to the analytics services.
// id is the key or name of the event.
// param - val pairs are respectively names and the values for each
// parameter.
// You can have as many as you want, but usually services do not accept
// more than 7 or 10 parameters for each event.
// An event with no parameters also is an option. Just including the id in
// the string array will send a parameterless event.
CodaGameManager.Instance.GameEventManager.IntegrationEvents.NewTrackingEvent(eventID, param1, value1, param2, value2,...)

Did this page help you?