Integrate Interstitial Ads

To integrate any ad format, you must first have completed the instructions in the basic integration article.

Interstitial ads are full screen ads that cover the interface of your app. They're typically displayed at natural transition points in the flow of your app, such as between activities or during the pause between levels in a game.

Create an Interstitial Ad

  1. To integrate interstitial ads in your iOS app, import VungleAdsSDK and add an instance variable for VungleInterstitial in your ViewController.swift file (or ViewController.h file for Objective-c).
    import UIKit
    import VungleAdsSDK
    class LOInterstitialViewController: UIViewController {
        private var interstitialAd: VungleInterstitial?
  2. Add the following code to your method where you want to prepare the VungleInterstitial instance. To create the VungleInterstitial, you will need a Placement ID.
    self.interstitialAd = VungleInterstitial(placementId: <YOUR_PLACEMENT_ID>)
    self.interstitialAd?.delegate = self

    Note: You must set your ViewController (or any class that declares conformance to VungleInterstitialDelegate) to the delegate property of the VungleInterstitial instance (refer to the Register for Callbacks section below).

Load an Interstitial Ad

  1. Once you create the VungleInterstitial instance, you can load an ad by calling load().
    self.interstitialAd = VungleInterstitial(placementId: <YOUR_PLACEMENT_ID>)
    self.interstitialAd?.delegate = self
  2. Your ViewController (or any class that conforms to VungleInterstitialDelegate) will receive notification of load success or error through delegate callback methods (refer to the Register for Callbacks section below).

Play an Interstitial Ad

  1. Once the interstitial ad is successfully loaded, you can display it by calling present(with: <YOUR_ViewController>).
    self.interstitialAd?.present(with: <YOUR_ViewController>)
  2. During the time the interstitial ad is visible to the user, you can listen for ad lifecycle events through delegate callback methods (refer to the Register for Callbacks section below).
  3. The ad is closed when the user closes it. You do not need to add steps in your code to close it.

Register for Callbacks

To receive notifications for ad events, declare conformance to VungleInterstitialDelegate protocol and implement callback methods. Each of the callback methods is optional, so you only need to implement the methods you want.

extension LOInterstitialViewController: VungleInterstitialDelegate {
    // Ad load events
    func interstitialAdDidLoad(_ interstitial: VungleInterstitial) {
    func interstitialAdDidFailToLoad(_ interstitial: VungleInterstitial, withError: NSError) {

    // Ad Lifecycle Events
    func interstitialAdWillPresent(_ interstitial: VungleInterstitial) {
    func interstitialAdDidPresent(_ interstitial: VungleInterstitial) {
    func interstitialAdDidFailToPresent(_ interstitial: VungleInterstitial, withError: NSError) {
    func interstitialAdDidTrackImpression(_ interstitial: VungleInterstitial) {
    func interstitialAdDidClick(_ interstitial: VungleInterstitial) {
    func interstitialAdWillLeaveApplication(_ interstitial: VungleInterstitial) {
    func interstitialAdWillClose(_ interstitial: VungleInterstitial) {
    func interstitialAdDidClose(_ interstitial: VungleInterstitial) {

Test an Interstitial Ad

You can test an Interstitial ad in one of two ways: by setting your app status to Test Mode so that Vungle can deliver test ads to your app, or by adding a test device to your app so that Vungle can deliver test ads specifically to the test device. Follow the instructions in Test Your Integration: Test Mode and Test Devices.

Additional Resources

Refer to our Interstitial ad examples:


Need further assistance, feel free to reach out to us, we’re here to help!

Was this article helpful?