The HyperBid Flutter SDK returns an McAd object via the onAdRevenuePaidCallback callback when an ad generates revenue. You can extract revenue-related fields from it and report them to third-party platforms such as Firebase Analytics, Adjust, AppsFlyer, and SolarEngine for ad revenue attribution and data analysis.
McAd Revenue-Related Fields:
| Field | Type | Description |
|---|---|---|
revenue |
double |
Ad impression revenue amount |
currency |
String |
Currency unit (e.g. USD, CNY) |
ecpm |
double |
Estimated eCPM |
networkName |
String |
Ad Network name |
mediationPlacementId |
String |
Mediation Platform Placement ID |
adUnitId |
String |
Mediation Unit ID |
- โ ๏ธ When using Firebase & AdMob linked integration, avoid duplicate AdMob revenue reporting
- The following sample code is for reference only. For details, please refer to the Firebase official documentation
void onAdRevenuePaidCallback(McAd ad) {
// Prevent duplicate AdMob reporting
// if (ad.mediationId == McMediationId.admob) return;
// if (ad.networkFirmId == 2 && !(ad.biddingType == 1 || ad.biddingType == 2)) return;
String mediationPlatform = switch (ad.mediationId) {
McMediationId.topon => "TopOn",
McMediationId.max => "Max",
_ => "custom", // _ represents default
};
await FirebaseAnalytics.instance.logAdImpression(
adPlatform: mediationPlatform,
adSource: ad.networkName,
adFormat: ad.adFormat,
adUnitName: ad.mediationPlacementId,
value: ad.revenue,
currency: ad.currency
);
}
โ ๏ธ The sample code is for reference only. For specific field values, please refer to the Adjust official documentation
void onAdRevenuePaidCallback(McAd ad) {
String mediationPlatform = switch (ad.mediationId) {
McMediationId.topon => "topon_sdk",
McMediationId.max => "applovin_max_sdk",
McMediationId.admob => "admob_sdk",
_ => "custom", // _ represents default
};
AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue(mediationPlatform);
adjustAdRevenue.setRevenue(ad.revenue, ad.currency);
adjustAdRevenue.adRevenueNetwork = ad.networkName;
adjustAdRevenue.adRevenueUnit = ad.mediationPlacementId;
adjustAdRevenue.adRevenuePlacement = ad.adFormat;
Adjust.trackAdRevenue(adjustAdRevenue);
}
๐ For field mapping with Adjust, please refer to the Adjust official documentation. The above example is a common usage reference.
โ ๏ธ The sample code is for reference only. For specific field values, please refer to the AppsFlyer official documentation
void onAdRevenuePaidCallback(McAd ad) {
Map<String, dynamic> customParams = {
'adUnitId': ad.networkPlacementId
};
String mediationPlatform = switch (ad.mediationId) {
McMediationId.topon => AFMediationNetwork.topon.value,
McMediationId.max => AFMediationNetwork.applovinMax.value,
McMediationId.admob => AFMediationNetwork.googleAdMob.value,
_ => "custom", // _ represents default
};
AdRevenueData adRevenueData = AdRevenueData(
monetizationNetwork: ad.networkName,
mediationNetwork: mediationPlatform,
currencyIso4217Code: ad.currency,
revenue: ad.revenue,
additionalParameters: customParams);
_appsflyerSdk.logAdRevenue(adRevenueData);
}
๐ For field mapping with AppsFlyer, please refer to the AppsFlyer official documentation. The above example is a common usage reference.
โ ๏ธ The sample code is for reference only. For specific field values, please refer to the SolarEngine official documentation
void onAdRevenuePaidCallback(McAd ad) {
SEAppImpressionData appImpressionData = SEAppImpressionData();
appImpressionData.adNetworkPlatform = ad.networkName;
// appImpressionData.adType = ...; // Refer to SolarEngine official documentation for ad type values
appImpressionData.adNetworkAppID = "Monetization platform app ID";
appImpressionData.adNetworkADID = ad.networkPlacementId;
appImpressionData.ecpm = ad.ecpm;
appImpressionData.currencyType = ad.currency;
appImpressionData.isRenderSuccess = true;
String mediationPlatform = switch (ad.mediationId) {
McMediationId.topon => "topon",
McMediationId.max => "max",
McMediationId.admob => "admob",
_ => "custom", // _ represents default
};
appImpressionData.mediationPlatform = mediationPlatform;
SolarEngine.trackAppImpress(appImpressionData);
}
๐ For field mapping with SolarEngine, please refer to the SolarEngine official documentation. The above example is a common usage reference.