1. Introduction
You can obtain advertising-related data through the proxy callback of TopOn SDK and report it to the third-party data platform.
Get the corresponding value through the proxy callback extra of each ad type. For details, see the callback information description .
property | illustrate |
extra[@"network_firm_id"] | Corresponding ids of third-party advertising platforms, refer to the Network Firm ID table |
extra[@"publisher_revenue"] | Get the revenue brought by this display. The unit can be obtained through currency and the accuracy can be obtained through precision. |
extra[@"country"] | Get the country code, for example: "CN" |
extra[@"currency"] | Get the currency unit, for example: "USD" |
extra[@"network_placement_id"] | Advertising ID of third-party advertising platform |
extra[@"adunit_id"] | Get the TopOn ad slot ID |
2. Timing of reporting
If you have authorized the monetization revenue data of other advertising platforms in the reporting background, and the data reported now includes this advertising platform, please be sure to first disable the authorization of these platforms in the reporting background, and then use the reported revenue data to connect, otherwise duplicate data will be generated.
We recommend reporting revenue data in the proxy of ad display revenue callback :
- (void)didRevenueForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra
3. Platform docking
3.1 Appsflyer
It is recommended to use a tool class to write Appsflyer -related code, and then call it where reporting is required.
- (void)didRevenueForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
NSString *unitId = extra[@"network_placement_id"];
// convert
double price = [extra[@"publisher_revenue"] doubleValue];
NSString *currency = extra[@"currency"];
NSString *country = extra[@"country"];
[[AppsFlyerLib shared] logEvent: AFEventPurchase
withValues:@{
AFEventParamContentId:unitId,
AFEventParamRevenue: @(price),
AFEventParamCurrency:currency,
AFEventParamCountry:country
}];
}
3.2 Adjust
It is recommended to use a tool class to write Adjust- related codes, and then call it where reporting is required.
- (void)didRevenueForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
double price = [extra[@"publisher_revenue"] doubleValue];
NSString *currency = extra[@"currency"];
ADJAdRevenue *adRevenue = [[ADJAdRevenue alloc] initWithSource:ADJAdRevenueSourceTopOn];
// pass revenue and currency values
[adRevenue setRevenue:price currency:currency];
// track ad revenue
[Adjust trackAdRevenue:adRevenue];
}
3.3 Firebase
It is recommended to use a tool class to write Firebase- related codes, and then call them where reporting is required.
- (void)didRevenueForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
//#import <FirebaseAnalytics/FirebaseAnalytics.h>
NSInteger network_firm_id = [[extra valueForKey:@"network_firm_id"] integerValue];
BOOL adsource_isheaderbidding = [[extra valueForKey:@"adsource_isheaderbidding"] boolValue];
if (network_firm_id == 2 && adsource_isheaderbidding == 0) return;
double price = [extra[@"publisher_revenue"] doubleValue];
NSString *currency = extra[@"currency"];
NSDictionary *params = @{
kFIRParameterValue: @(price),
kFIRParameterCurrency: currency,
kFIRParameterAdPlatform: @"TopOn",
kFIRParameterAdFormat: [extra valueForKey:@"adunit_format"],
kFIRParameterAdUnitName : [extra valueForKey:@"adunit_id"],
kFIRParameterAdSource : [extra valueForKey:@"network_name"],//Custom adapter not supported
};
[FIRAnalytics logEventWithName:kFIREventAdImpression parameters:params];
}