Help Center/Details/

Self-rendering interstitial

Introduction

Self-rendering interstitial: The use scene is the natural experience when the application function is interrupted, such as pausing video playback, between game levels. Interstitial ads should not appear suddenly, and should not interfere with the normal process of users using the app, such as app loading, exiting the app, or during the game.

Supported ad sizes:

  • Large picture (Picture with aspect ratio: 1.78)
  • Small image (Picture with aspect ratio: 1.52)
  • Group pictures (three pictures with aspect ratio: 1.52)

Permission

Self-rendering interstitial: Reclaimed and no longer available for creation

Instructions for use

Self-rendering interstitial ads use the BUNativeAd object to call loadAdData to request the ad, and set the BUNativeAdDelegate agent to get the ad-related materials and click callbacks.

Create an ad slot object and request an ad

BUNativeAd

When requesting an ad, you need to pass in the ad slot object. When creating the ad slot object, you must pass in the ad slot ID and the basic ad configuration BUAdSlot, BUSize

Required parameters:

Field Definition Field Name Field Type Remarks
BUAdSlot / / Basic configuration
BUSize / / Request the size of the ad image
slotID Code bit NSString Code bit ID

Use BUAdSlot, BUSize to create basic advertising information, use BUNativeAd to call loadAdData to request ads

 BUSize *imgSize1 = [[BUSize alloc] init];
 imgSize1.width = 1080;
 imgSize1.height = 1920;
 BUAdSlot *slot1 = [[BUAdSlot alloc] init];
 slot1.ID = self.viewModel.slotID;
 slot1.AdType = BUAdSlotAdTypeInterstitial;
 slot1.position = BUAdSlotPositionTop;
 slot1.imgSize = imgSize1;
 slot1.isOriginAd = YES;
 BUNativeAd *nad = [[BUNativeAd alloc] initWithSlot:slot1];
 nad.rootViewController = self;
 nad.delegate = self;
 self.nativeAd = nad;
 [nad loadAdData];

Receive ads loading results

BUNativeAdDelegate

Callback Method Notes
nativeAd: didFailWithError: The returned error code (error) indicates the reason why the ad failed to load. Please refer to the link for details of all error codes. Link
nativeAdDidLoad: Ad loading success callback It is recommended to insert data in this callback method

####BUNativeAdDelegate callback description

Callback Method Notes
nativeAdDidLoad: Callback for successful loading of advertising materials
nativeAd: didFailWithError: The returned error code (error) indicates the reason why the ad failed to load. Please refer to the link for details of all error codes. Link
nativeAdDidBecomeVisible: Ad display callback
nativeAdDidCloseOtherController: interactionType: This callback is called when the ad jumps to another controller and the controller is closed. InteractionType: This parameter can be distinguished from the opened appstore/webpage/video ad details page
nativeAdDidClick:withView: Click callback method
nativeAd: dislikeWithReason: dislike button click callback, you need to process the response data in this callback method

By setting BUNativeAdDelegate agent, get callbacks such as advertisement closing. For other proxy methods, please refer to the BUDNativeInterstitialViewController class in Demo

Self-rendering Interstitial Video Ads Get Data Assignment Timing

-(void)nativeAdDidLoad:(BUNativeAd *)nativeAd {
    if (!nativeAd.data) {return;}
    if (nativeAd.data.imageAry.count) {
        self.titleLable.text = nativeAd.data.AdTitle;
        
        BUImage *adImage = nativeAd.data.imageAry.firstObject;
        CGFloat contentWidth = CGRectGetWidth(self.view.bounds)-2*leftEdge-2*5;
        CGFloat imageViewHeight = contentWidth * adImage.height/ adImage.width;
        self.interstitialAdView.frame = CGRectMake(5, titleHeight, contentWidth, imageViewHeight);
        [self layoutViewsWithimageViewHeight:imageViewHeight];
        
        if (adImage.imageURL.length) {
            [self.interstitialAdView setImageWithURL:[NSURL URLWithString:adImage.imageURL] placeholderImage:nil];
        }
        
        self.describeLable.frame = CGRectMake(13, self.interstitialAdView.bottom + 5, self.describeLable.width, self.describeLable.height);
        self.describeLable.text = nativeAd.data.AdDescription;
        
        self.dowloadButton.frame = CGRectMake((self.whiteBackgroundView.width-self.dowloadButton.width)/2, self.describeLable.bottom + 5, self.dowloadButton.width, self.dowloadButton.height);
        [self.dowloadButton setTitle:nativeAd.data.buttonText forState:UIControlStateNormal];
        
        [self.nativeAd registerContainer:self.whiteBackgroundView withClickableViews:@[self.titleLable,self.interstitialAdView,self.describeLable,self.dowloadButton]];
        [self.relatedView refreshData:nativeAd];
        
        [self addAccessibilityIdentifier];
    }
}

Precautions

  1. After obtaining the relevant advertisement information assignment in the material loading success method, you need to call registerContainer:withClickableViews:clickableViews to register the bound clickable View** and refresh the data source refreshData**:.
  2. After each material information is obtained need to refresh to call refreshData: method
Did the content solve your problem?
Contact us