Resources API

ironSource App Analytics provides analysis of the in-app economy – the resources actual usage by the – spent & received resources, of all kinds. Identify where the places the users spent the most or received the most. What action the users perform in order to spend or receive the resources (E.g. Watch an ad, pay to get hints or progress after failing a level and others). 

Analyzing the resources usage within the application rely on two phases:

  • Settings API (Pre-init)
  • Users’ activity API (Post-init)

Settings API (Pre-init)

Use this API, prior to SDK initialization, to update the resources settings available in your application.

Only settings declared prior to initialization are available for resource updates

// Application resources settings API
IronSourceAnalytics.setAppResources(ISAnalyticsResourceType resourceType, string[] values);


  • ISAnalyticsResourceType resourceType – An enumeration of the required resource list to update:
    • CURRENCIES – All the resources available in your application (Such as coins, diamonds, gems etc)
    • PLACEMENTS – All the places the user can gain or consume resources in your application (Such as coins, diamonds, gems etc)
    • USERACTIONS – The action the user did that affected their resources (Such as watching an ad, failing a level, replacing with other resources etc.)
  • string[] values -An array of the available resources (string values)

Note: All parameters are mandatory 

Example of resources settings API

// Example of application resources settings prior to sdk initialization
// Add all application resources and currencies
string[] appCurrencies = new string[2];
         appCurrencies[0] = "Coins";
         appCurrencies[1] = "Gems";
IronSourceAnalytics.setAppResources(ISAnalyticsResourceType.CURRENCIES, appCurrencies);
// Add all activities where it is possible to spend or gain app resources
string[] userActionsList = new string[3];
         userActionsList[0] = "purchased_in_shop";
         userActionsList[1] = "level_completed";
         userActionsList[2] = "watched_ad";
IronSourceAnalytics.setAppResources(ISAnalyticsResourceType.USERACTIONS, userActionsList);
// Add all places where users can spend or gain app resources
string[] resourcesUpdatesPlacements = new string[5];
         resourcesUpdatesPlacements[0] = "store";
         resourcesUpdatesPlacements[1] = "level_2_end";
         resourcesUpdatesPlacements[2] = "level_4_end";
         resourcesUpdatesPlacements[3] = "new_year_promo";
         resourcesUpdatesPlacements[4] = "first_rv_ad";
IronSourceAnalytics.setAppResources(ISAnalyticsResourceType.PLACEMENTS, resourcesUpdatesPlacements);

Resources usage API (Post-init)

Use this API, following the SDK initialization, to update the users’ usage of the resources (Using the resources, placements & actions that were set in the pre-init)

// Application resources settings API
IronSourceAnalytics.updateUserResources(ISAnalyticsResourceUpdate appResource);


  • ISAnalyticsResourceUpdate appResourceThe object that represents the resource update event

ISAnalyticsInAppPurchase Object

This object and it’s properties define all the required information regarding a resource update event


  • ISAnalyticsResourceUpdate(string currency) – The currency the user updated (Consumed or gained). Must be one of the resource currencies passed as part of the setAppResources SDK API, in CURRENCIES list

Set methods:

  • consumed(int amount) – Represents use of the resource to buy something in the amount (consumed/gained is mandatory)
  • gained(int amount) – Represents addition of resources to the user in the amount (consumed/gained is mandatory)
  • placement(string name) – The location within the application where the user performed the action that caused change in his resources. Must be one of the resource placements passed as part of the setAppResources SDK API, in PLACEMENTS list (mandatory)
  • userAction(string name) – The action done by the user that caused change in his resources. Must be one of the user actions passed as part of the setAppResources SDK API, in USERACTIONS list (mandatory)
  • balance(int amount) – The resource that was gained or consumed balance in the game (optional)

Example of resources update API

// Example of resource spent by user:
ISAnalyticsResourceUpdate coins1 = new ISAnalyticsResourceUpdate("Coins").consumed(30).placement("store").userAction("purchased_in_shop").balance(0);
// Example of resource received by user:
ISAnalyticsResourceUpdate coins2 = new ISAnalyticsResourceUpdate("Coins").gained(99).placement("level_2_end").userAction("level_completed").balance(99);