> ## Documentation Index
> Fetch the complete documentation index at: https://guide.daro.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Light Popup Ads

> Implement light popup ads in your iOS app.

## Light Popup Ad Format

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

<img src="https://mintcdn.com/delightroom-5a71a6a8/j3-znW7LKrbpP3mb/sdk-integration/common-img/ad-formats-en/ios-light-popup-example.png?fit=max&auto=format&n=j3-znW7LKrbpP3mb&q=85&s=4bfbe16285d4a08724e862236b8106f5" alt="Ios Light Popup Example Pn" title="Ios Light Popup Example Pn" style={{ width:"39%" }} width="996" height="2160" data-path="sdk-integration/common-img/ad-formats-en/ios-light-popup-example.png" />

***

## Ad Unit Setup

Configure your ad unit using the `ad unit ID` issued from the dashboard.

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    let lightPopupAdUnit = DaroAdUnit(unitId: "your_light_popup_unit_id")
    ```
  </Tab>

  <Tab title="Objective-C">
    ```objc theme={null}
    // In Objective-C, unitId is passed directly during initialization
    NSString *lightPopupUnitId = @"your_light_popup_unit_id";
    ```
  </Tab>
</Tabs>

***

## Light Popup Ad Implementation

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    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)
        }
    }
    ```
  </Tab>

  <Tab title="Objective-C">
    **1. Adopt the delegate protocol in your header file:**

    ```objc theme={null}
    @interface ExampleViewController () <DaroObjCLightPopupAdDelegate>
    @property (nonatomic, strong) DaroObjCLightPopupAd *lightPopupAd;
    @end
    ```

    **2. Setup and load light popup ad:**

    ```objc theme={null}
    - (void)setupLightPopupAd {
        self.lightPopupAd = [[DaroObjCLightPopupAd alloc]
            initWithAdUnitId:@"your_light_popup_unit_id"];
        self.lightPopupAd.delegate = self;

        // Load ad
        [self.lightPopupAd load];
    }
    ```

    **3. Implement delegate methods:**

    ```objc theme={null}
    #pragma mark - DaroObjCLightPopupAdDelegate

    - (void)lightPopupAdDidLoad:(DaroObjCLightPopupAd *)ad
                         adInfo:(DaroObjCAdInfo *)adInfo {
        NSLog(@"[DARO] Light popup ad loaded - Unit: %@", adInfo.adUnitId);
    }

    - (void)lightPopupAdDidFail:(DaroObjCLightPopupAd *)ad
                         toLoad:(NSError *)error {
        NSLog(@"[DARO] Failed to load: %@", error.localizedDescription);
    }

    - (void)lightPopupAdDidShow:(DaroObjCLightPopupAd *)ad
                         adInfo:(DaroObjCAdInfo *)adInfo {
        NSLog(@"[DARO] Light popup ad shown");
    }

    - (void)lightPopupAdDidFail:(DaroObjCLightPopupAd *)ad
                         toShow:(DaroObjCAdInfo *)adInfo
                          error:(NSError *)error {
        NSLog(@"[DARO] Failed to show: %@", error.localizedDescription);
    }

    - (void)lightPopupAdDidClick:(DaroObjCLightPopupAd *)ad
                          adInfo:(DaroObjCAdInfo *)adInfo {
        NSLog(@"[DARO] Light popup ad clicked");
    }

    - (void)lightPopupAdDidRecordImpression:(DaroObjCLightPopupAd *)ad
                                     adInfo:(DaroObjCAdInfo *)adInfo {
        NSLog(@"[DARO] Impression recorded");
    }

    - (void)lightPopupAdDidDismiss:(DaroObjCLightPopupAd *)ad
                            adInfo:(DaroObjCAdInfo *)adInfo {
        NSLog(@"[DARO] Light popup ad dismissed");
    }
    ```

    **4. Show ad:**

    ```objc theme={null}
    - (void)showLightPopupAd {
        if (self.lightPopupAd.isReady) {
            [self.lightPopupAd showFrom:self];
        } else {
            NSLog(@"[DARO] Ad is not ready to show");
        }
    }
    ```
  </Tab>
</Tabs>

## Light Popup Configuration

You can customize the style of light popup ads:

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    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
    ```
  </Tab>

  <Tab title="Objective-C">
    ```objc theme={null}
    DaroObjCLightPopupConfiguration *configuration = [[DaroObjCLightPopupConfiguration alloc] init];

    // 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

    self.lightPopupAd.configuration = configuration;
    ```
  </Tab>
</Tabs>
