App Open Ads - cleveradssolutions/CAS-ReactNative GitHub Wiki
:zap: Before you start
Make sure you have correctly Initialize CAS.
- Load an ad
- Handle fullscreen callback events
- Check the ad availability
- Show the ad
- Cold starts and loading screens
- Best practices
- Sample use case
This guide is intended for publishers integrating app open ads using the CAS Android SDK.
App open ads are a special ad format intended for publishers wishing to monetize their app load screens. App open ads can be closed at any time, and are designed to be shown when your users bring your app to the foreground.
App open ads automatically show a small branding area so users know they're in your app.
More details are described in the Google Mobile Ads manual.
Pros compared to Interstitial ads:
- Much faster ad loading.
- End user-friendly interface.
Cons:
- Only Google Ads (Admob) is supported.
Load the ad
Manual load Interstitial ads.
manager.loadAppOpenAd(isLandscape: boolean);
You can get a callback for the successful loading of the ads:
manager.addListener(MediationManagerEvent.AdLoaded, (e) => {
// e contains ad type
});
manager.addListener(MediationManagerEvent.AdFailedToLoad, (e) => {
// e contains ad type and error
});
⚠️ Attempting to load a new ad from the MediationManagerEvent.AdFailedToLoad
event listener is strongly discouraged. If you must load an ad from this callback, limit ad load retries to avoid continuous failed ad requests in situations such as limited network connectivity.
Check the ad availability
You can ask for the ad availability directly by calling the following function:
const adLoaded = appOpenAd.isAppOpenAdAvailable();
Ad Callback
The ShowAdCallbacks
handles events related to displaying your Interstitial ad.
type ShowAdCallbacks = {
onImpression?: (ad: AdImpression) => void;
onShown?: () => void;
onShowFailed?: (message: string) => void;
onClicked?: () => void;
onComplete?: () => void;
onClosed?: () => void;
}
Show the ad
manager.showAppOpenAd(callbacks);
⚠️ Once you’ve successfully call showAppOpenAd()
, you will have shown your user an App Open Ad.
In the case you want to serve another App Open Ad, you must repeat loadAppOpenAd
to request an additional ad.
Cold starts and loading screens
The documentation thus far assumes that you only show app open ads when users foreground your app when it is suspended in memory. "Cold starts" occur when your app is launched but was not previously suspended in memory.
An example of a cold start is when a user opens your app for the first time. With cold starts, you won't have a previously loaded app open ad that's ready to be shown right away. The delay between when you request an ad and receive an ad back can create a situation where users are able to briefly use your app before being surprised by an out of context ad. This should be avoided because it is a bad user experience.
The preferred way to use app open ads on cold starts is to use a loading screen to load your game or app assets, and to only show the ad from the loading screen. If your app has completed loading and has sent the user to the main content of your app, do not show the ad.
In order to continue loading app assets while the app open ad is being displayed, always load assets in a background thread.
Best practices
App open ads help you monetize your app's loading screen, when the app first launches and during app switches, but it's important to keep best practices in mind so that your users enjoy using your app. It's best to:
- Show your first app open ad after your users have used your app a few times.
- Show app open ads during times when your users would otherwise be waiting for your app to load.
- If you have a loading screen under the app open ad, and your loading screen completes loading before the ad is dismissed, you may want to dismiss your loading screen in the
onClosed()
method.
Sample use case
🔗 Done! What’s Next?
- Test Your Integration
- Try another ad format: