Light Popup Ad Format
Full-screen ad format that automatically closes after 8 seconds. Less disruptive to UX than interstitial or rewarded video ads.
Ad Unit Setup
Configure your ad unit using thead unit ID issued from the dashboard.
- Swift
- Objective-C
Copy
Ask AI
let lightPopupAdUnit = DaroAdUnit(unitId: "your_light_popup_unit_id")
Copy
Ask AI
// In Objective-C, unitId is passed directly during initialization
NSString *lightPopupUnitId = @"your_light_popup_unit_id";
Light Popup Ad Implementation
- Swift
- Objective-C
Copy
Ask AI
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)
}
}
1. Adopt the delegate protocol in your header file:2. Setup and load light popup ad:3. Implement delegate methods:4. Show ad:
Copy
Ask AI
@interface ExampleViewController () <DaroObjCLightPopupAdDelegate>
@property (nonatomic, strong) DaroObjCLightPopupAd *lightPopupAd;
@end
Copy
Ask AI
- (void)setupLightPopupAd {
self.lightPopupAd = [[DaroObjCLightPopupAd alloc]
initWithAdUnitId:@"your_light_popup_unit_id"];
self.lightPopupAd.delegate = self;
// Load ad
[self.lightPopupAd load];
}
Copy
Ask AI
#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");
}
Copy
Ask AI
- (void)showLightPopupAd {
if (self.lightPopupAd.isReady) {
[self.lightPopupAd showFrom:self];
} else {
NSLog(@"[DARO] Ad is not ready to show");
}
}
Light Popup Configuration
You can customize the style of light popup ads:- Swift
- Objective-C
Copy
Ask AI
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
Copy
Ask AI
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;

