Integrate Impression-Level Revenue Data

Before you begin:

  • First read our Impression-Level Revenue Data (ILRD) guide to understand the flow of events that you will implement below.

  • Make sure you have integrated MoPub SDK v5.9.0 or higher.

  • Note that there a known issue exclusive to Unity affecting SDK versions lower than 5.9.0. When parsing impression data, if the ILRD field has a null value, it may cause the app to crash, or you may notice other problems. To avoid this, upgrade to MoPub Unity SDK v5.9.0.

Register for the Impression Event

MoPub Unity SDK v5.7.0 and higher 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 ILRD with your MoPub account representative.

Send Data to Other Tools or Vendors

Once you receive 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 a number of attribution and analytics vendors to support MoPub’s impression-level revenue data. Each vendor has their own format for receiving impression data. Our partners and their specifications are as follows:

Attribution/Analytics Vendor Format Specifications for Receiving ILRD
Adjust Adjust format specifications
AppsFlyer AppsFlyer format specifications
Branch Branch format specifications
Kochava Kochava format specifications
Singular Singular format specifications
Soomla Soomla format specifications
Tenjin Tenjin format specifications

We recommend that you call tenjin.SubscribeMoPubImpressions() after initializing the Tenjin SDK, as documented in the Tenjin readme. Call this method as early as possible in the lifecycle of the app, so that Tenjin can receive ILRD events as soon as they are emitted. The minimum Tenjin SDK version required is 1.10.2. If you have any questions, contact the Tenjin support team.
GameAnalytics (BETA) GameAnalytics format specifications

Example

The following is an example of sending MoPub ILRD to an internal BI tool or Firebase. It assumes that you have the Firebase SDK in your 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_id", myImpressionObject.adunit_id),
            new Firebase.Analytics.Parameter("adunit_name", myImpressionObject.adunit_name),
            new Firebase.Analytics.Parameter("adunit_format", myImpressionObject.adunit_format),
            new Firebase.Analytics.Parameter("app_version", myImpressionObject.app_version),
            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_id;
        public string adunit_name;
        public string adunit_format;
        public string app_version;
        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 August 24, 2020

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.

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