Interstitial

Interstitial ads are full-screen advertisements. In Appodeal, they are divided into two types - static interstitial and video interstitial.

Both types of ads are requested in parallel when caching and will be shown to be the most expensive of the two.
static interstitial - static full-screen banners.
video interstitial - these are videos that the user can close 5 seconds after the start of viewing.

1. Manual Caching

By default, auto caching is enabled: Appodeal SDK starts to load Interstitial right away after the initialization method is called. The next interstitial ad starts to load after the previous one was shown.

To disable automatic caching for interstitials, use the code below before the SDK initialization:

Appodeal.setAutocache(false, types: .interstitial)
To cache interstitial use:
Appodeal.cacheAd(.interstitial)
Read more on manual caching in our FAQ.

2. Check if interstitial is loaded

You can check status of loading before showing. This method return  a boolean value indicating whether the interstitial is loaded.

Appodeal.isReadyForShow(with: .interstitial)
We recommend you check caching it before trying to show. 

3. Display interstitial

Appodeal.showAd(AppodealShowStyle.interstitial, rootViewController: self)

4. Interstitial Placements

Appodeal SDK allows you to tag each impression with different placement. For using placements you need to create placements in Appodeal Dashboard.  Read more  about placements.

Appodeal.showAd(.interstitial, forPlacement: placement, rootViewController: self)
If the loaded ad can’t be shown for a specific placement, nothing will be shown. If auto caching is enabled, sdk will start to cache another ad, which can affect display rate. To save the loaded ad for future use (for instance, for another placement) check if the ad can be shown before calling show method:


Appodeal.canShow(.interstitial, forPlacement: placement)
You can configure your impression logic for each placement.

If you have no placements, or call  Appodeal.show  with placement that do not exist, the impression will be tagged with 'default' placement and its settings will be applied.

Important!

Placement settings affect ONLY ad presentation, not loading or caching.

5. Use interstitial callbacks

The callbacks are used to track different events in the lifecycle of an ad, e.g., when an ad was clicked on or closed. To get them, you need to set the delegate as follows:

// set delegate
Appodeal.setInterstitialDelegate(self)
Usually, the class that implements interstitials is also the delegate class. That’s why the delegate property can be set to self.

Now you can use the following callback methods:

extension YourViewController: AppodealInterstitialDelegate {
    // Method called when precache (cheap and fast load) or usual interstitial view did load
    //
    // - Warning: If you want show only expensive ad, ignore this callback call with precache equal to YES
    // - Parameter precache: If precache is YES it's mean that precache loaded
    func interstitialDidLoadAdIsPrecache(_ precache: Bool) {
        
    }

    // Method called if interstitial mediation failed
    func interstitialDidFailToLoadAd() {
        
    }
    
    // Method called if interstitial mediation was success, but ready ad network can't show ad or
    // ad presentation was to frequently according your placement settings
    func interstitialDidFailToPresent() {
        
    }
    
    // Method called when interstitial will display on screen
    func interstitialWillPresent() {
        
    }

    // Method called after interstitial leave screeen
    func interstitialDidDismiss() {
        
    }

    // Method called when user tap on interstitial
    func interstitialDidClick() {
        
    }
    
    // Method called when interstitial did expire and could not be shown
    func interstitialDidExpired(){
        
    }
}

All callbacks are called on the main thread.

6. Get Predicted eCPM

This method return expected eCPM for cached ad. Amount is calculated based on historical data for the current ad unit.

Appodeal.predictedEcpm(for: .interstitial)

7. Check if interstitial was initialized

Appodeal.isInitialized(for: .interstitial)

Returns true, if interstitial was initialized.

8. Check if autocache is enabled for interstitial

Appodeal.isAutocacheEnabled(.interstitial)

Returns true, if autocache is enabled for interstitial.