MoPub user-level ad revenue SDK integration guide

At a glance: AppsFlyer ad revenue SDK enables the MoPub SDK to report ad revenue using user-level granularity.

mceclip1.png

User-level ad revenue reporting by SDK

Ad revenue reporting options

Ad revenue is reported to AppsFlyer by MoPub by either aggregate granularity or user-level granularity. User-level granularity is superior as revenue is attributed to the original user acquisition (UA) media source. This, in turn, improves the precision of the LTV/ROI data available in the platform. 

MoPub is able to provide user-level data to AppsFlyer by SDK. This document details how to send user-level ad revenue provided by MoPub in the app to AppsFlyer. 

Reporting ad revenue using the SDK

SDK principles of operation

The MoPub SDK sends impression revenue data to the AppsFlyer SDK. An ad revenue event, af_ad_revenue, is generated and sent to the platform. The event is recorded and the revenue attributed to the original UA source.

In the platform, a daily process extracts the attribution for each device, and revenue attribution performed.  The data freshness, revenue SDK events, is the same as that for events reported by other ad revenue methods as described here. 

Data display

The af_ad_revenue event is used to identify ad revenue. This event is used throughout the platform including the dashboard and data delivery tools

Data freshness

The SDK sends the revenue data to the platform at the time the ad displays. The data is available in the platform sometime thereafter. For example, an ad displays on Monday and the SDK reports it to the platform. Processing begins on Wednesday (midnight) 00:00 UTC. The data is available on the dashboard on Wednesday from 16:00 UTC. Note: The revenue displays under Tuesday.

Ad revenue display timeline

mceclip2.png

Considerations when migrating from API to SDK 

If you currently receive ad revenue by API, from integrated partners that mediate using MoPub, you need to disable integration with these partners when you implement the MoPub monetization SDK. If you don't, ad revenue attribution may be duplicated. 

If you currently send ad revenue in-app events (without revenue) you can continue sending them or disable them. In any event, they don't impact the allocation of user-level revenue in the Dashboard.

Note: Some time can pass from the time you release the app version containing the ad revenue SDK to the app stores until your app users download the updated version. As such, leave the SDK module dormant and activate it after most of the users have updated the app. When you activate the module:

  • Simultaneously disable the ad revenue integration of partners who mediate through MoPub
  • In AppsFlyer, select User level integration in the Twitter (MoPub) ad revenue tab. 

Implementing AppsFlyer ad revenue SDK

Implementing ad revenue SDK with MoPub

Ad revenue SDK implementation workflow
Step Action requires
1

ASK your MoPub account manager to enable Impression-level revenue data (ILRD)

2 Verify that you use MoPub SDK V5.7 or higher and that the version  supports ILRD 
3 Enable user-level ad revenue in AppsFlyer. Note: This needs to be done for each app individually. 
4 Integrate the AppsFlyer ad revenue SDK using the instructions here. The integration for iOS and Android is somewhat different, make sure you follow the separate instructions. 
5

Switching over (migrating) from API ad revenue reporting to SDK ad revenue reporting. See considerations when migrating from API to SDK in this article.

Ad revenue SDK module for developers

 Note

Currently, the ad revenue SDK only supports integration with MoPub SDK.

Prerequisites

Android iOS

Import the Android ad revenue SDK

  1. Add the code below to Module-level /app/build.gradle before dependencies:
    repositories { 
      mavenCentral()
    }
    
  2. Add the latest version of AppsFlyer SDK as a dependency. You can find the latest version here.
    dependencies {
        implementation 'com.appsflyer:adrevenue:5.1.0'
    }
  3. Sync the project to retrieve the dependencies.

Initialize the Android ad revenue SDK

The following steps take place inside the app global application class.

  1. Inside the app global class, import the following libraries:
    import com.appsflyer.adrevenue.AppsFlyerAdRevenue;
  2. In the app global class, inside the onCreate method, place the following code:
    public class MyApplication extends Application {
        
        @Override
        public void onCreate() {
            super.onCreate();
            
            AppsFlyerAdRevenue.Builder afRevnueBuilder = new AppsFlyerAdRevenue.Builder(Application: this);     
            adRevenueBuilder.addNetworks(AppsFlyerAdRevenueWrapperType.MOPUB);
            
            //Optional
            afRevnueBuilder.adEventListener(new Consumer<AppsFlyerAdEvent>() {
                @Override
                public void accept(AppsFlyerAdEvent appsFlyerAdEvent) {
                    appsFlyerAdEvent.getAdNetworkEventType();
                    appsFlyerAdEvent.getAdNetworkActionName();
                    appsFlyerAdEvent.getAdNetworkPayload();
                    appsFlyerAdEvent.getAdNetworkActionName();
                }
            });
            
            AppsFlyerAdRevenue.initialize(afRevnueBuilder.build());                                  
            AppsFlyerAdRevenue.moPubWrapper().recordImpressionData();
           
            //additional code...
    
            
    }

Limitations

Raw data export of user-level ad revenue is not available. The core value of getting user-level data is to record ad revenue attribution based on the most granular data that the monetization network provides.

Was this article helpful?