-
Notifications
You must be signed in to change notification settings - Fork 0
App Open Ads
- Create an instance
- Load an ad
- Handle fullscreen callback events
- Check the ad availability
- Show the ad
- Detect app foregrounding events
- Cold starts and loading screens
- Best practices
This guide is intended for publishers integrating app open ads using the CAS iOS 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.
Pros compared to Interstitial ads:
- Much faster ad loading.
- End user-friendly interface.
Cons:
- Only Google Ads (Admob) is supported.
You can use one of the following static methods to create App Open Ads:
- A
managerId
is a unique ID number assigned to each of your ad placements when they're created in CAS. If you haven't created an CAS account and registered an app yet, now's a great time to do so at cleveradssolutions.com. In a real app, it is important that you use your actual CAS manager ID.
appOpenAd = CASAppOpen.create(managerId:managerId)
- A
manager
is an initialized CASMediationManager instance.
appOpenAd = CASAppOpen.create(manager:manager)
To load an App Open ad, call the CASAppOpen
object's loadAd()
method. This method accepts parameter:
-
CASAppOpenAdCompletionHandler completionHandler
An object that handles events for loading an app open ad.
appOpenAd.loadAd { ad, error in
if let error = error {
// Called when an app open ad has failed to load.
return
}
// Called when an app open ad has loaded.
}
A contentCallback
method passing in a CASCallback
anonymous class to handle events such as when the ad is presented, fails to present, or when it is dismissed. If a user returns to your app after having left it by clicking on an app open ad, it makes sure they're not presented with another app open ad.
appOpenAd.contentCallback = delegate
You can ask for the ad availability directly by calling the following function:
let adLoaded = appOpenAd.isAdAvailable()
In order to show the ad, you'll need an UIViewController
context.
appOpenAd.present(fromRootViewController: self);
present()
, you will have shown your user an App Open Ad.
In the case you want to serve another App Open Ad, you must repeat loadAd()
to request an additional ad.
When a user enters your app for the first time, it is unlikely you will have an ad reference ready to be used. Instead, you should rely on the present()
method defined above which will either display an ad if one is available, or request a new one. This method should be called every time your app comes into the foreground. This can be done by overriding the applicationDidBecomeActive:
method in your AppDelegate
:
func applicationDidBecomeActive(_ application: UIApplication) {
appOpenAd.present(fromRootViewController: controller)
}
If you use Scenes, call present
in the sceneDidBecomeActive:
method of your UISceneDelegate
instead.
func sceneDidBecomeActive(_ scene: UIScene) {
appOpenAd.present(fromRootViewController: controller)
}
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.
Note
In order to continue loading app assets while the app open ad is being displayed, always load assets in a background thread.
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
didClosedAd()
method.
🔗 Done! What’s Next?
- Try another ad format:
- See the User Privacy Settings for ensuring your application is compliant with privacy regulations.
- Project Setup
- Advanced integration
- Additional mediation steps
- AppStore data disclosure
- App-ads.txt🔗