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

import java.util.ArrayList;
// The resources settings API
IronSourceAnalytics.setAppResources(ISAnalyticsResourceType resourceType, List<String> values);
Note: In order to use this API make sure you added “java.util.ArrayList” library to your code 


  • 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.)
  • List<String> resources – a list of the available resources (string values). All values shall be alphabetically, and limited to 20 characters each

Note: All parameters are mandatory 

Example of resources settings API

import java.util.ArrayList;
// Example of resources settings prior to sdk initialization
// Add all application resources and currencies
List<String> appCurrencies = new ArrayList<>();
IronSourceAnalytics.setAppResources(ISAnalyticsResourceType.CURRENCIES, appCurrencies);
// Add all activities where it is possible to spend or gain app resources
List<String> userActionsList = new ArrayList<>();
IronSourceAnalytics.setAppResources(ISAnalyticsResourceType.USERACTIONS, userActionsList);
// Add all places where users can spend or gain app resources
List<String> resourcesUpdatesPlacements = new ArrayList<>();
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)

// The resources settings API
IronSourceAnalytics.updateUserResources(@NonNull 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(@NonNull 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(@NonNull String placement) – 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(@NonNull String userAction) – 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
  • 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);