Interstitial

Before You Start

Before integrating ads unit in your app, you must:

  • In the OpenMediation UI, create an application and create an ad placement. You can follow guides here.
  • Follow our steps to iOS SDK Integration by integrating the OpenMediation SDK into your project.
  • If you use mediation, go to Add Mediation Networks and make sure you have added the ad networks' SDKs and the corresponding adapters you wish to work with in your app.

Interstitial 

The OpenMediation Interstitial Ad is a full-screen ad unit, usually served at natural transition points during an app's lifecycle. We support both static and video interstitials.

Step 1. Add the Delegate

The OpenMediation SDK fires several events to inform you of Ad activity. To show Ad to your user, you need to setup its Delegate before loading the ads to receive Ad status. The following snippets demonstrates how to configure Delegate for OMInterstitial object and implement the OMInterstitialDelegate to receive Ad events.

1. Add the following code to add your Delegate to OMInterstitial object and register to the receive events. The SDK will notify the Delegate of all possible events listed in section 2 below.

Note: Here we use "self" which means the callback function is implemented in the current object.

[[OMInterstitial sharedInstance] addDelegate:self];
OMInterstitial.sharedInstance().add(self) 

2. Implement the following callback function in your code to process ad logic when receive the activity of your ad. For example invoke show function to serve Ad to your users when the Interstitial Ad is ready. 

/// Invoked when interstitial video is available.
- (void)omInterstitialChangedAvailability:(BOOL)available{
     if(available){
       NSLog(@"InterstitialAd is Available");
     }
}

/// Sent immediately when a interstitial video is opened.
- (void)omInterstitialDidOpen:(OMScene *)scene{
     NSLog(@"InterstitialAd is Open");
}

/// Sent immediately when a interstitial video starts to play.
- (void)OMInterstitialDidShow:(OMScene *)scene{
     NSLog(@"InterstitialAd Start Play");
}

/// Sent after a interstitial video has been clicked.
- (void)omInterstitialDidClick:(OMScene *)scene{
     NSLog(@"InterstitialAd Did Click");
}

/// Sent after a interstitial video has been closed.
- (void)omInterstitialDidClose:(OMScene *)scene{
     NSLog(@"InterstitialAd Did Close");
}

/// Sent after a interstitial video has failed to play.
- (void)OMInterstitialDidFailToShow:(OMScene *)scene withError:(NSError *)error{
     NSLog(@"InterstitialAd failed to play");
}
/// Invoked when interstitial video is available.
func omInterstitialChangedAvailability(_ available: Bool) {
    if available {
         print("InterstitialAd is Available")
    }
 }

 /// Sent immediately when a interstitial video is opened.
func omInterstitialDidOpen(_ scene: OMScene) {
      print(@"InterstitialAd is Open")
 }

 /// Sent immediately when a interstitial video starts to play.
func omInterstitialDidShow(_ scene: OMScene) {
      print(@"InterstitialAd Start Play")
}

 /// Sent after a interstitial video has been clicked.
func omInterstitialDidClick(_ scene: OMScene) {
      print(@"InterstitialAd Did Click")
 }

 /// Sent after a interstitial video has been closed.
func OMInterstitialDidClose(_ scene: OMScene) {
      print(@"InterstitialAd Did Close")
 }

 /// Sent after a interstitial video has failed to play.
func omInterstitialDidFail(toShow scene: OMScene, withError error: Error) {
      print(@"InterstitialAd failed to play")
 }

 

Step 2. Check Ad Availability (Optional)

Ad Availability

OpenMediation SDK automatic loads ads for you to cache the Rewared Video Ads during the application's lifecycle if only SDK is integrated and initiated successfully. By correctly implementing the OMInterstitialDelegate, you will be notified about the ad availability through the OMInterstitialChangedAvailability callback.

- (void)omInterstitialChangedAvailability:(BOOL)available{
    if(available){
       NSLog(@"InterstitialAd is Available");
    }
}
func omInterstitialChangedAvailability(_ available: Bool) {
    if available {
       print("InterstitialAd is Available")
    }
 }

 

Another way to check if the ad is avalible is by calling the isReady function directly. After you call the Add the Delegate in Step 1, you will be notified whether the Interstitial Ad is ready to show through the isReady method.

/// Check Interstitial video is Ready.
[[OMInterstitial sharedInstance] isReady];
OMInterstitial.sharedInstance().isReady()

 

Step 3. Show a Interstitial Ad

We strongly recommend checking the ad's availibility by calling the isReady method before you serve Interstitial Video Ads, as shown in the following code:

 if ([[OMInterstitial sharedInstance] isReady]) {
     [[OMInterstitial sharedInstance] showWithViewController:@"VIEW_CONTROLLER" scene:@"YOUR_SCENE_NAME"];
}
if OMInterstitial.sharedInstance().isReady() {
    OMInterstitial.sharedInstance().show(with: "VIEW_CONTROLLER", scene: "YOUR_SCENE_NAME")
}

Scene is a new concept being introduced for rewarded video and interstitial ads. It is used to represent different ad scenarios in your app.

You can use Scene-based frequency control, user rewards and data statistic etc. Go to OpenMediation UI to create multiple Scenes in Settings of Placement.

Notes: Scene is optional,if you don't want to use it just ignore the sceneName parameter or use value " ".

 

Step 4. Capping and Pacing (Optional)

You can use scene capping and pacing to improve your app's user experience by limiting the amount of ads served within a defined time frame.  You can configure capping and pacing settings for selected scenes in placement setting.

Important! To ensure you don't show the Interstitial Video button to prompt the user to watch an ad when the placement is capped, you must call the following method to verify if a specific placement has reached its ad limit.

/// Indicates whether the scene has reached the display frequency.
[[OMInterstitial sharedInstance] isCappedForScene:@"YOUR_SCENE_NAME"];
OMInterstitial.sharedInstance().isCapped(forScene:"YOUR_SCENE_NAME")
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.