Skip to content

Module: analytics

Table of contents

Functions

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

Wortal.analytics.logGameChoice('Character', 'Blue');

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

Wortal.analytics.logLevelEnd('Level 3', '100', true);

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

Wortal.analytics.logLevelStart('Level 3');

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

Wortal.analytics.logLevelUp('Level 7');

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

Wortal.analytics.logScore('100');

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

Wortal.analytics.logTutorialEnd('First Play', true);

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

Wortal.analytics.logTutorialStart('First Play');

Parameters

Name Type Description
tutorial string Name of the tutorial.

Returns

void