Interstitial

Introduction

Interstitials are static or video ads presented before, during or after the user interacts with your app.
The user can view and then immediately dismiss them. This is a non-rewarded format for the user.

The supports both static and video interstitials.

Important

The speed and stability of users internet connections may vary. It is highly recommended to fetch as much in advance of showing an ad as possible. This helps to ensure that all necessary assets are downloaded. For example, you may want to fetch an ad when a level starts, or after a previous ad has been shown.

Making the Request

Below is an example of making a request for an Intersitial.

#import <FarBidSDK/FarBid.h>
 
FYBInterstitial.delegate = [[MyInterstitialDelegate alloc] init];
NSString *placementId = @"1234";
[FYBInterstitial request:placementId];
FYBInterstitial.delegate = MyInterstitialDelegate()
let placementId = "1234"
FYBInterstitial.request(placementId)

Adding Callbacks

The callback code below is required for the SDK to properly track the activity of your ad

#import <FairBidSDK/FairBid.h> 
 
@interface MyInterstitialDelegate : NSObject <FYBInterstitialDelegate>
 
@end
 
@implementation MyInterstitialDelegate
 
- (void)interstitialIsAvailable:(NSString *)placementId {
//    Called when an Interstitial from placement becomes available
}
 
- (void)interstitialIsUnavailable:(NSString *)placementId {
//    Called when an Interstitial from placement becomes unavailable
}
 
- (void)interstitialDidShow:(NSString *)placementId impressionData:(FYBImpressionData *)impressionData {
//    Called when an Interstitial from placement shows up. In case the ad is a video, audio play will start here.
}
 
- (void)interstitialDidFailToShow:(NSString *)placementId withError:(NSError *)error impressionData:(FYBImpressionData *)impressionData {
//    Called when an error arises when showing an Interstitial from placement
}
 
- (void)interstitialDidClick:(NSString *)placementId {
//    Called when an Interstitial from placement is clicked
}
 
- (void)interstitialDidDismiss:(NSString *)placementId {
//    Called when an Interstitial from placement hides. In case the ad is a video, audio play will stop here.
}
 
- (void)interstitialWillRequest:(NSString *)placementId {
//    Called when an Interstitial is going to be requested.
}
 
@end
class MyInterstitialDelegate: NSObject, FYBInterstitialDelegate {
    
    func interstitialIsAvailable(_ placementId: String) {}
    
    func interstitialIsUnavailable(_ placementId: String) {}
    
    func interstitialDidShow(_ placementId: String, impressionData: FYBImpressionData) {}
    
    func interstitialDidFail(toShow placementId: String, withError error: Error, impressionData: FYBImpressionData) {}
    
    func interstitialDidClick(_ placementId: String) {}
    
    func interstitialDidDismiss(_ placementId: String) {}
  
    func interstitialWillRequest(_ placementId: String) {}

}

Example showing an ad

The following example checks to see if a is available and if it is, uses the show request to display the ad.

NSString *placementId = @"1234";
if ([FYBInterstitial isAvailable:placementId]) {
    [FYBInterstitial show:placementId];
}
 
if ([FYBInterstitial isAvailable:placementId]) {
    FYBShowOptions *showOptions = [FYBShowOptions new];
    showOptions.viewController = self.myViewController;
    [FYBInterstitial show:placementId options:showOptions];
}
let placementId = "1234"
if (FYBInterstitial.isAvailable(placementId)) {
    FYBInterstitial.show("placementId")
}
if (FYBInterstitial.isAvailable(placementId)) {
    let showOptions = FYBShowOptions()
    showOptions.viewController = self.myViewController
    FYBInterstitial.show(placementId, options: showOptions)
}

Stop Requesting An Ad

If a is no longer relevant for your user, you can stop requesting it. Continuous requests for s that are no longer available negatively affect the performance of your .

NSString *placementId = @"1234";
[FYBInterstitial stopRequesting:placementId];
let placementId = "1234"
FYBInterstitial.stopRequesting(placementId)

Important

Use stopRequesting to disable the SDK Auto-Request functionality for a specific placement. If you continue requesting ads for s that are not shown, the performance of your placement can be impacted.


Interstitial


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.