Interstitial Integration for iOS Legacy pre v8.4.0

The ironSource Interstitial is a full-screen ad unit, usually served at natural transition points during the app lifecycle. We support both static and video interstitials. You can also serve interstitials through the ironSource Mediation platform.

Before you start Make sure you have correctly integrated the ironSource SDK into your application. Integration is outlined here. The multiple ad units APIs are available here, supported for SDK 8.4.0+

Step 1. Implement the Delegate

The ironSource SDK fires several events to inform you of Interstitial Activity. The SDK will notify your delegate of all possible events listed below:

+ (void)setLevelPlayInterstitialDelegate:(nullable id<LevelPlayInterstitialDelegate>)delegate;
#pragma mark - LevelPlayInterstitialDelegate
/**
 Called after an interstitial has been loaded
 @param adInfo The info of the ad.
 */
- (void)didLoadWithAdInfo:(ISAdInfo *)adInfo {
}
/**
 Called after an interstitial has attempted to load but failed.
 @param error The reason for the error
 */
- (void)didFailToLoadWithError:(NSError *)error {
}
/**
 Called after an interstitial has been opened. 
 This is the indication for impression. 
 @param adInfo The info of the ad.
 */
- (void)didOpenWithAdInfo:(ISAdInfo *)adInfo {
}
/**
 Called after an interstitial has been dismissed.
 @param adInfo The info of the ad.
 */
- (void)didCloseWithAdInfo:(ISAdInfo *)adInfo {
}
/**
 Called after an interstitial has attempted to show but failed.
 @param error The reason for the error
 @param adInfo The info of the ad.
 */
- (void)didFailToShowWithError:(NSError *)error andAdInfo:(ISAdInfo *)adInfo {
}
/**
 Called after an interstitial has been clicked.
 @param adInfo The info of the ad.
 */
- (void)didClickWithAdInfo:(ISAdInfo *)adInfo {
}
/**
 Called after an interstitial has been displayed on the screen.
 This callback is not supported by all networks, and we recommend using it 
 only if it's supported by all networks you included in your build. 
 @param adInfo The info of the ad.
 */
- (void)didShowWithAdInfo:(ISAdInfo *)adInfo {
}
Note:

Do not assume the callbacks are always running on the main thread. Any UI interaction or updates resulting from ironSource callbacks need to be passed to the main thread before executing.

You can view the full listeners implementation here.

Step 2. Load Interstitial Ad

We recommend requesting an Interstitial Ad a short while before you plan on showing it to your users as the loading process can take some time. We don’t recommend making consecutive requests for an interstitial ad in a short timespan. Numerous requests in a short period of time have no added value as the chance of available inventory within this time is unlikely.

To request an interstitial ad, call the following method:

[IronSource loadInterstitial];
IronSource.loadInterstitial()
Note: If you’d like to serve several Interstitial Ads in your application, you must repeat this step after you’ve shown and closed the previous Interstitial Ad. Once the interstitialDidClose function is fired, you will be able to load a new Interstitial ad. 

Step 3. Check Ad Availability

After you call the loadInterstitial in Step 2, you will be notified when the ad is loaded through the delegate with the method didLoadWithAdInfo.

//Called after an interstitial has been loaded
- (void)didLoadWithAdInfo:(ISAdInfo *)adInfo{}
/**
 Called after an interstitial has been loaded
*/
   public func didLoad(with adInfo: ISAdInfo) {
         
    }

Alternatively, you can request the ad availability directly by calling the following function and it will return a true or false boolean:

[IronSource hasInterstitial];
IronSource.hasInterstitial()

Once the Interstitial ad is available you will be able to show the ad to your users. With ironSource’s Ad Placements, you can customize and optimize the Interstitial experience. This tool enables you to present Interstitial ads to your users in different places, i.e. app launch, between levels, etc. You can use the function in the next step to define the exact placement you’d like to show an ad from.

In addition to ironSource’s Ad Placements, you can now configure capping and pacing settings for selected placements. Capping and pacing improve the user experience in your app by limiting the number of ads served within a defined timeframe.

We recommend calling the following to verify if a placement is capped before you serve the Interstitial to your user:

[IronSource isInterstitialCappedForPlacement:placementName];
IronSource.isInterstitialCapped(forPlacement: “placement”)

Navigate to the Ad Placement document for more details.

Step 4. Show Interstitial Ad

Once you receive the interstitialDidLoad callback, you are ready to show an Interstitial Ad to your users. To provide the best experience for your users, make sure to pause any game action, including audio, during the time the ad is displayed.

Invoke the following method to serve an Interstitial ad to your users:

(void)showInterstitialWithViewController:(UIViewController *)viewController;
IronSource.showInterstitial(with: <UIViewController>)

If you’ve set up placements for your Interstitial, call the following method to serve an Interstitial ad in a specific placement:

[IronSource showInterstitialWithViewController:YOUR_VIEWCONTROLLER placement:YOUR_PLACEMENT_NAME]
IronSource.showInterstitial(with: <UIViewController>, placement: <String?>)
Important! Once you’ve successfully completed step 5, you will have shown your user an Interstitial Ad. In the case you want to serve another Interstitial ad, you must repeat Step 2 to request an additional Interstitial.

Done!
You can now deliver ironSource Interstitial Ads through the Interstitial Mediation platform!


What’s Next?
Follow our integration guides to integrate additional Interstitial Ad networks or configure additional ad units: