-
Notifications
You must be signed in to change notification settings - Fork 4
Interstitial Ad object
⚡ Before you start
Make sure you have correctly initialized Mediation Manager via Script or Unity Editor.
Implementation by UnityEditor | Script C#
- Add an InterstitialAdObject to the scene
- Load Ad callbacks
- Content callbacks
- Unity Events sample
- Use InterstitialAdObject from script
- Some best practices
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 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 Unity app.
- Add an GameObject to your scene using
GameObject > Create Empty
in the Unity Editor. - Add Component
CleverAdsSolutions/Interstitial Ad Object
in the inspector to new GameObject. - Select Manager ID from settings asset for each runtime platform.
- Invoke
Present()
method to show the interstitial ad.
Note
An InterstitialAdObject does not have any rendered components. Therefore, you can place the GameObject anywhere in the scene.
-
On Ad Loaded
The event is invoked when the interstitial ad has finished loading. -
On Ad Failed To Load
The event is invoked when the interstitial ad fails to load. The Message parameter describes the type of failure that occurred.
-
On Ad Failed To Show
The event is invoked when the interstitial ad failed to show. The Message parameter describes the type of failure that occurred. -
On Ad Shown
The event is invoked when the interstitial ad is shown. -
On Ad Clicked
The event is invoked when the user clicks on the interstitial ad. -
On Ad Impression
The event is invoked when the ad count impression with Impression Level Data andAdMetaData
. -
On Ad Closed
The event is invoked when the interstitial ad is closed.
You can implement functions that correspond to ad callbacks. For example, if you want to handle when a interstitial ad fails to show:
- Create a function compatible with the ad callback in custom component.
public void OnInterstitialAdFailedToShow(string reason) {
Debug.Log("Interstitial ad failed to show: " + reason);
}
- Attach the script which contains the above function to any GameObject in the scene.
- Click the + button, then drag & drop the GameObject that you've attached the script to.
- Select the function that you want to link to the ad callback. For the parameterized ad callbacks, select the function to accept the dynamic variable so you can get the parameter value from the SDK.
Get the interstitial ad instance from the script:
InterstitialAdObject interstitial = adObject.GetComponent<InterstitialAdObject>();
Show the interstitial ad:
interstitial.Present();
-
Consider whether interstitial ads are the right type of ad for your app.
Interstitial ads work best in apps with natural transition points. The conclusion of a task within an app, such as sharing an image or completing a game level, creates such a point. Because the user is expecting a break in the action, it's easy to present an interstitial ad without disrupting their experience. Make sure you consider at which points in your app's workflow you'll display interstitial ads and how the user is likely to respond. -
Remember to pause the action when displaying an interstitial ad.
There are a number of different types of interstitial ads: text, image, video, and more. It's important to make sure that when your app displays an interstitial ad, it also suspends its use of some resources to allow the ad to take advantage of them. For example, when you make the call to display an interstitial ad, be sure to pause any audio output being produced by your app. You can resume playing sounds in theOnInterstitialAdClosed
event handler, which will be invoked when the user has finished interacting with the ad. In addition, consider temporarily halting any intense computation tasks (such as a game loop) while the ad is being displayed. This will make sure the user doesn't experience slow or unresponsive graphics or stuttered video. -
Don't flood the user with ads.
While increasing the frequency of interstitial ads in your app might seem like a great way to increase revenue, it can also degrade the user experience and lower clickthrough rates. Make sure that users aren't so frequently interrupted that they're no longer able to enjoy the use of your app.
🔗 Done! What’s Next?
- Follow our integration guides and implement our Ad Units:
- Read more about Impression level data.
- Project Setup
- Configuring SDK
- Include Android
- Include iOS
- Additional mediation steps
- App-ads.txt🔗