Documentation

Support

LevelPlay SDK - Unity

Impression-level revenue integration for Unity

Utilize ironSource's Impression Level Revenue (ILR) solution to track ad revenue at both device and impression levels, integrating with third-party analytics tools for deeper insights.
Read time 1 minuteLast updated 3 days ago

Prerequisites

Make sure you have correctly integrated the LevelPlay 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 LevelPlay 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 LevelPlay SDK, to avoid any loss of information. The LevelPlay SDK will trigger a callback on a background thread to notify your listener of successful impression data post-backs:
// This event is triggered on a background thread, not the Unity main thread.IronSourceEvents.onImpressionDataReadyEvent += ImpressionDataReadyEvent;private void ImpressionDataReadyEvent(IronSourceImpressionData impressionData){}

Integrate the ILR data

After 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 third-party tools.
Important
The returned data might include null values. To avoid potential crashes, ensure that you add protections before assigning the data.
To make it easy to use, you can refer to each field separately, or get all information using the allData method:
private void ImpressionDataReadyEvent(IronSourceImpressionData impressionData){ string allData = impressionData.allData; string adNetwork = impressionData.adNetwork; double? revenue = impressionData.revenue;}
Refer to the full list of available ILR data, including field description and types, here. The following example details 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 third-party reporting tools or your own proprietary optimization tools and databases.
private void ImpressionDataReadyEvent(IronSourceImpressionData impressionData) { Debug.Log("unity-script: ImpressionDataReadyEvent 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.adUnit), new Firebase.Analytics.Parameter("ad_format", impressionData.instanceName), new Firebase.Analytics.Parameter("currency", "USD"), new Firebase.Analytics.Parameter("value", impressionData.revenue.Value) }; Firebase.Analytics.FirebaseAnalytics.LogEvent("custom_ad_impression", AdParameters); }}
Important
Ensure that the inside parameters aren't null.