Module: analytics
Table of contents
Functions
- logGameChoice
- logGameEnd
- logGameStart
- logLevelEnd
- logLevelStart
- logLevelUp
- logScore
- logTutorialEnd
- logTutorialStart
Functions
logGameChoice
▸ logGameChoice(decision
, choice
): void
Logs a choice the player made in the game. This can be a powerful tool for balancing the game and understanding what content the players are interacting with the most.
Example
Parameters
Name | Type | Description |
---|---|---|
decision |
string |
Decision the player was faced with. |
choice |
string |
Choice the player made. |
Returns
void
Throws
INVALID_PARAM
logGameEnd
▸ logGameEnd(): void
Logs the end of the game. This is called automatically when the document state changes to hidden so there is no need to call this in the game.
Returns
void
logGameStart
▸ logGameStart(): void
Logs the start of the game. This is called automatically when the SDK is initialized so there is no need to call this in the game.
Returns
void
logLevelEnd
▸ logLevelEnd(level
, score
, wasCompleted
): void
Logs the end of a level. To ensure the level timer is recorded the level name must match the name passed into the previous logLevelStart call. If it does not match then the timer will be logged at 0.
Example
Parameters
Name | Type | Description |
---|---|---|
level |
string |
Name of the level. |
score |
string |
Score the player achieved. |
wasCompleted |
boolean |
Was the level completed or not. |
Returns
void
Throws
INVALID_PARAM
logLevelStart
▸ logLevelStart(level
): void
Logs the start of a level.
Example
Parameters
Name | Type | Description |
---|---|---|
level |
string |
Name of the level. |
Returns
void
Throws
INVALID_PARAM
logLevelUp
▸ logLevelUp(level
): void
Logs the player achieving a new level.
Example
Parameters
Name | Type | Description |
---|---|---|
level |
string |
Level the player achieved. |
Returns
void
Throws
INVALID_PARAM
logScore
▸ logScore(score
): void
Logs the player's score.
Example
Parameters
Name | Type | Description |
---|---|---|
score |
string |
Score the player achieved. |
Returns
void
Throws
INVALID_PARAM
logTutorialEnd
▸ logTutorialEnd(tutorial
, wasCompleted
): void
Logs the end of a tutorial. To ensure the level timer is recorded the tutorial name must match the name passed into the previous logTutorialStart call. If it does not match then the timer will be logged at 0.
Example
Parameters
Name | Type | Description |
---|---|---|
tutorial |
string |
Name of the tutorial. |
wasCompleted |
boolean |
Was the tutorial completed. |
Returns
void
logTutorialStart
▸ logTutorialStart(tutorial
): void
Logs the start of a tutorial.
Example
Parameters
Name | Type | Description |
---|---|---|
tutorial |
string |
Name of the tutorial. |
Returns
void