Integrate Impression-Level Revenue Data

Before you begin:

Implement the Impression Callback Interface

MoPub SDK v5.7.0 and higher has the public interface ImpressionListener. This listener is notified when an impression is fired for any format of ad shown.

Note that parameter data in onImpression() is null unless you have enabled the ILRD feature with your MoPub account representative.

  1. Implement the interface ImpressionListener and subscribe to events from ImpressionEmitter to receive detailed impression data. The ImpressionEmitter class is not linked to the activity lifecycle. We recommend that you subscribe to events when your application starts, even before the first activity is created.

     interface ImpressionListener {
       void onImpression(@NonNull String adUnitId, @Nullable ImpressionData impressionData);
  2. Call addListener to start listening for impression-level revenue data events.

  3. Call removeListener to unsubscribe from impression-level revenue data events.

    public void ImpressionsEmitter.addListener(ImpressionListener listener);
    public void ImpressionsEmitter.removeListener(ImpressionListener listener);

Make sure to not leak any ImpressionListeners. If your listener is tied to the activity lifecycle, make sure to remove the listener when the activity is destroyed.


    protected void onCreate(Bundle savedInstanceState) {

    	private ImpressionListener mImpressionListener;

    	mImpressionListener = new ImpressionListener() {
            public void onImpression(@NonNull final String adUnitId, @Nullable final ImpressionData impressionData) {
                Log.i("ILRD", "impression for adUnitId= " + adUnitId);

                if (impressionData == null) {
                    // impression data is not available, write warning to LogCat
                    Log.w("ILRD", "impression data not available for adUnitId= " + adUnitId);
                } else {
                    try {
                        // impression data is available, process it here
                        Log.i("ILRD", "impression data adUnitId= " + adUnitId + "data=\n" + impressionData.getJsonRepresentation().toString(2));
                    } catch (JSONException e) {
                        Log.e("ILRD", "Can't format impression data. e=" + e.toString() );

          // subscribe to start listening for impression data

    protected void onDestroy() {
    	// Remove the listener to unscubcribe
      if (mImpressionListener != null) {
        mImpressionListener = null;

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
Google Analytics for Firebase Refer to the example below
Kochava Kochava format specifications
Singular Singular format specifications
Soomla Soomla format specifications
Tenjin Tenjin format specifications
GameAnalytics (BETA) GameAnalytics format specifications


MoPub officially partners with Google Analytics for Firebase. Follow this example (which assumes that you have the Firebase SDK in your app) to send MoPub ILRD to Google Analytics for Firebase. You can also use this code snippet as an example of integrating an internal BI tool.

public void onImpression(@NonNull final String adUnitId, @Nullable final ImpressionData impressionData) {

  if (impressionData != null) {
    // Feed impression data into internal tools or send to third-party analytics
    FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(context);

    Bundle params = new Bundle();
    params.putString(FirebaseAnalytics.Param.AD_PLATFORM, MoPub);
    params.putString(FirebaseAnalytics.Param.AD_SOURCE, impressionData.network_name);
    params.putString(FirebaseAnalytics.Param.AD_FORMAT, impressionData.adunit_format);
    params.putString(FirebaseAnalytics.Param.AD_UNIT_NAME, impressionData.adunit_name);
    params.putString(FirebaseAnalytics.Param.VALUE, impressionData.publisher_revenue);
    params.putString(FirebaseAnalytics.Param.CURRENCY, impressionData.currency);
    params.putString("precision", impressionData.precision);
    mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.AD_IMPRESSION, params);


Last updated August 28, 2021

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.

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