Menu

Interstitial video ads

Integration

Ad loading

  • If the ad slot is set to fully automatic loading, do not call ATAdManager (normal ad loading class) loadADWithPlacementID: Method to load ads
  • It is recommended to initialize fully automatic interstitial ads on the main page

Advertising display

  • Before displaying, check whether autoLoadInterstitialReadyForPlacementID: is ready. If it is ready, call the display API to display the ad. If it is not ready, initiate ad loading and wait for the ad to load successfully.
  • Before displaying, you need to first determine whether the current application is in the foreground . If you call the display API in the background, the ad may be displayed outside the application or may not be displayed normally.
  • The fully automatic rewarded video implements automatic loading logic internally, so please avoid directly executing ad display in the didFinishLoadingADWithPlacementID: callback

Loading Ads

 #import <AnyThinkInterstitial/AnyThinkInterstitial.h>

- (void)loadAutoInterstitialAds {
      [ATInterstitialAutoAdManager sharedInstance].delegate = self;
      // Setting the LocalExtra custom parameter will be returned to the Extra of the agent and can be used to match custom rules for the AD space
      [[ATInterstitialAutoAdManager sharedInstance] setLocalExtra:@{} placementID:@"your iv placementID"]; 
      [[ATInterstitialAutoAdManager sharedInstance] addAutoLoadAdPlacementIDArray:@[@"your iv placementID"]];
}

- (void)didFinishLoadingADWithPlacementID:(NSString *)placementID {
    
    BOOL ready = [[ATAdManager sharedManager] rewardedVideoReadyForPlacementID:placementID];
    NSLog(@"didFinishLoadingADWithPlacementID:%@--isReady:%@", placementID, ready ? @"YES":@"NO");
}

- (void)didFailToLoadADWithPlacementID:(NSString*)placementID error:(NSError*)error {
    
    NSLog(@"didFailToLoadADWithPlacementID:%@ errorCode:%ld", placementID, (long)error.code);
}

Notice:

  • For the same ad slot ID, you only need to call the fully automatic loading API once.

Display ads

 - (void)showAd {
    // Determine if the AD is filled before display
    BOOL isReady = [[ATInterstitialAutoAdManager sharedInstance] autoLoadInterstitialReadyForPlacementID:@"your iv placementID"];
    if (isReady) {    
       [ [ATInterstitialAutoAdManager sharedInstance] showAutoLoadInterstitialWithPlacementID:@"your iv placementID" inViewController:self delegate:self];
    }
}

#pragma mark - showing delegate
-(void) interstitialDidShowForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATInterstitialViewController::interstitialDidShowForPlacementID:%@ extra:%@", placementID, extra);
}

-(void) interstitialFailedToShowForPlacementID:(NSString*)placementID error:(NSError*)error extra:(NSDictionary *)extra {
    NSLog(@"ATInterstitialViewController::interstitialFailedToShowForPlacementID:%@ error:%@ extra:%@", placementID, error, extra);
}

-(void) interstitialDidFailToPlayVideoForPlacementID:(NSString*)placementID error:(NSError*)error extra:(NSDictionary*)extra {
    NSLog(@"ATInterstitialViewController::interstitialDidFailToPlayVideoForPlacementID:%@ error:%@ extra:%@", placementID, error, extra);
}

-(void) interstitialDidStartPlayingVideoForPlacementID:(NSString*)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATInterstitialViewController::interstitialDidStartPlayingVideoForPlacementID:%@ extra:%@", placementID, extra);
}

-(void) interstitialDidEndPlayingVideoForPlacementID:(NSString*)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATInterstitialViewController::interstitialDidEndPlayingVideoForPlacementID:%@ extra:%@", placementID, extra);
}

-(void) interstitialDidCloseForPlacementID:(NSString*)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATInterstitialViewController::interstitialDidCloseForPlacementID:%@ extra:%@", placementID, extra);
}

-(void) interstitialDidClickForPlacementID:(NSString*)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATInterstitialViewController::interstitialDidClickForPlacementID:%@ extra:%@", placementID, extra);
}

- (void)interstitialDeepLinkOrJumpForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra result:(BOOL)success {
    NSLog(@"ATInterstitialViewController:: interstitialDeepLinkOrJumpForPlacementID:placementID:%@ with extra: %@, success:%@", placementID,extra, success ? @"YES" : @"NO");
}

API Description

ATInterstitialAutoAdManager

Automatic loading of interstitial ads management class

method illustrate
sharedInstance Get the ATInterstitialAutoAdManager singleton object
delegate Set the proxy object for automatic interstitial loading
addAutoLoadAdPlacementIDArray: Add ad slots that need to be loaded automatically
placementIds: The ad placement ID array needs to be loaded automatically
setLocalExtra: placementID: Set local parameters for the specified ad slot
placementId: Ad position ID
localExtra: local parameters, key can refer to: Documentation

removeAutoLoadAdPlacementIDArray:

Remove the ad slots that need to be loaded automatically
placementIds: The ad placement ID array needs to be loaded automatically
autoLoadRewardedVideoReadyForPlacementID: Determine whether there is an ad that can be displayed in the ad slot
placementId: The ad placement ID to be queried
showAutoLoadRewardedVideoWithPlacementID:
inViewController:delegate:
Display rewarded video ads in this ad slot
placementId: The ID of the ad slot to be displayed
inViewController: the viewController that displays the ad
delegate: proxy object
showAutoLoadRewardedVideoWithPlacementID: scene: inViewController: delegate: Pass in the scene ID to display the rewarded video ad in this ad slot
placementId: The ID of the ad slot to be displayed
scene: scene id, can be empty if no scene distinction is made
inViewController: the viewController that displays the ad
delegate: proxy object
entryAdScenarioWithPlacementID:scenarioID: The corresponding ad slot enters the business scenario cache status statistics
placementId: ad slot Id
scenario: ad display scenario, which can be created from the background.
For details about the usage of scenario parameters, refer to the business scenario cache status statistics

checkValidAdCachesWithPlacementID:

Query all cached information of the ad slot. The first entry in the array is the ad data to be displayed.
placementId: The ad placement ID to be queried
Reference documentation for each element parameter

ATAdLoadingDelegate

The following are the ad event callbacks at the ad slot level , indicating the final status of the load. For ad source level agents, please refer to the documentation

method illustrate
didFinishLoadingADWithPlacementID: The corresponding ad slot ad is loaded successfully.
placementId: Ad position ID
didFailToLoadADWithPlacementID: error: The corresponding ad slot ad loading failed callback
placementId: Ad position ID
error: Ad loading failure information, see the document for details

ATInterstitialDelegate

Interstitial ad event callbacks, including display, click, and close, etc.

Callback function name Callback function meaning
interstitialDidShowForPlacementID:extra: Interstitial ads displayed successfully
interstitialFailedToShowForPlacementID: extra: Interstitial ad display failed
interstitialDidStartPlayingVideoForPlacementID: extra: Interstitial video ad playback starts
interstitialDidEndPlayingVideoForPlacementID: extra: The interstitial video ad ends
interstitialDidFailToPlayVideoForPlacementID: error: extra: Interstitial video ad failed to play
interstitialDidClickForPlacementID: extra: Interstitial ad clicks
interstitialDidCloseForPlacementID: extra: Interstitial ads turned off
interstitialDeepLinkOrJumpForPlacementID: extra: result: Whether the interstitial ad click jump is in the form of Deeplink. Currently, this is only returned for TopOn Adx ads.
  extra: Extended parameter reference documentation

 

Special Instructions

sigmob 's rewarded video is used as an interstitial (calling Sigmob's rewarded video API). The Sigmob ad source of the TopOn background interstitial ad slot needs to be configured with Sigmob's rewarded video ad slot id.

 // Setting the LocalExtra custom parameter will be returned to the Extra of the agent and can be used to match custom rules for the AD space
NSDictionary *extra = @{kATInterstitialExtraUsesRewardedVideo:@YES};
[[ATInterstitialAutoAdManager sharedInstance] setLocalExtra:extra placementID:@"your iv placementID"]; 
Last modified: 2025-07-28Powered by