<br />

Interstitial ads are full-screen ads that cover the interface of their host app.
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.

This guide explains how to integrate interstitial ads into a Flutter app.

## 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
interstitials:

- `/21775744923/example/interstitial`

The test ad units are configured to return test ads for every request, and
you're free to use them in your own apps while coding, testing, and debugging.
Just make sure you replace them with your own ad unit IDs before publishing your
app.

### Load an ad

The following example loads an interstitial ad:

```dart
InterstitialAd.load(
  adUnitId: "_adUnitId",
  request: const AdManagerAdRequest(),
  adLoadCallback: InterstitialAdLoadCallback(
    onAdLoaded: (InterstitialAd ad) {
      // Called when an ad is successfully received.
      debugPrint('Ad was loaded.');
      // Keep a reference to the ad so you can show it later.
      _interstitialAd = ad;
    },
    onAdFailedToLoad: (LoadAdError error) {
      // Called when an ad request failed.
      debugPrint('Ad failed to load with error: $error');
    },
  ),
);
```

Replace <var translate="no">_adUnitId</var> with your own ad unit ID.

### Interstitial ad events

Through the use of `FullScreenContentCallback`, you can listen for lifecycle
events, such as when the ad is shown or dismissed. Set
`AdManagerInterstitialAd.fullScreenContentCallback` before showing the ad to receive
notifications for these events. This example implements each method:

```dart
ad.fullScreenContentCallback = FullScreenContentCallback(
  onAdShowedFullScreenContent: (ad) {
    // Called when the ad showed the full screen content.
    debugPrint('Ad showed full screen content.');
  },
  onAdFailedToShowFullScreenContent: (ad, err) {
    // Called when the ad failed to show full screen content.
    debugPrint('Ad failed to show full screen content with error: $err');
    // Dispose the ad here to free resources.
    ad.dispose();
  },
  onAdDismissedFullScreenContent: (ad) {
    // Called when the ad dismissed full screen content.
    debugPrint('Ad was dismissed.');
    // Dispose the ad here to free resources.
    ad.dispose();
  },
  onAdImpression: (ad) {
    // Called when an impression occurs on the ad.
    debugPrint('Ad recorded an impression.');
  },
  onAdClicked: (ad) {
    // Called when a click is recorded for an ad.
    debugPrint('Ad was clicked.');
  },
);
```

## Display an interstitial ad

An `AdManagerInterstitialAd` is displayed as an [`Overlay`](https://api.flutter.dev/flutter/widgets/Overlay-class.html)
on top of all app content and is statically placed; thus, it can't be added to
the Flutter widget tree. You can choose when to show the ad by calling `show()`.

```dart
_interstitialAd?.show();
```

Once `show()` is called, an `Ad` displayed this way can't be dismissed
programmatically and requires user input. An `AdManagerInterstitialAd` can only be shown
once. Subsequent calls to show will trigger `onAdFailedToShowFullScreenContent`.

An ad must be disposed when access to it is no longer needed. The best practice
for when to call `dispose()` is in the
`FullScreenContentCallback.onAdDismissedFullScreenContent` and
`FullScreenContentCallback.onAdFailedToShowFullScreenContent` callbacks.

That's it! Your app is now ready to display interstitial ads.

## Next steps

- See [Interstitial best
  practices](https://www.youtube.com/watch?v=r2RgFD3Apyo&index=5&list=PLOU2XLYxmsIKX0pUJV3uqp6N3NeHwHh0c) and [interstitial ad guidance](https://support.google.com/admob/answer/6066980).
- Check out an [Interstitial ads case
  study](https://admob.google.com/home/resources/freaking-math-powers-revenue-increase-with-google-admob-support/).