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
Appodeal.setAdRevenueCallbacks(new AdRevenueCallbacks() { @Override public void onAdRevenueReceive(RevenueInfo revenueInfo) { // Called whenever SDK receives revenue information for an ad } } );
All callbacks are called on the main thread.
Revenue Info Description
RevenueInfo - represents revenue information.
Parameter | Type | Description |
---|---|---|
networkName | String | The name of the ad network is guaranteed not to be null. |
demandSource | String | The demand source name and bidder name in case of impression from real-time bidding, guaranteed not to be null. |
adUnitName | String | Unique ad unit name guaranteed not to be null. |
placement | String | Appodeal's placement name is guaranteed not to be null. |
revenue | Double | The ad's revenue amount or 0 if it doesn't exist. |
adType | Int | Appodeal's ad type. |
adTypeString | String | Appodeal's ad type as string presentation. |
platform | String | Appodeal's platform name. |
revenueCurrency | RevenueCurrency | Current currency supported by Appodeal (USD). |
currency | String | Current currency supported by Appodeal (USD) as string presentation. |
revenuePrecision | String | The revenue precision, which can be: |
Use Сase
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:
@Override public void onAdRevenueReceive(RevenueInfo revenueInfo) { // Appsflyer Map<String, String> customParams = new HashMap<>(); customParams.put(Scheme.AD_UNIT, revenueInfo.getAdUnitName()); customParams.put(Scheme.AD_TYPE, revenueInfo.getAdTypeString()); AppsFlyerAdRevenue.logAdRevenue( revenueInfo.getNetworkName(), MediationNetwork.appodeal, Currency.getInstance(Locale.US), revenueInfo.getRevenue(), customParams ); // Adjust AdjustAdRevenue adRevenue = new AdjustAdRevenue("Appodeal") adRevenue.setRevenue(revenueInfo.getRevenue(), revenueInfo.getCurrency()); adRevenue.setAdRevenueNetwork(revenueInfo.getNetworkName()); adRevenue.setAdRevenueUnit(revenueInfo.getAdUnitName()); Adjust.trackAdRevenue(adRevenue); // Firebase Bundle bundle = new Bundle(); bundle.putString(FirebaseAnalytics.Param.AD_PLATFORM, revenueInfo.getPlatform()); bundle.putString(FirebaseAnalytics.Param.SOURCE, revenueInfo.getNetworkName()); bundle.putString(FirebaseAnalytics.Param.AD_FORMAT, revenueInfo.getAdTypeString()); bundle.putString(FirebaseAnalytics.Param.AD_UNIT_NAME, revenueInfo.getAdUnitName()); bundle.putString(FirebaseAnalytics.Param.CURRENCY, RevenueInfo.getCurrency()); bundle.putString(FirebaseAnalytics.Param.VALUE, RevenueInfo.getRevenue()); mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.AD_IMPRESSION, bundle); }