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

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 | number Name of the level.
score string | number 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 | number 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 | number Level the player achieved.

Returns

void

Throws

  • INVALID_PARAM

logPurchase

logPurchase(productID, details?): void

Logs the player's purchase of an in-app product.

Example

Wortal.analytics.logPurchase('game.gems.100', '100 gems from shop sale');

Parameters

Name Type Description
productID string ID of the product the player purchased.
details? string Additional details about the purchase.

Returns

void

Throws

  • INVALID_PARAM

logPurchaseSubscription

logPurchaseSubscription(productID, details?): void

Logs the player's purchase of an in-app subscription.

Example

Wortal.analytics.logPurchaseSubscription('game.seasonpass', 'Season pass from level up reward UI');

Parameters

Name Type Description
productID string ID of the subscription product the player purchased.
details? string Additional details about the purchase.

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 | number Score the player achieved.

Returns

void

Throws

  • INVALID_PARAM

logSocialInvite

logSocialInvite(placement): void

Logs the player's social invite.

Example

Wortal.analytics.logSocialInvite('Leaderboard View');

Parameters

Name Type Description
placement string Placement of the invite.

Returns

void


logSocialShare

logSocialShare(placement): void

Logs the player's social share.

Example

Wortal.analytics.logSocialShare('Game Over UI');

Parameters

Name Type Description
placement string Placement of the share.

Returns

void


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