At a glance: The AppsFlyer ad revenue SDK enables the MoPub SDK to report ad revenue using impression-level granularity.
Impression-level ad revenue reporting by SDK
Ad revenue reporting options
Ad revenue is reported to AppsFlyer by MoPub by either aggregate granularity or impression-level granularity. Impression-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 impression-level data to AppsFlyer by SDK. This document details how to send impression-level ad revenue provided by MoPub in the app to AppsFlyer. Note: There is also an AppsFlyer ad revenue plugin for Unity.
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 Day 0 and the SDK sends the data to the platform. Processing begins Day 2 at midnight UTC. The data is available in the Dashboard on Day 2 from 16:00 UTC. Data is reported under Day 0.
Ad revenue display timeline
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 impression-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, in the select impression level in the MoPub ad revenue tab.
Implementing AppsFlyer ad revenue SDK
Implementing ad revenue SDK with MoPub
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 impression-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
- Enable IRLD for your MoPub account.
- Use AppsFlyer SDK version 5.1.0+. You can find the latest version here.
- Integrate MoPub SDK version 5.7+into the app.
Import the Android ad revenue SDK
- Add the code below to Module-level /app/build.gradle before
dependencies
:repositories { mavenCentral() }
- Add com.appsflyer:adrevenue:5.1.0 as a dependency.
dependencies { implementation 'com.appsflyer:adrevenue:5.1.0' }
- Sync the project to retrieve the dependencies.
Initialize the Android ad revenue SDK
The following takes place inside the app global application class.
- 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... }
Import the iOS ad revenue SDK using CocoaPods
- In your Podfile specify the following:
use_frameworks! pod 'AppsFlyer-AdRevenue-MoPub'
Important!
If you have
pod 'AppsFlyerFramework'
in your Podfile - remove it to avoid collision. - Run pod update.
Initialize the iOS ad revenue SDK
- In your AppDelegate.m add the following code:
@import AppsFlyerLib; @import AppsFlyerAdRevenue; ... - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Setup AppsFlyer [[AppsFlyerTracker sharedTracker] setAppsFlyerDevKey:@"{dev-key}"]; [[AppsFlyerTracker sharedTracker] setAppleAppID:@"{apple-id}"]; [[AppsFlyerTracker sharedTracker] setIsDebug:YES]; // Setup AppsFlyerAdRevenue [AppsFlyerAdRevenue start];
//... } - (void)applicationDidBecomeActive:(UIApplication *)application { [[AppsFlyerTracker sharedTracker] trackAppLaunch]; } - In your UIViewController, where you use MoPub Ad, import the ad revenue SDK:
@import AppsFlyerAdRevenue;
- In your UIViewController, replace:
with:self.nativeAd.delegate = self;
self.nativeAd.delegate = [[AppsFlyerAdRevenue shared] delegate:self forProtocol:@protocol(MPNativeAdDelegate)]; // you may need to change the protocol based on the ad type