Skip to main content
Version: 3.4.0-beta.2

Ad Revenue Callbacks

Appodeal SDK allows you to get impression-level revenue data with Ad Revenue Callbacks. This data includes information about network name, revenue, ad type, etc.

The impression-level ad revenue data can be used then to share with your mobile measurement partner of choice, such as Firebase, for all supported networks.

If you have integrated Firebase, which is included in Appodeal SDK, using this guide, then ad revenue data will be sent automatically, you can read more about it here in Step 2.

Minimum Requirements:

Appodeal SDK 3.0.1+

Callback Implementation

extension YourViewController: UIViewController, AppodealAdRevenueDelegate {
    override func viewDidLoad() {
super.viewDidLoad()
Appodeal.setAdRevenueDelegate(self)
    }

func didReceiveRevenue(forAd ad: AppodealAdRevenue) {
let parameters: [String: Any] = [
"network": ad.networkName,
"ad_unit": ad.adUnitName,
"placement": ad.placement,
"revenue_precision": ad.revenuePrecision,
"demand": ad.demandSource,
"currency": ad.currency,
"revenue": ad.revenue,
"ad_type": ad.adTypeString
]

}
}
Admob Notice

To get impression-level ad revenue from Admob you also need to turn on the setting in your AdMob account.

Go to your Admob Account SettingsAccount → turn on Impression-level ad revenue toggle.


Appodeal Ad Revenue Description

AppodealAdRevenue - represents revenue information from the ad network.

ParameterTypeDescription
networkNameStringThe name of the ad network.
demandSourceStringThe demand source name and bidder name in case of impression from real-time bidding
adUnitNameStringUnique ad unit name.
placementStringAppodeal's placement name.
revenueDoubleThe ad's revenue amount or 0 if it doesn't exist.
adTypeIntAppodeal's ad type.
adTypeStringStringAppodeal's ad type as string presentation.
platformStringAppodeal's platform name.
currencyStringCurrent currency supported by Appodeal (USD) as string presentation.
revenuePrecisionStringThe revenue precision.
Revenue Precision options
  1. exact - programmatic revenue is the resulting price of the auction
  2. publisher_defined - revenue from crosspromo campaigns
  3. estimated - revenue based on ad network pricefloors or historical eCPM
  4. undefined - revenue amount is not defined

Use Case

Please remember:

If you have integrated analytics for example Firebase using this guide with Appodeal, then no additional steps are required.

In case you are using your own analytics in the project, please find the example below:

extension YourViewController: UIViewController, AppodealAdRevenueDelegate {
override func viewDidLoad() {
super.viewDidLoad()
Appodeal.setAdRevenueDelegate(self)
}

func didReceiveRevenue(forAd ad: AppodealAdRevenue) {
let parameters: [String: Any] = [
"network": ad.networkName,
"ad_unit": ad.adUnitName,
"placement": ad.placement,
"revenue_precision": ad.revenuePrecision,
"demand": ad.demandSource,
"currency": ad.currency,
"revenue": ad.revenue,
"ad_type": ad.adTypeString
]

//AppsFlyer
let adRevenueParams:[AnyHashable: Any] = [
kAppsFlyerAdRevenueAdUnit : ad.adUnitName,
kAppsFlyerAdRevenueAdType : ad.adTypeString
]

AppsFlyerAdRevenue.shared().logAdRevenue(
monetizationNetwork: ad.networkName,
mediationNetwork: MediationNetworkType.appodeal,
eventRevenue: ad.revenue,
revenueCurrency: ad.currency,
additionalParameters: adRevenueParams
)

//Adjust
let adRevenue = ADJAdRevenue(source: ADJAdRevenueSourcePublisher)
adRevenue.setRevenue(ad.revenue, currency: ad.currency)
adRevenue.adRevenueUnit(ad.adUnitName)
adRevenue.adRevenueNetwork(ad.networkName)
Adjust.trackAdRevenue(adRevenue)

//Firebase
Analytics.logEvent(AnalyticsEventAdImpression, parameters: [
AnalyticsParameterAdFormat: ad.adTypeString,
AnalyticsParameterAdSource: ad.networkName,
AnalyticsParameterAdUnitName: ad.adUnitName,
AnalyticsParameterAdCurrency: ad.currency,
AnalyticsParameterValue: ad.revenue
])
}
}