Module: analytics
Table of contents
Functions
- logGameChoice
- logLevelEnd
- logLevelStart
- logLevelUp
- logPurchase
- logPurchaseSubscription
- logScore
- logSocialInvite
- logSocialShare
- 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
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 | 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
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
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
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
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
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
Parameters
Name | Type | Description |
---|---|---|
placement |
string |
Placement of the invite. |
Returns
void
logSocialShare
▸ logSocialShare(placement
): void
Logs the player's social share.
Example
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
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