Resource Event - GameAnalytics/GA-SDK-C-SHARP GitHub Wiki
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.
:information_source:
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.AddResourceEvent(EGAResourceFlowType.Source, "Gems", 400, "IAP", "Coins400");
sink (subtract) Gem currency to buy an item.
GameAnalytics.AddResourceEvent(EGAResourceFlowType.Sink, "Gems", 400, "Weapons", "SwordOfFire");
sink (subtract) Gem currency to source (buy) some amount of another virtual currency (BeamBooster).
GameAnalytics.AddResourceEvent(EGAResourceFlowType.Sink, "Gems", 100, "Boosters", "BeamBooster5Pack");
GameAnalytics.AddResourceEvent(EGAResourceFlowType.Source, "BeamBooster", 5, "Gems", "BeamBooster5Pack");
sink (subtract) 3 BeamBooster currency that were used during a level.
GameAnalytics.AddResourceEvent(EGAResourceFlowType.Sink, "BeamBooster", 3, "Gameplay", "BeamBooster5Pack");
Field | Type | Description | Example |
---|---|---|---|
flowType | enum | A defined enum for sourcing and sinking resources. | 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 |
:warning:
Be careful to not call the resource event too often ! In a game where the user collects 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 completes or fails the level.
:information_source:
For more information on the resource event go here.