Skip to main content

Overview

Backfill ads are alternative ads displayed when the primary ad fails to load. They help fill empty ad spaces when there’s insufficient ad inventory or network issues prevent ad loading.

Use Cases

  • When primary ad network fails to provide ads
  • When ad inventory is insufficient in certain regions or time zones
  • Display alternative ads when ad loading fails

Console Settings

To use backfill ads, configuration is required in AdControl Console.
1

Select Ad Unit

Select the unit to configure backfill in AdControl Console > Ad Unit.
2

Configure Backfill

Enable Backfill Ad option in unit settings and select a backfill source.
3

Save

Save the settings.
See Backfill Ad Guide for detailed console configuration.

SDK Implementation

Backfill ads are handled automatically by the SDK. If primary ad loading fails, the configured backfill ad is automatically loaded.
import AdropAds

class ViewController: UIViewController, AdropBannerDelegate {
    private var banner: AdropBanner?

    override func viewDidLoad() {
        super.viewDidLoad()

        // Implement same as regular banner ad
        banner = AdropBanner(unitId: "YOUR_UNIT_ID")
        banner?.delegate = self

        if let bannerView = banner {
            view.addSubview(bannerView)
            // Auto Layout setup...
        }

        banner?.load()
    }

    // Backfill ads are handled through the same delegate
    func onAdReceived(_ banner: AdropBanner) {
        print("Ad received (primary or backfill)")
    }

    func onAdFailedToReceive(_ banner: AdropBanner, _ errorCode: AdropErrorCode) {
        // Called when both primary and backfill ads fail
        print("Ad receive failed: \(errorCode)")
    }
}

Native Ad Backfill

Backfill is automatically applied to native ads in the same way.
nativeAd = AdropNativeAd(unitId: "YOUR_UNIT_ID")
nativeAd?.delegate = self
nativeAd?.load()

// Receive primary or backfill ad in delegate
func onAdReceived(_ nativeAd: AdropNativeAd) {
    print("Ad received successfully")
    // Bind to view
}

How Backfill Works

  1. SDK requests primary ad
  2. If primary ad fails to load, automatically requests backfill ad
  3. Backfill ad received successfully → onAdReceived called
  4. Backfill ad also fails → onAdFailedToReceive called
Backfill ads only work when configured in the console. You can enable/disable backfill through console settings alone without SDK code changes.

Best Practices

1. Error Handling

Prepare fallback UI for when both backfill and primary ads fail.
func onAdFailedToReceive(_ banner: AdropBanner, _ errorCode: AdropErrorCode) {
    // Both primary and backfill failed
    // Display alternative content or hide ad area
    bannerContainerView.isHidden = true

    // Or display your own promotional banner
    showPromotionBanner()
}

2. Logging

Check which ad was loaded in debug mode.
func onAdReceived(_ banner: AdropBanner) {
    #if DEBUG
    print("Ad received successfully - Unit ID: \(banner.unitId)")
    #endif
}

3. Frequency Monitoring

If backfill ads are shown frequently, monitor ad quality. You can check the ratio of primary to backfill ads in the console dashboard.