Skip to main content
danger
iOS SDK 3.1.3 is outdated. The most recent stable version is here.
Version: 3.1.3

Interstitial

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

Both ad types are requested when caching, the one shown being the more expensive of the two.

Static interstitial - static full-screen banners.

Video interstitial - videos that can be closed 5 seconds after the start.

You can use our demo app as a reference project.

Demo App

Check If Ad Is Loaded

You can check if the ad has been loaded before showing it. This method returns a boolean value indicating whether or not the interstitial has been loaded.

Appodeal.isReadyForShow(with: .interstitial)

We recommend you to check ad caching before trying to show it.

Display

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

Manual Caching

By default, auto caching is enabled: Appodeal SDK starts to load Interstitial right after the initialization method is called.

The next interstitial ad starts to load after the previous one has been closed.

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

Appodeal.setAutocache(false, types: .interstitial)

To cache an interstitial, use:

Appodeal.cacheAd(.interstitial)

Read more on manual caching in our FAQ.

Callbacks

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(){

}
}
tip

All callbacks are called on the main thread.

Placements

Appodeal SDK allows you to tag each impression with different placement. To be able to use placements, you need to create them in Appodeal Dashboard. Read more about placements.

Appodeal.showAd(.interstitial, forPlacement: placement, rootViewController: self)

If the loaded ad can't be shown in a specific placement, nothing will be shown. If auto caching is enabled, the 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 a placement that does not exist, the impression will be tagged with 'default' placement with corresponding settings applied.

Important!

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

Get Predicted eCPM

This method returns the expected eCPM for the cached ad. The amount is calculated based on historical data for the current ad unit.

Appodeal.predictedEcpm(for: .interstitial)

Check If Ad Is Initialized

Appodeal.predictedEcpm(for: .interstitial)

Returns true if interstitial was initialized.

Check If Autocache Is Enabled

Appodeal.isAutocacheEnabled(.interstitial)

Returns true if autocache is enabled for interstitial.