Page Summary
-
Interstitial ads are full-screen ads displayed at natural transition points in an app.
-
Integrating interstitial ads involves loading an ad, registering for callbacks, and displaying the ad.
-
Always test with test ads using the dedicated test ad unit ID before publishing your app.
-
Use ad load calls to pre-load ads and register for callbacks to handle presentation events.
-
Follow best practices such as pausing app resources, allowing adequate loading time, and avoiding flooding the user with ads.
Interstitial ads are full-screen ads that cover the interface of an app until closed by the user. They're typically displayed at natural transition points in the flow of an app, such as between activities or during the pause between levels in a game. When an app shows an interstitial ad, the user has the choice to either tap on the ad and continue to its destination or close it and return to the app. Case study .
This guide shows you how to integrate interstitial ads into an iOS app.
Prerequisites
- Complete the Get started guide .
Always test with test ads
When building and testing your apps, make sure you use test ads rather than live, production ads. Failure to do so can lead to suspension of your account.
The easiest way to load test ads is to use our dedicated test ad unit ID
for iOS interstitials: /21775744923/example/interstitial
It's been specially configured to return test ads for every request, and you're free to use it in your own apps while coding, testing, and debugging. Just make sure you replace it with your own ad unit ID before publishing your app.
For details on Google Mobile Ads SDK test ads, see Enable test ads .
Implementation
The main steps to integrate interstitial ads are:
- Load an ad.
- Register for callbacks.
- Display the ad.
Load an ad
Loading an ad is accomplished using the load(adUnitID:request)
method on the GAMInterstitialAd
class.
Swift
fileprivate
func
loadInterstitial
()
async
{
do
{
interstitial
=
try
await
AdManagerInterstitialAd
.
load
(
with
:
"/21775744923/example/interstitial"
,
request
:
AdManagerRequest
())
interstitial
?.
fullScreenContentDelegate
=
self
}
catch
{
print
(
"Failed to load interstitial ad with error:
\(
error
.
localizedDescription
)
"
)
}
}
SwiftUI
import
GoogleMobileAds
class
InterstitialViewModel
:
NSObject
,
FullScreenContentDelegate
{
private
var
interstitialAd
:
InterstitialAd
?
func
loadAd
()
async
{
do
{
interstitialAd
=
try
await
InterstitialAd
.
load
(
with
:
"ca-app-pub-3940256099942544/4411468910"
,
request
:
Request
())
interstitialAd
?.
fullScreenContentDelegate
=
self
}
catch
{
print
(
"Failed to load interstitial ad with error:
\(
error
.
localizedDescription
)
"
)
}
}
Objective-C
[
GAMInterstitialAd
loadWithAdManagerAdUnitID
:
@"/21775744923/example/interstitial"
request
:[
GAMRequest
request
]
completionHandler
:
^
(
GAMInterstitialAd
*
ad
,
NSError
*
error
)
{
if
(
error
)
{
NSLog
(
@"Failed to load interstitial ad with error: %@"
,
[
error
localizedDescription
]);
return
;
}
self
.
interstitial
=
ad
;
self
.
interstitial
.
fullScreenContentDelegate
=
self
;
}];
Register for callbacks
In order to receive notifications for presentation events, you must assign the GADFullScreenContentDelegate
to the fullScreenContentDelegate
property of
the returned ad:
Swift
interstitial
?.
fullScreenContentDelegate
=
self
.
swift

