Menu

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

1. Introduction

You can obtain ad-related data through the delegate callbacks of the TopOn SDK and report it to third-party data platforms.

Obtain the corresponding values through the extra field in the delegate callbacks of each ad type. For details, see Callback Information Description.

Property Description
extra@"network\_firm\_id" The ID corresponding to the third-party ad network. Refer to the Network Firm ID Table.
extra@"publisher\_revenue" Obtain the revenue generated by this impression. The unit can be obtained via currency, and the precision can be obtained via precision.
extra@"country" Obtain the country code, e.g., "CN".
extra@"currency" Obtain the currency unit, e.g., "USD".
extra@"network\_placement\_id" The ad ID of the third-party ad network.
extra@"adunit\_id" Obtain the TopOn placement ID.

2. Reporting Timing

If you have already authorized the monetization revenue data of other ad networks in the reporting dashboard, and the data now being reported also includes that ad network, you must first disable the authorization of these platforms in the reporting dashboard, and then connect using the reported revenue data; otherwise, duplicate data will be generated.

We recommend reporting revenue data in the ad display callback delegate:

Ad Type API Description
Splash Ad splashDidShowForPlacementID: extra: Splash ad display successful
Rewarded Video rewardedVideoDidStartPlayingForPlacementID: extra: Rewarded Video ad playback started, i.e., Rewarded Video impression callback
Interstitial Ad interstitialDidShowForPlacementID: extra: Interstitial ad display successful
Banner Ad bannerView: didShowAdWithPlacementID: extra: BannerView display successful
Banner Ad bannerView: didAutoRefreshWithPlacement: extra: BannerView auto-refreshed
Native Ad didShowNativeAdInAdView: placementID: extra: Native ad display successful

Note: Banner ads can be manually refreshed (implemented by the developer) or auto-refreshed (enabled by default in the TopOn dashboard), so revenue data reporting needs to be differentiated:

  • Manual refresh: Only needs to be reported in the display success delegate.
  • Auto-refresh: In addition to reporting in the display success delegate, it also needs to be reported in the Banner auto-refresh delegate. That is, it needs to be reported in both delegates.

3. Platform Integration

3.1 AppsFlyer

It is recommended to write the AppsFlyer related code in a utility class and call it where reporting is needed.

Copy
- (void)handleAppsFlyerRevenueReport:(NSDictionary *)extra {
    
    NSString *unitId = extra[@"network_placement_id"];
    // Developers who require higher precision should perform the conversion themselves
    double price = [extra[@"publisher_revenue"] doubleValue];
    NSString *currency = extra[@"currency"];
    NSString *country = extra[@"country"];
    
    // AppsFlyer provides multiple keys for developers to choose from. Developers should use them according to their own needs. This serves as an example.
    [[AppsFlyerLib shared] logEvent: AFEventPurchase
    withValues:@{
        AFEventParamContentId:unitId,
        AFEventParamRevenue: @(price),
        AFEventParamCurrency:currency,
        AFEventParamCountry:country
    }];
}

We use the AppsFlyer delegate callback in the splash ad display callback to report revenue data:

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

3.1.2 Rewarded Video

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

If the auto-refresh feature is enabled, it also needs to be reported in the auto-refresh callback.

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

    [self handleAppsFlyerRevenueReport:extra];
}
Copy
-(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 write the Adjust related code in a utility class and call it where reporting is needed.

Copy
- (void)handleAdjustRevenueReport:(NSDictionary *)extra {
    
    // Developers who require higher precision should perform the conversion themselves 
    double price = [extra[@"publisher_revenue"] doubleValue]; 
    NSString *currency = extra[@"currency"];
    
    // Source: Revenue source (ADJAdRevenueSourceTaku is only available in Adjust v4.37.1 and above)
    ADJAdRevenue *adRevenue = [[ADJAdRevenue alloc] initWithSource:ADJAdRevenueSourceTaku];
    // pass revenue and currency values
    [adRevenue setRevenue:price currency:currency];
    
    // track ad revenue
    [Adjust trackAdRevenue:adRevenue];
}
Copy
- (void)splashDidShowForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATSplashViewController::splashDidShowForPlacementID:%@", extra);
    
    [self handleAdjustRevenueReport:extra];
}

If the auto-refresh feature is enabled, it also needs to be reported in the auto-refresh callback.

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

    [self handleAdjustRevenueReport:extra];
}
Copy
-(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 write the Firebase related code in a utility class and call it where reporting is needed.

Copy
- (void)handleFirebaseRevenueReport:(NSDictionary *)extra {
     
    // Ad network ID
    NSInteger network_firm_id = [[extra valueForKey:@"network_firm_id"] integerValue];
    // Whether it is a bidding ad source
    BOOL adsource_isheaderbidding = [[extra valueForKey:@"adsource_isheaderbidding"] boolValue];
    
    // When using Firebase integrated with AdMob, non-bidding sources of AdMob do not need to be reported
    if (network_firm_id == 2 && adsource_isheaderbidding == 0) return;

    // Developers who require higher precision should perform the conversion themselves
    double price = [extra[@"publisher_revenue"] doubleValue];
    NSString *currency = extra[@"currency"];
    NSString *country = extra[@"country"];
    
    // Add relevant event parameters as needed according to platform requirements
    [FIRAnalytics logEventWithName:kFIREventAdImpression
                        parameters: @{
        kFIRParameterCurrency: currency,
        kFIRParameterValue: @(price)
    }]; 
}
Copy
- (void)splashDidShowForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATSplashViewController::splashDidShowForPlacementID:%@", extra);
    
    [self handleFirebaseRevenueReport:extra];
}

3.3.2 Rewarded Video

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

We use Firebase to report revenue data in the Banner ad display delegate callback:

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

If the auto-refresh feature is enabled, it also needs to be reported in the auto-refresh callback.

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

    [self handleAppsFlyerRevenueReport:extra];
}

3.2.2 Rewarded Video

Copy
-(void) rewardedVideoDidStartPlayingForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATRewardedVideoViewController::rewardedVideoDidStartPlayingForPlacementID:%@ extra:%@", placementID, extra);
 
    [self handleAdjustRevenueReport:extra];
}
Copy
-(void) interstitialDidShowForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
     NSLog(@"ATInterstitialViewController::interstitialDidShowForPlacementID:%@ extra:%@", placementID, extra);
     
     [self handleAdjustRevenueReport:extra];
}
Copy
- (void)bannerView:(ATBannerView*)bannerView didShowAdWithPlacementID:(NSString*)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATBannerViewController::bannerView:didShowAdWithPlacementID:%@ with extra: %@", placementID,extra);
    
    [self handleAdjustRevenueReport:extra];
}
Previous
Third-party revenue feedback(SDK v6.4.12 or above)
Next
Admob content mapping feature
Last modified: 2026-07-09Powered by