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
  • Delegate configuration
  1. iOS SDK
  2. SDK integration

Interstitial

Integration

Unlike banners, interstitials can only be integrated with code. Below we show a simple example to understand how it works:

import UIKit
import WortiseSDK

class ViewController: UIViewController {

    private var interstitialAd: WAInterstitialAd!

    override func viewDidLoad() {
        super.viewDidLoad()
        ...
        interstitialAd = WAInterstitialAd(adUnitId: "test-interstitial")
        interstitialAd.loadAd()
    }

    override func willMove(toParent controller: UIViewController?) {
        super.willMove(toParent: controller)
        ...
        interstitialAd.destroy()
    }

    func showInterstitial() {
        if interstitialAd.isAvailable {
            interstitialAd.showAd(from: self)
        }
    }
}

Delegate configuration

Like occurs with banners, a listener can be set to receive the events that happen during the interstitial lifecycle. For this, it is needed to implement the WAInterstitialDelegate interface just as shown in the example below:

extension ViewController : WAInterstitialDelegate {
    
    func didClick(interstitialAd: WAInterstitialAd) {
        // Invoked when the ad has been clicked
    }

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

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

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

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

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

interstitialAd.delegate = self
AnteriorBannerSiguienteRewarded

Última actualización hace 3 días

⌨️