Skip to main content
danger
iOS SDK 3.0.2 is outdated. The most recent stable version is here.
Version: 3.0.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
]

}
}

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.
adTypeStringStringAppodeal's ad type as string presentation.
currencyStringCurrent currency supported by Appodeal (USD) as string presentation.
revenuePrecisionString

The revenue precision, which can be:

  • exact - programmatic revenue is the resulting price of the auction;
  • publisher_defined - revenue from crosspromo campaigns;
  • estimated - revenue based on ad network pricefloors or historical eCPM;
  • 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
])
}
}