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.

The ironSource SDK will notify your listener of the success post-backs, related to impression data. The onImpressionSuccess is described below:

IronSourceEvents.onImpressionSuccessEvent += ImpressionSuccessEvent;
private void ImpressionSuccessEvent(IronSourceImpressionData impressionData){}

To make sure you also receive notifications when an ad is displayed (for both Android and iOS apps), use the onImpressionDataReadyEvent callback. Because the callback might be sent while your app is in the background, you should add protections to support all relevant actions in the background. Once you’ve started using this callback, remove your onImpressionSuccess to avoid duplication.

IronSourceEvents.onImpressionDataReadyEvent += ImpressionDataReadyEvent;
private void ImpressionDataReadyEvent(IronSourceImpressionData impressionData){}

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.

Note:  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:

private void ImpressionSuccessEvent(IronSourceImpressionData impressionData)
{
	string allData = impressionData.allData;
	string adNetwork = impressionData.adNetwork;
	double? revenue = obj.revenue;
}

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.

private void ImpressionSuccessEvent(IronSourceImpressionData impressionData) {
	Debug.Log ("unity-script:  ImpressionSuccessEvent impressionData = " + impressionData);
	if (impressionData != null) {
		Firebase.Analytics.Parameter[] AdParameters = {
 			new Firebase.Analytics.Parameter("ad_platform", "ironSource"),
  			new Firebase.Analytics.Parameter("ad_source", impressionData.adNetwork),
  			new Firebase.Analytics.Parameter("ad_unit_name", impressionData.getAdUnit),
			new Firebase.Analytics.Parameter("ad_format", impressionData.getInstanceName),
  			new Firebase.Analytics.Parameter("currency","USD"),
  			new Firebase.Analytics.Parameter("value".getRevenue)
		};
		Firebase.Analytics.FirebaseAnalytics.LogEvent("ad_impression", AdParameters);
	}
}