Ad revenue
At a glance: The AppsFlyer ad revenue SDK connector enables the ad networks to report ad revenue using impression-level granularity.
Overview
Ad revenue reporting options
Ad revenue is reported to AppsFlyer by either aggregate granularity (via API) or impression-level granularity (via SDK). Impression-level data via SDK:
- Has better data freshness and earlier availability in AppsFlyer.
- Supports SKAN.
This document details how to send impression-level ad revenue provided by partners in the app to AppsFlyer.
Reporting ad revenue using the SDK
SDK principles of operation
The ad revenue SDK connector sends impression revenue data to the AppsFlyer SDK. An ad revenue event, af_ad_revenue, is generated and sent to the platform. These impression events are collected and processed in AppsFlyer, and the revenue is attributed to the original UA source.
Integration
To integrate the iOS ad revenue SDK connector, you need to import, initialize, and trigger the SDK.
Import the iOS ad revenue SDK
- In your Podfile, specify the following:
pod 'AppsFlyer-AdRevenue'
Important: If you have the AppsFlyerFramework
pod in your Podfile, remove it to avoid a collision.
- Run the pod update.
Initialize the iOS ad revenue SDK
- In
AppDelegate
, in thedidFinishLaunchingWithOptions
method, call the AdRevenuestart
method using the following code:
import AppsFlyerLib
import AppsFlyerAdRevenue
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
AppsFlyerAdRevenue.start()
}
@objc func applicationDidBecomeActive() {
AppsFlyerLib.shared().start()
}
}
Trigger the logAdRevenue API call
- Trigger the
logAdRevenue
API call upon every valid impression, including mandatory, and any optional, arguments.
let adRevenueParams:[AnyHashable: Any] = [
kAppsFlyerAdRevenueCountry : "us",
kAppsFlyerAdRevenueAdUnit : "02134568",
kAppsFlyerAdRevenueAdType : "Banner",
kAppsFlyerAdRevenuePlacement : "place",
kAppsFlyerAdRevenueECPMPayload : "encrypt",
"foo" : "testcustom",
"bar" : "testcustom2"
]
AppsFlyerAdRevenue.shared().logAdRevenue(
monetizationNetwork: "facebook",
mediationNetwork: MediationNetworkType.googleAdMob,
eventRevenue: 0.026,
revenueCurrency: "USD",
additionalParameters: adRevenueParams)
Updated 14 days ago