Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Resource Event

Martin Treacy-Schwartz edited this page Mar 15, 2017 · 2 revisions

Resource events are used to register the flow of your in-game economy (virtual currencies) - the sink (subtract) and the source (add) for each virtual currency.

ℹ️
Before calling the resource event it is needed to specify what discrete values can be used for currencies and item types in the Configuration phase.

source (add) Gem currency from an in-app purchase.

gameanalytics::GameAnalytics::addResourceEvent(gameanalytics::EGAResourceFlowType::Source, "Gems", 400, "IAP", "Coins400");

 

sink (subtract) Gem currency to buy an item.

gameanalytics::GameAnalytics::addResourceEvent(gameanalytics::EGAResourceFlowType::Sink, "Gems", 400, "Weapons", "SwordOfFire");

 

sink (subtract) Gem currency to source (buy) some amount of another virtual currency (BeamBooster).

gameanalytics::GameAnalytics::addResourceEvent(gameanalytics::EGAResourceFlowType::Sink, "Gems", 100, "Boosters", "BeamBooster5Pack");

gameanalytics::GameAnalytics::addResourceEvent(gameanalytics::EGAResourceFlowType::Source, "BeamBooster", 5, "Gems", "BeamBooster5Pack");

 

sink (subtract) 3 BeamBooster currency that were used during a level.

gameanalytics::GameAnalytics::addResourceEvent(gameanalytics::EGAResourceFlowType::Sink, "BeamBooster", 3, "Gameplay", "BeamBooster5Pack");

 

Field Type Description Example
flowType enum A defined enum for sourcing and sinking resources. gameanalytics::EGAResourceFlowType::Sink
currency string The resource type/currency to track. Has to be one of the configured available resource currencies.
This string can only contain [A-Za-z] characters.
Gems, BeamBoosters, Coins
amount float Amount sourced or sinked. 0 or negative numbers are not allowed. 100.0
itemType string For sink events it can describe an item category you are buying (Weapons) or a place (Gameplay) the currency was consumed. For source events it can describe how the currency was gained. For example "IAP" (for in-app purchase) or from using another currency (Gems). Has to be one of the configured available itemTypes. Weapons, IAP, Gameplay, Boosters
itemId string For sink events it can describe the specific item (SwordOfFire) gained. If consumed during Gameplay you can simply use "Consumed". For source events it describes how the player got the added currency. This could be buying a pack (BoosterPack5) or earned through Gameplay when completing a level (LevelEnd). BoosterPack5, SwordOfFire, LevelEnd, Coins400

 

⚠️
Be carefull to not call the resource event too often !

In a game where the user collect coins fairly fast you should not call a Source event on each pickup. Instead you should count the coins and send a single Source event when the user either complete or fail the level.

 

ℹ️
For more information on the resource event go here.

 

NEXT  →

Clone this wiki locally