Skip to main content

Resource Events

Overview

Use this event to track when players gain (source) or lose (sink) resources like virtual currency and lives.

A “sink” is when a player loses or spends a resource. A “source” is when a player gains or earns a resource.

Example A: A player spends one life by starting a game.
Example B: A player buys a boost in the game with 100 gold currency.
Example C: A player earns a reward of 5 lives for watching an ad.
Example D: A player buys a pack of 100 gold currency as an in-app purchase for $0.99 from the store. (The event below is only for the addition of gold to the player’s balance.)

FieldExample AExample BExample CExample D
flowTypesinksinksourcesource
itemTypecontinuityboostrewardpurchase
itemIdstartGamerainbowBoostvideoAdgoldPack
amount11005100
resourceCurrencylifegoldlifegold
note

You will need to pre-define a list of currencies and itemTypes when you instrument your game. The max amounts of unique resourceCurrency, itemTypes and unique itemIds are 20 each.

Event Optimization

Resource events should be sent after gameplay is completed by a player, as opposed to every time the player’s balance goes up/down within a game.

For example:

Let's say your player gains coins for making matches in a game but loses them every time he hits an obstacle, you would wait until the end of the game to sum up how many coins they earned and lost. Ultimately, you would then send that as one event.

Implementation

The purpose of this article is to expose more examples of custom events in GameAnalytics and how they should be sent, from the planning phase up to aggregation and visualisation part in the tool. We illustrate the generation of these events with examples from our Unity SDK. The examples can be implemented in any other official GameAnalytics SDK by using the equivalent methods. Resource events are divided into two categories: sink and source.

For better understanding of how they can be used we propose a scenario for a game in which the source for resources are actual in-app purchases or looting while the spending of resources can be done either in the shop or during combat.

Resource Events Example

Code Example

Virtual currencies can be anything. In our case we choose gold and silver for in-game transactions and also we mark “grenade” as a currency for exposing the space of possibility in this feature.

Below is Example of code for creating a source and a sink event with “Grenade” as currency:

GameAnalytics.NewResourceEvent (GAResourceFlowType.Source, "Grenade", 2, "Looting", "BossKilled");

GameAnalytics.NewResourceEvent (GAResourceFlowType.Sink, "Grenade", 1, "Combat", "GrenadeThrow");
note

You need to make sure all currencies and item types are declared in the initialization phase. Read more in the dedicated technical documentation associated to the SDK you are using.

  • The tool will automatically generate dashboards for each detected currency to highlight the balance between the sink and the source mechanics in the game.
  • In the next representation we can view the “Grenade” resource dashboard for a date range composed by only one day.
  • Each aggregated resource event can also be visualised directly using the explore tool in the same manner as design and progression events.