Skip to content

App Open Ads

Str4tos edited this page May 26, 2025 · 15 revisions

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.

This guide explains how to integrate app open ads into an iOS app.

flowchart TD

A[isAutoloadEnabled] -->|auto| L((loadAd))
L -->|success| R([didLoadContent])
L -->|fail| F([didFailToLoadWithError])
F -->|delay| A
R --> RL[isAdLoaded]
S((present)) --> RL
RL -->|success| SR([willPresentContent])
RL -->|fail| SF([didFailToPresentWithError])
SR --> I([didRecordImpression])
SR --> C([didClickContent])
I --> D([didDismissContent])
D --> A
SF --> A
Loading

Create Ad instance

import CleverAdsSolutions

@main
class MyAppDelegate: UIResponder, UIApplicationDelegate, CASScreenContentDelegate {

    let appOpenAd = CASAppOpen(casID: MyAppDelegate.casID)

The SDK provides the capability to create and precache multiple ad instances, enabling uninterrupted sequential ad display. CAS SDK will load mediation ads in order for each created instance.

Receive Ad events

The CASScreenContentDelegate handles events related to displaying your CASAppOpen. Callbacks are called on the main thread. Before showing ad, make sure to set delegate.

func screenAdDidLoadContent(_ ad: any CASScreenContent) {
    // Called when the ad content has been successfully loaded.
}

func screenAd(_ ad: any CASScreenContent, didFailToLoadWithError error: AdError) {
    // Called when the ad content fails to load.
}

func screenAd(_ ad: any CASScreenContent, didFailToPresentWithError error: AdError) {
    // Called when the ad content fails to present.
}

func screenAdWillPresentContent(_ ad: any CASScreenContent) {
    // Called when the ad content is successfully shown.
}

func screenAdDidClickContent(_ ad: any CASScreenContent) {
    // Called when the ad content is clicked by the user.
}

func screenAdDidDismissContent(_ ad: any CASScreenContent) {
    // Called when the ad content is dismissed.
}

Note

  • Read more about AdContentInfo structure in Impression Level Data.
  • Attempting to load a new ad from the didFailToLoadWithError method is strongly discouraged. Limit ad load retries to avoid continuous failed ad requests in situations such as limited network connectivity.
  • When an error occurs during ad impression, executed the didFailToPresentWithError only. In this case the didDismissContent will not be executed, since the impression is not considered successful.

Load Ad

The next step is to fill out the loadAd() method and handle the ad load callbacks.

func loadAppOpenAd() {
    let screenContentDelegate: CASScreenContentDelegate = self
    appOpenAd.delegate = screenContentDelegate
    appOpenAd.loadAd()
}

Autoload mode

If enabled, the ad will automatically load new content when the current ad is dismissed or completed. Additionally, it will automatically retry loading the ad if an error occurs during the loading process.

func loadAppOpenAd() {
    let screenContentDelegate: CASScreenContentDelegate = self
    appOpenAd.delegate = screenContentDelegate
    appOpenAd.isAutoloadEnabled = true
}

By default autoload disabled.

Show Ad

The most common app open implementation is to attempt to present an app open ad near app launch, start app content if the ad isn't ready, and preload another ad for the next app open opportunity.

func applicationDidBecomeActive(_ application: UIApplication) { 
    if appOpenAd.isLoaded {  
        appOpenAd.present(from: nil);  
    } else {  
        loadAppOpenAd();  
    } 
}

If you use Scenes, implement the sceneDidBecomeActive: method in your UISceneDelegate instead.

The UIViewController parameter is an optional. The SDK uses the app’s main window to look up view controllers automatically when one is not provided.

Once you’ve successfully call preset(), 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.

Note

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.

Autoshow mode

Use the isAutoshowEnabled property to automatically show a loaded ad when the user returns to the app.

appOpenAd.isAutoshowEnabled = true

By default autoshow disabled.

Checking Ad Availability

Use isAdLoaded to check whether an ad is currently loaded.

if appOpenAd.isAdLoaded {
}

Even if isAdLoaded returns true, it does not guarantee that the ad will be shown successfully — various issues may still prevent it from being displayed. We strongly recommend handling potential display failures via screenAd(_:didFailToPresentWithError:) delegate to ensure a smoother user experience.

By relying on these delegate, you ensure that your application can react appropriately to real-time conditions, rather than making assumptions based on ad load state at a single point in time.

Samples

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.

Note

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 didDismissContent() and didFailToPresentWithError() methods.

🔗 Next

Clone this wiki locally