Interstitial
Interstitial ads are expansive, full-screen advertisements that overlay an app's interface and persist until they are closed by the user. They are most effective when strategically placed during natural pauses in the app's execution, such as between levels of a game or immediately after the completion of a task.
This document is based on:
Prerequisites
- Complete the Get started guide
Always test with test ads
When developing and testing your Godot apps, it's crucial to use test ads rather than live production ads. Failure to do so can result in the suspension of your AdMob account.
The most straightforward method to load test ads is by utilizing our dedicated test ad unit ID for Android and iOS interstitial:
This particular ad unit ID has been purposefully configured to deliver test ads for every request. You can safely employ it during your coding, testing, and debugging phases. However, remember to replace this test ad unit ID with your own when you are ready to publish your app.
For a more comprehensive understanding of how the Mobile Ads SDK's test ads function, please refer to our documentation on Test Ads.
Interstitial example
The code sample below demonstrates how to utilize the Interstitial. In this example, you'll create an instance of an Interstitial, load an ad into it using an AdRequest, and enhance functionality by handling various life cycle events.
Load an ad
To load an interstitial ad, utilize the InterstitialAdLoader
class. Pass in an InterstitialAdLoadCallback
to receive the loaded ad or any potential errors. It's worth noting that, similar to other format load callbacks, the InterstitialAdLoadCallback
leverages LoadAdError
to provide comprehensive error details.
Configure the FullScreenContentCallback
The FullScreenContentCallback
manages events associated with the display of your InterstitialAd
. Before presenting the InterstitialAd
, ensure that you configure the callback:
Show the ad
Interstitial ads are ideally displayed during organic breaks in the app's progression. Examples include between game levels or after a user accomplishes a task. To present an interstitial ad, employ the show()
function.
Clean up memory
Upon completion of an InterstitialAd
, it's important to invoke the destroy()
function before releasing your reference to it:
This action signals to the plugin that the object is no longer in use and that the memory it occupies can be reclaimed. Neglecting to call this method can lead to memory leaks.
Best Practices for Interstitial Ads
-
Consider Relevance:
- Evaluate whether interstitial ads are suitable for your app.
- Interstitial ads work best in apps with natural transition points, such as task completions or level advancements. Ensure these points align with the user's expectation for a break in the action.
-
Pause App Activity:
- When displaying an interstitial ad, pause relevant app activities to allow the ad to use specific resources effectively.
- For example, suspend audio output when displaying an interstitial ad to enhance the ad experience.
-
Optimize Loading Time:
- Load interstitial ads in advance by calling
InterstitialAdLoader.new().load()
before invokingshow()
. This ensures that your app has a fully loaded interstitial ad ready when it's time to display one.
- Load interstitial ads in advance by calling
-
Avoid Overloading with Ads:
- Refrain from inundating users with excessive interstitial ads.
- An overly frequent ad display can hinder the user experience and reduce clickthrough rates. Strike a balance that allows users to enjoy your app without constant interruptions.
Remember that implementing interstitial ads should enhance, not detract from, the user experience in your app.
Further References
Samples
- Sample Project: A Minimal Illustration of usage of all Ad Formats