Impression level revenue integration for Xamarin iOS

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.

IronSource.addImpressionDataDelegate(mImpressionDataDelegate);

Remove Impression Data Listener

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

IronSource.removeImpressionDataDelegate(mImpressionDataDelegate);

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.

We suggest the following implementation:

  1. Create a class which inherits from ISImpressionDataDelegate. We recommend to create a separate class for each delegate
    public class ImpressionDataDelegate : ISImpressionDataDelegate
        {
            readonly UIViewController parent;
            public ImpressionDataDelegate(UIViewController parent)
            {
                this.parent = parent;
            }
            public override void ImpressionDataDidSucceed(ISImpressionData impressionData)
            {
                NSDictionary allData = impressionData.All_data;
                int revenue = impressionData.Revenue;
                string adNetwork = impressionData.Ad_network;
            }
        }
    

  2. Create and instantiate a ImpressionDataDelegate object. Set the delegate using the new object, and start listening to the Impression Data
    ImpressionDataDelegate mImpressionDataDelegate;
    mImpressionDataDelegate = new ImpressionDataDelegate(this);
    //Add impression data delegate       
    IronSource.addImpressionDataDelegate(mImpressionDataDelegate);
    

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