SDK Documentation
HomeBlogSign up
English
English
  • 🏠Homepage
  • 🧪Test Ad Units
  • Privacy
    • ✅Google Data Safety
  • Android SDK
    • ⌨️SDK integration
      • App Open
      • Banner
      • Interstitial
      • Rewarded
      • Native (Google)
      • Targeting
      • Revenue reporting
    • 🙎User consent
    • 🔓Privacy
    • 🛠️ProGuard
  • iOS SDK
    • ⌨️SDK integration
      • App Open
      • Banner
      • Interstitial
      • Rewarded
      • Native (Google)
      • Revenue reporting
    • 🙍User consent
    • 🔓Privacy
  • Unity SDK
    • ⌨️SDK integration
      • App Open
      • Banner
      • Interstitial
      • Rewarded
      • Targeting
      • Revenue reporting
    • 🙎User consent
    • 🔓Privacy
  • Flutter SDK
    • ⌨️SDK integration
      • App Open
      • Banner
      • Interstitial
      • Rewarded
      • Native (Google)
      • Targeting
      • Revenue reporting
    • 🙎User consent
    • 🔓Privacy
  • React Native
    • ⌨️SDK integration
      • App Open
      • Banner
      • Interstitial
      • Rewarded
      • Targeting
      • Revenue reporting
    • 🙎User consent
    • 🔓Privacy
  • Web SDK
    • ⌨️SDK integration
Con tecnología de GitBook
En esta página
  • Integration
  • Manual
  • Via Manager
  • Delegate configuration
  1. iOS SDK
  2. SDK integration

App Open

The app open ads are a special format which main purpose is to allow the monetization of the app load screens.

These ads can be closed anytime and are meant to be shown when the app moves to foreground.

Integration

This ad format can be only integrated through code, by implementing any of the two possible ways of integration that are described below.

Manual

In this kind of integration, it is needed to create an instance of the WAAppOpenAd class and use the loadAd() and showAd() methods to make the ad load and show on demand. The publisher is the responsible of deciding when the ad must be shown and implement the required logic.

Below you can find a simple integration example:

import UIKit
import WortiseSDK

class ViewController: UIViewController {

    private var appOpenAd: WAAppOpenAd!

    override func viewDidLoad() {
        super.viewDidLoad()
        ...
        appOpenAd = WAAppOpenAd(adUnitId: "test-app-open")
        appOpenAd.loadAd()
    }

    override func willMove(toParent controller: UIViewController?) {
        super.willMove(toParent: controller)
        ...
        appOpenAd.destroy()
    }
    
    func showAppOpen() {
        if appOpenAd.isAvailable {
            appOpenAd.showAd(from: self)
        }
    }
}

Also, the WAAppOpenAd class offers the following additional methods to configure its behaviour:

// Sets if a new ad must be loaded after closing the previous one
appOpenAd.autoReload = true

// Shows an ad immediately if available. Otherwise, requests the load of a
// new ad
appOpenAd.tryToShowAd(from: self)

Via Manager

The SDK provides a standard implementation of App Open to facilitate the integration of this ad format.

To perform this kind of integration, it is needed to create an instance of WAAppOpenManager inside the AppDelegate class, just as shown in the example below:

import UIKit
import WortiseSDK

class AppDelegate: UIResponder, UIApplicationDelegate {

    private var appOpenManager: WAAppOpenManager!

    func application(_
        application: UIApplication, didFinishLaunchingWithOptions
        launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        ...
        appOpenManager = WAAppOpenManager(adUnitId: "test-app-open")
        appOpenManager.loadAd()
    }
}

With this simple integration, the app will show ads every time there is a transition from background to foreground.

Also, the WAAppOpenManager class offers the same methods as WAAppOpenAd to configure its behavior and show ads on demand.

Delegate configuration

Like occurs with other formats, a delegate can be set to receive the events that happen during the ad lifecycle. For this, it is needed to implement the WAAppOpenDelegate interface just as shown in the example below:

extension AppDelegate : WAAppOpenDelegate {
    
    func didClick(appOpenAd: WAAppOpenAd) {
        // Invoked when the ad has been clicked
    }

    func didDismiss(appOpenAd: WAAppOpenAd) {
        // Invoked when the ad has been dismissed
    }
    
    func didFailToLoad(appOpenAd: WAAppOpenAd, error: WAAdError) {
        // Invoked when the ad could not be loaded
        // (because of an error or no fill)
    }

    func didFailToShow(appOpenAd: WAAppOpenAd, error: WAAdError) {
        // Invoked when the ad could not be shown
    }

    func didImpress(appOpenAd: WAAppOpenAd) {
        // Invoked when the ad has generated an impression
    }

    func didLoad(appOpenAd: WAAppOpenAd) {
        // Invoked when the ad has been loaded
    }
    
    func didPayRevenue(appOpenAd: WAAppOpenAd, data: WARevenuedata) {
        // Invoked when the ad has generated revenue
    }
 
    func didShow(appOpenAd: WAAppOpenAd) {
        // Invoked when the ad has been shown
    }
}

Once the interface is implemented, the delegate is assigned to the ad instance:

appOpenAd.delegate = self
AnteriorSDK integrationSiguienteBanner

Última actualización hace 3 días

⌨️