> ## 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.

# 라이트 팝업 광고

> DARO를 통해 라이트 팝업 광고를 구현하는 방법을 알아봅니다.

## 라이트 팝업 광고 형태 소개

* 전면 광고 유형입니다.
* 8초 후에 자동으로 닫히게 됩니다. 인터스티셜이나, 리워드 비디오보다 ux를 해치지 않고 광고를 보여줄 수 있습니다.

<img src="https://mintcdn.com/delightroom-5a71a6a8/dxU0bpsPoPvkYh_g/sdk-integration/common-img/ad-formats/ios-light-popup-example.png?fit=max&auto=format&n=dxU0bpsPoPvkYh_g&q=85&s=160d86722756d5122379c0ab2902e705" alt="Ios Light Popup Example Pn" title="Ios Light Popup Example Pn" style={{ width:"38%" }} width="945" height="2048" data-path="sdk-integration/common-img/ad-formats/ios-light-popup-example.png" />

***

## 광고 단위 설정

대시보드에서 발급받은 `ad unit ID`를 사용하여 광고 단위를 설정하세요.

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

  <Tab title="Objective-C">
    ```objc theme={null}
    // Objective-C에서는 초기화 시 unitId를 직접 전달합니다
    NSString *lightPopupUnitId = @"your_light_popup_unit_id";
    ```
  </Tab>
</Tabs>

***

## 라이트 팝업 광고 구현

<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() {
            // 광고 클릭 리스너
            daroLightPopupLoader.listener.onAdClicked = { adInfo in
                print("[DARO] Listener Light Popup Ad clicked: \(adInfo)")
            }

            // 광고 노출 리스너
            daroLightPopupLoader.listener.onAdImpression = { adInfo in
                print("[DARO] Listener Light Popup Ad impression: \(adInfo)")
            }

            // 광고 로드 성공 리스너
            daroLightPopupLoader.listener.onAdLoadSuccess = { [weak self] ad, adInfo in
                print("[DARO] Listener Light Popup Ad loaded: \(ad) \(adInfo)")
                self?.daroLightPopupAd = ad

                // 광고 표시 성공 리스너
                self?.daroLightPopupAd?.lightPopupAdListener.onShown = { adInfo in
                    print("[DARO] Listener Light Popup Ad shown: \(adInfo)")
                }

                // 광고 닫힘 리스너
                self?.daroLightPopupAd?.lightPopupAdListener.onDismiss = { adInfo in
                    print("[DARO] Listener Light Popup Ad dismissed: \(adInfo)")
                }

                // 광고 표시 실패 리스너
                self?.daroLightPopupAd?.lightPopupAdListener.onFailedToShow = { adInfo, error in
                    print("[DARO] Listener Light Popup Ad failed to show: \(adInfo) \(error)")
                }
            }

            // 광고 로드 실패 리스너
            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. 헤더 파일에서 delegate 프로토콜 채택:**

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

    **2. 라이트 팝업 광고 설정 및 로드:**

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

        // 광고 로드
        [self.lightPopupAd load];
    }
    ```

    **3. Delegate 메서드 구현:**

    ```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. 광고 표시:**

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

## 라이트 팝업 설정

라이트 팝업 광고의 스타일을 커스터마이징할 수 있습니다:

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    let configuration = DaroLightPopupConfiguration()

    // 배경색 설정
    configuration.backgroundColor = // 전체 배경색
    configuration.cardViewBackgroundColor = // 카드 뷰 배경색

    // 광고 마크 라벨 설정
    configuration.adMarkLabelTextColor = // 광고 마크 텍스트 색상
    configuration.adMarkLabelBackgroundColor = // 광고 마크 배경색

    // 닫기 버튼 설정
    configuration.closeButtonText = // 닫기 버튼 텍스트
    configuration.closeButtonTextColor = // 닫기 버튼 텍스트 색상

    // 제목 설정
    configuration.titleTextColor = // 제목 텍스트 색상

    // 본문 설정
    configuration.bodyTextColor = // 본문 텍스트 색상

    // CTA 버튼 설정
    configuration.ctaButtonTextColor = // CTA 버튼 텍스트 색상
    configuration.ctaButtonBackgroundColor = // CTA 버튼 배경색

    daroLightPopupAd?.configuration = configuration
    ```
  </Tab>

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

    // 배경색 설정
    configuration.backgroundColor = // 전체 배경색
    configuration.cardViewBackgroundColor = // 카드 뷰 배경색

    // 광고 마크 라벨 설정
    configuration.adMarkLabelTextColor = // 광고 마크 텍스트 색상
    configuration.adMarkLabelBackgroundColor = // 광고 마크 배경색

    // 닫기 버튼 설정
    configuration.closeButtonText = // 닫기 버튼 텍스트
    configuration.closeButtonTextColor = // 닫기 버튼 텍스트 색상

    // 제목 설정
    configuration.titleTextColor = // 제목 텍스트 색상

    // 본문 설정
    configuration.bodyTextColor = // 본문 텍스트 색상

    // CTA 버튼 설정
    configuration.ctaButtonTextColor = // CTA 버튼 텍스트 색상
    configuration.ctaButtonBackgroundColor = // CTA 버튼 배경색

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