Integrate Impression-Level Revenue Data

Use this document to start ingesting Impression-Level Revenue Data (ILRD).

Before you start this section:

  1. Make sure you are on MoPub SDK v5.7.0 or above.
  2. Read the article explaining Impression-Level Revenue Data (ILRD) to understand the flow of events that you will be implementing below.

Note Unity SDK < 5.9.0 has a known issue exclusive to Unity when parsing impression data if ILRD field has a null value which may cause the app to crash and may notice discrepencies. The fix is to upgrade to Unity SDK to 5.9.0.

Register for the Impression Event

MoPub Unity plugin v5.7.0 (and above) includes an impression callback that you can use to be notified about impression events. The following example illustrates how to register the event.

private void OnEnable() {

  MoPubManager.OnImpressionTrackedEvent += OnImpressionTrackedEvent;

}

private void OnImpressionTrackedEvent(string adUnitId, MoPub.ImpressionData impressionData)
{
   // Feed impression data into internal tools or send to third-party analytics
}

Note that impression data will always be null unless you have enabled this feature with your MoPub account representative.

Send MoPub ILRD Data to Third-Party Attribution and Analytics Vendors

Once you are receiving impression data, you can feed it to your internal Business Intelligence (BI) tools or send it to third-party attribution and analytics providers for further analysis. MoPub has collaborated with the following attribution & analytics vendors to support MoPub’s impression-level revenue data: Adjust, AppsFlyer, Branch, Kochava, Singular, Soomla, and and Tenjin

Each third-party attribution and analytics vendor has its own required format for receiving ILRD data. Specifications to send your data to your third-party attribution and analytics vendors are below.

Example to send MoPub ILRD to Internal BI tool or Firebase

Note: The below sample is applicable assuming the publisher has Firebase SDK imported in their app.

	// REGISTER TO LISTEN TO THE EVENT FROM MOPUB SDK
    private void OnEnable() {
        MoPubManager.OnImpressionTrackedEvent += OnImpressionTrackedEvent;
    }
    
    private void OnImpressionTrackedEvent(string adUnitId, MoPub.ImpressionData impressionData)
    {
        // Feed impression data into internal tools or send to third-party analytics
        var myImpressionObject = JsonUtility.FromJson<ImpressionObject>(impressionData.JsonRepresentation);
        var impressionParameters = new[] {
            new Firebase.Analytics.Parameter("adunit", myImpressionObject.adunit),
            new Firebase.Analytics.Parameter("adunit_name", myImpressionObject.adunit_name),
            new Firebase.Analytics.Parameter("adunit_format", myImpressionObject.adunit_format),
            new Firebase.Analytics.Parameter("currency", myImpressionObject.currency),
            new Firebase.Analytics.Parameter("publisher_revenue", myImpressionObject.publisher_revenue),
            new Firebase.Analytics.Parameter("network_name", myImpressionObject.network_name),
            new Firebase.Analytics.Parameter("precision", myImpressionObject.precision)
        };
        Firebase.Analytics.FirebaseAnalytics.LogEvent("ad_impression_shown", impressionParameters);
    }

    [Serializable]
    public class ImpressionObject
    {
        public string adunit;
        public string adunit_name;
        public string adunit_format;
        public string id;
        public string currency;
        public string publisher_revenue;
        public string network_name;
        public string network_placement_id;
        public string adgroup_id;
        public string adgroup_name;
        public string adgroup_type;
        public string adgroup_priority;
        public string country;
        public string precision;
    }

Last updated November 07, 2019

TWITTER, MOPUB, and the Bird logo are trademarks of Twitter, Inc. or its affiliates. All third party logos and trademarks included are the property of their respective owners.

© 2019 MoPub (a division of Twitter, Inc.)