Impression level revenue integration

Before you start

Make sure you have correctly integrated the ironSource SDK 7.0.3+ into your application, as outlined here.
Learn more about the impression level revenue (ILR) via SDK feature and pre-requisites.

Implement the ImpressionData Listener

The ironSource SDK fires postbacks to inform you about the displayed ad. The ImpressionData listener is an optional listener that you can implement to receive impression data. This listener will provide you with information about all ad units, and you’ll be able to identify the different ads using the impression level revenue.

If you want to add the ImpressionData listener to your application, make sure you declare the listener before initializing the ironSource SDK, to avoid any loss of information.

public static void addImpressionDataListener(ImpressionDataListener listener)

The ironSource SDK will notify your listener of the success post-backs, related to impression data:

public static void addImpressionDataListener(ImpressionDataListener listener){
 
   /**
   Invoked when the ad was displayed successfully and the impression data was recorded 
   **/
  
}

Remove Impression Data Listener

If you want to remove the ImpressionData listener from your application, you can do it using the removeImpressionData API:

public static void removeImpressionDataListener(ImpressionDataListener listener);

As of ironSource SDK Release 7.1.0 setImpressionDataListener was deprecated and replaced with addImpressionDataListener. 

Integrate the ILR data

Once you implement the ImpressionDataListener, you’ll be able to use the impression data and to send it to your own proprietary BI tools and DWH, or to integrate it with 3rd party tools.

Important! The returned data might include null values. Make sure to add protections before assigning the data, to avoid potential crashes.

To make it easy to use, you can refer to each field separately, or get all information using the allData method:

public void onImpressionSuccess (ImpressionData impressionData)
{
  Double  revenue = impressionData.getRevenue();
  String  adNetwork = impressionData.getAdNetwork();
  JSONObject allData =  impressionData.getAllData(); 
}

Check out the full list of available ILR data, including field description and types, here.

The example below shows how to integrate the Impression Level Revenue SDK API data with Google Analytics for Firebase. You can use it as is, or make any required changes, in order to integrate with 3rd party reporting tools or your own proprietary optimization tools and databases.

/** 
Invoked when the ad was displayed successfully and the impression data was recorded 
**/ 
@Override 
public void onImpressionSuccess(ImpressionData impressionData) { 
 // The onImpressionSuccess will be reported when the rewarded video and interstitial ad is opened. 
 // For banners, the impression is reported on load success.  Log.d(TAG, "onImpressionSuccess" + impressionData); 
   if (impressionData != null) 
   { 
       Bundle bundle = new Bundle(); 
       bundle.putString(FirebaseAnalytics.Param.AD_PLATFORM, "ironSource");  
       bundle.putString(FirebaseAnalytics.Param.AD_SOURCE,impressionData.adNetwork());  
       bundle.putString(FirebaseAnalytics.Param.AD_FORMAT, impressionData.getAdUnit());   
       bundle.putString(FirebaseAnalytics.Param.AD_UNIT_NAME, impressionData.getInstanceName());
       bundle.putString(FirebaseAnalytics.Param.CURRENCY, "USD");  
       bundle.putDouble(FirebaseAnalytics.Param.VALUE, impressionData.getRevenue());  
       
       mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.AD_IMPRESSION, bundle);  
   
   } 
}

Important! Make sure that the inside parameters aren’t null.