# iOS > Integration guides > Interstitial

Source: https://help-display-sdk.equativ.com/ios/integration/interstitial.html

This page explains how to use the **Equativ Display SDK** to display an interstitial ad in your application.

---

## Overview

Interstitials are loaded and displayed using a SASInterstitialManager instance.

To load and display an ad using an interstitial manager, you will need:

* An fully configured **Equativ Display SDK**.
* An instance of [`SASAdPlacement`](https://help-display-sdk.equativ.com/ios/API/Classes/SASAdPlacement.html), that will be used to perform ad calls to the delivery engine.
* An instance of [`SASInterstitialManager`](https://help-display-sdk.equativ.com/ios/API/Classes/SASInterstitialManager.html), that will load and show the interstitial.
* A view controller implementing the [`SASInterstitialManagerDelegate`](https://help-display-sdk.equativ.com/ios/API/Protocols/SASInterstitialManagerDelegate.html) protocol.

The next sections describe the whole process to load and show an interstitial.

You can also refer to the [samples](https://github.com/smartadserver/equativ-display-sdk-samples-ios) if you just want to copy/paste the complete integration.

## Importing the SDK

Before using the SDK, you must import the framework:

``` swift
import SASDisplayKit
```

## Configuring the SDK

The SDK needs to be configured before making any ad calls. You will have to call the method [`configure()`](https://help-display-sdk.equativ.com/ios/API/Classes/SASConfiguration.html#/c:objc(cs)SASConfiguration(im)configure) of [`SASConfiguration`](https://help-display-sdk.equativ.com/ios/API/Classes/SASConfiguration.html) shared instance to do so.

This method should be called as soon as possible. A good place to do it is in your application's delegate, in the `application(_:didFinishLaunchingWithOptions:)` method.

``` swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
  // ...

  // Configuring the SDK
  SASConfiguration.shared.configure()

  // ...
}
```

Note that any ad call performed before calling the [`configure()`](https://help-display-sdk.equativ.com/ios/API/Classes/SASConfiguration.html#/c:objc(cs)SASConfiguration(im)configure) method will fail.

## Creating a placement

You will need an _ad placement_ to perform an ad call.

Creating an ad placement is done by instantiating a [`SASAdPlacement`](https://help-display-sdk.equativ.com/ios/API/Classes/SASAdPlacement.html) object using a _site ID_, a _page ID_ and a _format ID_. You can also provide some additional information, like targeting informations (more information in the [API documentation](https://help-display-sdk.equativ.com/ios/API/Classes/SASAdPlacement.html)).

``` swift
let adPlacement = SASAdPlacement(siteId: SOME_SITE_ID, pageId: SOME_PAGE_ID, formatId: SOME_FORMAT_ID)
```

> You can add several information to your _ad placements_ in order to **increase the monetization**.
>
> For instance you can provide a [_Seller Defined Audience_](https://help-display-sdk.equativ.com/sellerdefinedaudience.html.md) object, or a [_Supply Chain Object_](https://help-display-sdk.equativ.com/ios/API/Classes/SASAdPlacement.html#/c:objc(cs)SASAdPlacement(py)supplyChainObjectString) if your are an inventory reseller.

For testing purposes, it is possible to instantiate generic ad placements that will always deliver an ad of a particular format. This is done by using the [`SASAdPlacement(testAd:)`](https://help-display-sdk.equativ.com/ios/API/Classes/SASAdPlacement.html#/c:objc(cs)SASAdPlacement(im)initWithTestAd:) initializer (check the [`SASAdPlacementTest`](https://help-display-sdk.equativ.com/ios/API/Enums/SASAdPlacementTest.html) enum for an exhaustive list of the formats you can get using test placements).

Don't forget to remove all test placements before releasing your app!

## Loading an interstitial using a manager

Interstitials ads are managed using an _interstitial manager_ which will first **load** the ad then **show** it when you want.

To load an interstitial, start by creating a new [`SASInterstitialManager`](https://help-display-sdk.equativ.com/ios/API/Classes/SASInterstitialManager.html) instance using the ad placement defined earlier. You can also set a delegate implementing the [`SASInterstitialManagerDelegate`](https://help-display-sdk.equativ.com/ios/API/Protocols/SASInterstitialManagerDelegate.html) protocol:

``` swift
let interstitialManager = SASInterstitialManager(adPlacement: adPlacement)
interstitialManager.delegate = self
```

Here are the [`SASInterstitialManagerDelegate`](https://help-display-sdk.equativ.com/ios/API/Protocols/SASInterstitialManagerDelegate.html) methods to implement:

``` swift
func interstitialManager(_ interstitialManager: SASInterstitialManager, didLoadWith adInfo: SASAdInfo) {
    print("Interstitial ad loaded with info: \(adInfo)")
}

func interstitialManager(_ interstitialManager: SASInterstitialManager, didFailToLoad error: Error) {
    print("Interstitial did fail to load with error: \(error)")
}

func interstitialManagerDidShow(_ interstitialManager: SASInterstitialManager) {
    print("Interstitial ad was shown")
}

func interstitialManager(_ interstitialManager: SASInterstitialManager, didFailToShow error: Error) {
    print("Interstitial did fail to show with error: \(error)")
}

func interstitialManagerDidClose(_ interstitialManager: SASInterstitialManager) {
    print("Interstitial ad was closed")
}
```

Most methods of the delegate are optional, but you should at least implement the two
methods [`interstitialManager(_:didLoadWith:)`](https://help-display-sdk.equativ.com/ios/API/Protocols/SASInterstitialManagerDelegate.html#/c:objc(pl)SASInterstitialManagerDelegate(im)interstitialManager:didLoadWithInfo:) and [`interstitialManager(_:didFailToLoad:)`](https://help-display-sdk.equativ.com/ios/API/Protocols/SASInterstitialManagerDelegate.html#/c:objc(pl)SASInterstitialManagerDelegate(im)interstitialManager:didFailToLoadWithError:) used to check if an interstitial ad has been loaded or if it has failed to load.

Finally to actually trigger the interstitial ad loading process call the [`loadAd()`](https://help-display-sdk.equativ.com/ios/API/Classes/SASInterstitialManager.html#/c:objc(cs)SASInterstitialManager(im)loadAd) method of the [`SASInterstitialManager`](https://help-display-sdk.equativ.com/ios/API/Classes/SASInterstitialManager.html):

``` swift
interstitialManager.loadAd()
```

## Showing an interstitial

When the _interstitial manager_ has loaded an ad successfully, you can show it when needed using the [`show(from:)`](https://help-display-sdk.equativ.com/ios/API/Classes/SASInterstitialManager.html#/c:objc(cs)SASInterstitialManager(im)showFromViewController:) method.

It is also possible to check the current status of an _interstitial manager_ at any time using the [`adStatus`](https://help-display-sdk.equativ.com/ios/API/Classes/SASInterstitialManager.html#/c:objc(cs)SASInterstitialManager(py)adStatus) property.

``` swift
if interstitialManager.adStatus == .ready {
  interstitialManager.show(from: self)
} else {
  // The interstitial manager's ad is either still loading, or not available.
}
```

Note that the [`show(from:)`](https://help-display-sdk.equativ.com/ios/API/Classes/SASInterstitialManager.html#/c:objc(cs)SASInterstitialManager(im)showFromViewController:) method can fail for several reasons. Use the _interstitial manager delegate_ to check the result of your call to this method.

When an interstitial has been shown, it is discarded and a **new one must be loaded** (the same _interstitial manager_ can be reused if the _ad placement_ is identical).

## Listening to ad audio events

You can listen to ad audio events by implementing the [`SASInterstitialManagerDelegate`](https://help-display-sdk.equativ.com/ios/API/Protocols/SASInterstitialManagerDelegate.html) protocol.

``` swift
let interstitialManager = SASInterstitialManager(adPlacement: adPlacement)
interstitialManager.delegate = self
```

The two optional delegate methods related to ad audio are:

``` swift
func interstitialManagerWillStartAudioPlayback(_ interstitialManager: SASInterstitialManager) {
    print("Interstitial video ad will start to play audio")

    // Equativ Display SDK is notifying your app that it will play audio. You could optionally
    // pause music and/or manipulate your audio session category depending on your apps design.
}

func interstitialManagerDidStopAudioPlayback(_ interstitialManager: SASInterstitialManager) {
    print("Interstitial video ad did stop to play audio")

    // Equativ Display SDK is notifying your app that it has stopped playing audio. Depending 
    // on your apps design, you could resume music here and/or restore your audio session category.
}
```

> * The SDK does not modify the app’s audio session category, so the app should handle it within the delegate methods.
> * All video ads start muted and require user interaction to toggle audio.
> * Developers should ensure that any changes to the audio session category are reverted in the `dealloc` of the **ViewController**, because the `interstitialManagerDidStopAudioPlayback` delegate method will not be called if the banner view is deallocated before the end of the ad.
