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.
Appodeal SDK 3.0.1+
Callback Implementation
- UPM Distribution
- Manual Distribution
- Subscribe to the Ad Revenue event using one of the options from this guide.
- You can use callbacks as shown below:
public void SomeMethod()
{
AppodealCallbacks.AdRevenue.OnReceived += (sender, args) => {};
}
- Extend your class with
IAdRevenueListener
:
SomeClassName : IAdRevenueListener {}
- Implement required callback methods in your class:
#region IAdRevenueListener implementation
public void onAdRevenueReceived(AppodealAdRevenue ad)
{
// Called whenever SDK receives revenue information for an ad
}
#endregion
- Then call the following method before SDK initialization:
Appodeal.setAdRevenueCallback(this);
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 Settings → Account → turn on Impression-level ad revenue toggle.
Appodeal Ad Revenue Description
AppodealAdRevenue
- represents revenue information from the ad network.
Parameter | Type | Description |
---|---|---|
NetworkName | String | The name of the ad network |
DemandSource | String | The demand source name and bidder name in case of impression from real-time bidding |
AdUnitName | String | Unique ad unit name |
Placement | String | Appodeal's placement name |
Revenue | Double | The ad's revenue amount or 0 if it doesn't exist |
AdType | String | Appodeal's ad type as string presentation |
Currency | String | Current currency supported by Appodeal (USD) as string presentation |
RevenuePrecision | String | The revenue precision |
exact
- programmatic revenue is the resulting price of the auctionpublisher_defined
- revenue from cross-promo campaignsestimated
- revenue based on ad network price floors or historical eCPMundefined
- revenue amount is not defined
Use Case
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:
- UPM Distribution
- Manual Distribution
#region IAdRevenueListener implementation
public void OnAdRevenueReceived(AppodealAdRevenue ad)
{
//AppsFlyer
var dict = new Dictionary<string, string>();
dict.Add("AdUnitName", ad.AdUnitName);
dict.Add("AdType", ad.AdType);
AppsFlyerAdRevenue.logAdRevenue(ad.NetworkName,
AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeAppodeal,
ad.Revenue, ad.Currency, dict
);
//Adjust
AdjustAdRevenue adRevenue = new AdjustAdRevenue(AdjustConfig.AdjustAdRevenueSourcePublisher);
adRevenue.setRevenue(ad.Revenue, ad.Currency);
adRevenue.setAdRevenueNetwork(ad.NetworkName);
adRevenue.setAdRevenueUnit(ad.AdUnitName);
Adjust.trackAdRevenue(adRevenue);
//Firebase
Firebase.Analytics.FirebaseAnalytics.LogEvent(
Firebase.Analytics.FirebaseAnalytics.EventAdImpression,
new Firebase.Analytics.Parameter(
Firebase.Analytics.FirebaseAnalytics.ParameterAdPlatform, "Appodeal"),
new Firebase.Analytics.Parameter(
Firebase.Analytics.FirebaseAnalytics.ParameterAdFormat, ad.AdType),
new Firebase.Analytics.Parameter(
Firebase.Analytics.FirebaseAnalytics.ParameterAdSource, ad.NetworkName),
new Firebase.Analytics.Parameter(
Firebase.Analytics.FirebaseAnalytics.AdUnitName, ad.AdUnitName),
new Firebase.Analytics.Parameter(
Firebase.Analytics.FirebaseAnalytics.AdCurrency, ad.Currency),
new Firebase.Analytics.Parameter(
Firebase.Analytics.FirebaseAnalytics.Value, ad.Revenue)
);
}
#endregion
#region IAdRevenueListener implementation
public void onAdRevenueReceived(AppodealAdRevenue ad)
{
//AppsFlyer
var dict = new Dictionary<string, string>();
dict.Add("AdUnitName", ad.AdUnitName);
dict.Add("AdType", ad.AdType);
AppsFlyerAdRevenue.logAdRevenue(ad.NetworkName,
AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeAppodeal,
ad.Revenue, ad.Currency, dict
);
//Adjust
AdjustAdRevenue adRevenue = new AdjustAdRevenue(AdjustConfig.AdjustAdRevenueSourcePublisher);
adRevenue.setRevenue(ad.Revenue, ad.Currency);
adRevenue.setAdRevenueNetwork(ad.NetworkName);
adRevenue.setAdRevenueUnit(ad.AdUnitName);
Adjust.trackAdRevenue(adRevenue);
//Firebase
Firebase.Analytics.FirebaseAnalytics.LogEvent(
Firebase.Analytics.FirebaseAnalytics.EventAdImpression,
new Firebase.Analytics.Parameter(
Firebase.Analytics.FirebaseAnalytics.ParameterAdPlatform, "Appodeal"),
new Firebase.Analytics.Parameter(
Firebase.Analytics.FirebaseAnalytics.ParameterAdFormat, ad.AdType),
new Firebase.Analytics.Parameter(
Firebase.Analytics.FirebaseAnalytics.ParameterAdSource, ad.NetworkName),
new Firebase.Analytics.Parameter(
Firebase.Analytics.FirebaseAnalytics.AdUnitName, ad.AdUnitName),
new Firebase.Analytics.Parameter(
Firebase.Analytics.FirebaseAnalytics.AdCurrency, ad.Currency),
new Firebase.Analytics.Parameter(
Firebase.Analytics.FirebaseAnalytics.Value, ad.Revenue)
);
}
#endregion