Skip to main content

Light Popup Ad Format

Full-screen ad format that automatically closes after 8 seconds. Less disruptive to UX than interstitial or rewarded video ads. Ios Light Popup Example Pn

Ad Unit Setup

Configure your ad unit using the ad unit ID issued from the dashboard.
  • Swift
  • Objective-C
let lightPopupAdUnit = DaroAdUnit(unitId: "your_light_popup_unit_id")

Light Popup Ad Implementation

  • Swift
  • Objective-C
class ExampleViewController: UIViewController {
    private var daroLightPopupAd: DaroLightPopupAd? = nil
    let daroLightPopupLoader = DaroLightPopupAdLoader(unit: lightPopupAdUnit)

    override func viewDidLoad() {
        super.viewDidLoad()
        setupLightPopupAd()
    }

    private func setupLightPopupAd() {
        // Ad click listener
        daroLightPopupLoader.listener.onAdClicked = { adInfo in
            print("[DARO] Listener Light Popup Ad clicked: \(adInfo)")
        }

        // Ad impression listener
        daroLightPopupLoader.listener.onAdImpression = { adInfo in
            print("[DARO] Listener Light Popup Ad impression: \(adInfo)")
        }

        // Ad load success listener
        daroLightPopupLoader.listener.onAdLoadSuccess = { [weak self] ad, adInfo in
            print("[DARO] Listener Light Popup Ad loaded: \(ad) \(adInfo)")
            self?.daroLightPopupAd = ad

            // Ad show success listener
            self?.daroLightPopupAd?.lightPopupAdListener.onShown = { adInfo in
                print("[DARO] Listener Light Popup Ad shown: \(adInfo)")
            }

            // Ad dismiss listener
            self?.daroLightPopupAd?.lightPopupAdListener.onDismiss = { adInfo in
                print("[DARO] Listener Light Popup Ad dismissed: \(adInfo)")
            }

            // Ad show fail listener
            self?.daroLightPopupAd?.lightPopupAdListener.onFailedToShow = { adInfo, error in
                print("[DARO] Listener Light Popup Ad failed to show: \(adInfo) \(error)")
            }
        }

        // Ad load fail listener
        daroLightPopupLoader.listener.onAdLoadFail = { error in
            print("[DARO] Listener Light Popup Ad failed: \(error)")
        }

        daroLightPopupLoader.loadAd()
    }

    private func showLightPopupAd() {
        daroLightPopupAd?.show(viewController: self)
    }
}

Light Popup Configuration

You can customize the style of light popup ads:
  • Swift
  • Objective-C
let configuration = DaroLightPopupConfiguration()

// Set background colors
configuration.backgroundColor = // Overall background color
configuration.cardViewBackgroundColor = // Card view background color

// Ad mark label settings
configuration.adMarkLabelTextColor = // Ad mark text color
configuration.adMarkLabelBackgroundColor = // Ad mark background color

// Close button settings
configuration.closeButtonText = // Close button text
configuration.closeButtonTextColor = // Close button text color

// Title settings
configuration.titleTextColor = // Title text color

// Body settings
configuration.bodyTextColor = // Body text color

// CTA button settings
configuration.ctaButtonTextColor = // CTA button text color
configuration.ctaButtonBackgroundColor = // CTA button background color

daroLightPopupAd?.configuration = configuration