Interstitial Placements

Interstitial Ads are full screen ads that display over an application’s content. These ads often result in higher eCPM for developers. The best time to use Interstitial Ads is during a natural break in the application flow, such as after completion of a level in a game. Within interstitial ad placements, developers have the option to display interactive video ads. These units often produce the highest eCPM. To ensure a placement is able to receive these ads, speak to a Verizon Media Account Manager.

Integrating Interstitial Placements

To add an interstitial placement to an app, import the required classes, create an interstitial ad factory, load the ad, and then show the ad once it has finished loading.

The following steps illustrate the process:

1. Import the required classes

Import the following into the Android activity or iOS view controller that will trigger the interstitial ad.

//Required Verizon Ads SDK imports for interstitial ads
import com.verizon.ads.ErrorInfo;
import com.verizon.ads.interstitialplacement.InterstitialAd;
import com.verizon.ads.interstitialplacement.InterstitialAdFactory;
//Required Verizon Ads SDK imports for interstitial ads
#import <VerizonAdsInterstitialPlacement/VerizonAdsInterstitialPlacement.h>
//Required Verizon Ads SDK imports for interstitial ads
import VerizonAdsInterstitialPlacement

2. Create an interstitial ad factory

An instance of the interstitial ad factory is required to load an ad. The factory is created once, typically when the app’s view controller or activity is initialized.

//Create interstitial ad factory required to load the ad
interstitialAdFactory = new InterstitialAdFactory(myInterstitialActivity, myPlacementId, myAdFactoryListener);
//Create interstitial ad factory required to load the ad
self.interstitialAdFactory = [[VASInterstitialAdFactory alloc] initWithPlacementId:knterstitialAdPlacementID vasAds:[VASAds sharedInstance] delegate:myAdFactoryDelegate];
//Create interstitial ad factory required to load the ad
self.interstitialAdFactory = VASInterstitialAdFactory(placementId: sampleInterstitialPlacementID, vasAds: VASAds.sharedInstance, delegate: myAdFactoryDelegate)

Interstitial ad factory callbacks

The Interstitial ad factory callbacks communicate events related to ad loading, such as success/failure of an ad load, load/update of the cache. These are implemented as interfaces (Android) or delegates (iOS) and implemented accordingly. Please refer to the API documentation for Android and iOS for a complete list of available callbacks.

//Interstitial ad factory callbacks
@Override
public void onLoaded(InterstitialAdFactory interstitialAdFactory, InterstitialAd interstitialAd) {
    Log.i("InterstitialAdFactory", "Load successful");
    this.interstitialAd = interstitialAd;
}
//etc...
//Interstitial ad factory callbacks
- (void)interstitialAdFactory:(VASInterstitialAdFactory *)adFactory didLoadInterstitialAd:(VASInterstitialAd *)interstitialAd
{
    NSLog(@"Load successful");
    self.interstitialAd = interstitialAd;
}
// etc...
//Interstitial ad factory callbacks
func interstitialAdFactory(_ adFactory: VASInterstitialAdFactory, didLoad interstitialAd: VASInterstitialAd) {
    print("Load successful")
    self.interstitialAd = interstitialAd
}
// etc...

3. Load an ad

Prior to displaying an ad, it must be loaded as seen below.

//Load the interstitial ad
interstitialAdFactory.load(myInterstitialAdListener);
//Load the interstitial ad
[self.interstitialAdFactory load:myAdDelegate];
//Load the interstitial ad
interstitialAdFactory?.load(myAdDelegate)

Interstitial ad callbacks

The Interstitial ad callbacks convey changes in the state of the ad. For example, callbacks are provided for ad display, clicks, failure, etc. Please refer to the API documentation for Android and iOS for complete list of available callbacks.

//Interstitial ad callbacks
@Override
public void onClosed(InterstitialAd interstitialAd) {
  this.interstitialAd = null;
  Log.i(TAG, "Interstitial ad closed");
}
//etc...
//Interstitial ad callbacks
- (void)interstitialAdDidClose:(VASInterstitialAd *)interstitialAd
{
    NSLog(@"Interstitial ad did close");
    self.interstitialAd = nil;
}
// etc...
//Interstitial ad callbacks
func interstitialAdDidClose(_ interstitialAd: VASInterstitialAd) {
    print("Interstitial ad did close")
    self.interstitialAd = nil
}
//etc...

4. Show the ad

After the ad is loaded, it can be shown. Be sure to do so at an appropriate time as interstitial ads take over the entire screen.

//Show the ad
runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (interstitialAd != null) {
                    interstitialAd.show(InterstitialActivity.this);
            }
        }
}
//Show the ad
dispatch_async(dispatch_get_main_queue(), ^{
    [interstitialAd showFromViewController:myViewController];
});
//Show the ad
DispatchQueue.main.async {
    if let ad = interstitialAd {
        ad.show(from: myViewController)
    }
}

For a complete example of implementing an Interstitial Ad within an app, please review the sample application.