Menu

Third-party revenue feedback(SDK v6.4.12 below)

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 the ad display callback :

Ad Type API illustrate
Splash screen ads splashDidShowForPlacementID: extra: Splash ad displayed successfully
Incentive Video rewardedVideoDidStartPlayingForPlacementID: extra: The rewarded video ad starts playing, i.e. the rewarded video display callback
Interstitial Ads interstitialDidShowForPlacementID: extra: Interstitial ads displayed successfully
Banner Ads bannerView: didShowAdWithPlacementID: extra: bannerView displays the results
Banner Ads bannerView: didAutoRefreshWithPlacement: extra: bannerView automatically refreshes
Native Advertising didShowNativeAdInAdView: placementID: extra: Native ads displayed successfully

Note: Banner ads can be refreshed manually (implemented by the developer) or automatically (enabled by default in the TopOn backend), so the revenue data reported needs to be differentiated:

Manual refresh: Just report to the agent that successfully displayed
Automatic refresh: In addition to reporting in the agent who successfully displayed the banner, you also need to report in the agent whose banner automatically refreshed , that is, both agents need to report
 

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)handleAppsFlyerRevenueReport:(NSDictionary *)extra {
    
    NSString *unitId = extra[@"network_placement_id"];
    // 对精度要求较高的开发者需自行进行转换
    double price = [extra[@"publisher_revenue"] doubleValue];
    NSString *currency = extra[@"currency"];
    NSString *country = extra[@"country"];
    
    // Appsflyer提供多个key给开发者选用,开发者按自己需求使用,这里作为一个例子。
    [[AppsFlyerLib shared] logEvent: AFEventPurchase
    withValues:@{
        AFEventParamContentId:unitId,
        AFEventParamRevenue: @(price),
        AFEventParamCurrency:currency,
        AFEventParamCountry:country
    }];
}

3.1.1 Splash Screen Ads

We use Appsflyer to report revenue data in the splash ad display proxy callback:

 - (void)splashDidShowForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATSplashViewController::splashDidShowForPlacementID:%@", extra);
    
    [self handleAppsFlyerRevenueReport:extra];
}

3.1.2 Incentive Video

 -(void) rewardedVideoDidStartPlayingForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATRewardedVideoViewController::rewardedVideoDidStartPlayingForPlacementID:%@ extra:%@", placementID, extra);
 
    [self handleAppsFlyerRevenueReport:extra];
}

3.1.3 Interstitial Ads

 -(void) interstitialDidShowForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
     NSLog(@"ATInterstitialViewController::interstitialDidShowForPlacementID:%@ extra:%@", placementID, extra);
     
     [self handleAppsFlyerRevenueReport:extra];
}

3.1.4 Banner Ads

 - (void)bannerView:(ATBannerView*)bannerView didShowAdWithPlacementID:(NSString*)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATBannerViewController::bannerView:didShowAdWithPlacementID:%@ with extra: %@", placementID,extra);
    
    [self handleAppsFlyerRevenueReport:extra];
}

If the automatic refresh function is enabled, you also need to report it in the automatic refresh callback

 - (void)bannerView:(ATBannerView*)bannerView didAutoRefreshWithPlacement:(NSString*)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATBannerViewController::bannerView:didAutoRefreshWithPlacement:%@ with extra: %@", placementID,extra);

    [self handleAppsFlyerRevenueReport:extra];
}

3.1.5 Native Advertising

 -(void) didShowNativeAdInAdView:(ATNativeADView*)adView placementID:(NSString*)placementID extra:(NSDictionary *)extra{
    NSLog(@"ATNativeViewController:: didShowNativeAdInAdView:placementID:%@ with extra: %@", placementID,extra);

    [self handleAppsFlyerRevenueReport:extra];
}

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)handleAdjustRevenueReport:(NSDictionary *)extra {
    
    // 对精度要求较高的开发者需自行进行转换 
    double price = [extra[@"publisher_revenue"] doubleValue]; 
    NSString *currency = extra[@"currency"];
    
    // Source:收入来源(ADJAdRevenueSourceTaku在Adjust v4.37.1版本以上才有)
    ADJAdRevenue *adRevenue = [[ADJAdRevenue alloc] initWithSource:ADJAdRevenueSourceTaku];
    // pass revenue and currency values
    [adRevenue setRevenue:price currency:currency];
    
    // track ad revenue
    [Adjust trackAdRevenue:adRevenue];
}

3.2.1 Splash Screen Ads

 - (void)splashDidShowForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATSplashViewController::splashDidShowForPlacementID:%@", extra);
    
    [self handleAdjustRevenueReport:extra];
}

3.2.2 Incentive Video

 -(void) rewardedVideoDidStartPlayingForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATRewardedVideoViewController::rewardedVideoDidStartPlayingForPlacementID:%@ extra:%@", placementID, extra);
 
    [self handleAdjustRevenueReport:extra];
}

3.2.3 Interstitial Ads

 -(void) interstitialDidShowForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
     NSLog(@"ATInterstitialViewController::interstitialDidShowForPlacementID:%@ extra:%@", placementID, extra);
     
     [self handleAdjustRevenueReport:extra];
}

3.2.4 Banner Ads

 - (void)bannerView:(ATBannerView*)bannerView didShowAdWithPlacementID:(NSString*)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATBannerViewController::bannerView:didShowAdWithPlacementID:%@ with extra: %@", placementID,extra);
    
    [self handleAdjustRevenueReport:extra];
}

If the automatic refresh function is enabled, you also need to report it in the automatic refresh callback

 - (void)bannerView:(ATBannerView*)bannerView didAutoRefreshWithPlacement:(NSString*)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATBannerViewController::bannerView:didAutoRefreshWithPlacement:%@ with extra: %@", placementID,extra);

    [self handleAdjustRevenueReport:extra];
}

3.2.5 Native Advertising

 -(void) didShowNativeAdInAdView:(ATNativeADView*)adView placementID:(NSString*)placementID extra:(NSDictionary *)extra{
    NSLog(@"ATNativeViewController:: didShowNativeAdInAdView:placementID:%@ with extra: %@", placementID,extra);

    [self handleAppsFlyerRevenueReport:extra];
}

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)handleFirebaseRevenueReport:(NSDictionary *)extra {
     
    // 广告平台 Id
    NSInteger network_firm_id = [[extra valueForKey:@"network_firm_id"] integerValue];
    // 是否竞价广告源
    BOOL adsource_isheaderbidding = [[extra valueForKey:@"adsource_isheaderbidding"] boolValue];
    
    // 使用Firebase与AdMob关联集成时,Admob的非竞价源不需要上报
    if (network_firm_id == 2 && adsource_isheaderbidding == 0) return;

    // 对精度要求较高的开发者需自行进行转换
    double price = [extra[@"publisher_revenue"] doubleValue];
    NSString *currency = extra[@"currency"];
    NSString *country = extra[@"country"];
    
    // 相关事件参数根据需求按平台要求自行添加
    [FIRAnalytics logEventWithName:kFIREventAdImpression
                        parameters: @{
        kFIRParameterCurrency: currency,
        kFIRParameterValue: @(price)
    }]; 
}

3.3.1 Splash Screen Ads

 - (void)splashDidShowForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATSplashViewController::splashDidShowForPlacementID:%@", extra);
    
    [self handleFirebaseRevenueReport:extra];
}

3.3.2 Incentive Video

 -(void) rewardedVideoDidStartPlayingForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATRewardedVideoViewController::rewardedVideoDidStartPlayingForPlacementID:%@ extra:%@", placementID, extra);
 
    [self handleFirebaseRevenueReport:extra];
}

3.3.3 Interstitial Ads

 -(void) interstitialDidShowForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
     NSLog(@"ATInterstitialViewController::interstitialDidShowForPlacementID:%@ extra:%@", placementID, extra);
     
     [self handleFirebaseRevenueReport:extra];
}

3.3.4 Banner Ads

We use Firebase to report revenue data in the banner ad display agent callback:

 - (void)bannerView:(ATBannerView*)bannerView didShowAdWithPlacementID:(NSString*)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATBannerViewController::bannerView:didShowAdWithPlacementID:%@ with extra: %@", placementID,extra);
    
    [self handleFirebaseRevenueReport:extra];
}

If the automatic refresh function is enabled, you also need to report it in the automatic refresh callback

 - (void)bannerView:(ATBannerView*)bannerView didAutoRefreshWithPlacement:(NSString*)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATBannerViewController::bannerView:didAutoRefreshWithPlacement:%@ with extra: %@", placementID,extra);
 
    [self handleFirebaseRevenueReport:extra];
}

3.3.5 Native Advertising

 !#twenty one@!

Previous
Third-party revenue feedback(SDK v6.4.12 or above)
Next
Filter cross-promotion apps
Last modified: 2025-07-28Powered by