> For the complete documentation index, see [llms.txt](https://ios-docs.adster.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ios-docs.adster.tech/additional-features/adaptive-banner-ad-only-for-gam.md).

# Adaptive Banner Ad (Only for GAM)

#### Ad Request : <a href="#a-d-request" id="a-d-request"></a>

Create your `AdSterAdLoader` and pass the adaptive parameters on the `AdRequestConfiguration` as shown below.

<details>

<summary>Anchored adaptive banner</summary>

```swift
let loader = AdSterAdLoader()
loader.delegate = self
loader.loadAd(adRequestConfiguration: AdRequestConfiguration(
    placement: "placement_name",
    viewController: self,
    adaptiveAdWidth: Int(UIScreen.main.bounds.width),
    adaptiveType: "Anchored"
))
```

</details>

<details>

<summary>Current orientation inline adaptive banner</summary>

```swift
let loader = AdSterAdLoader()
loader.delegate = self
loader.loadAd(adRequestConfiguration: AdRequestConfiguration(
    placement: "placement_name",
    viewController: self,
    adaptiveAdWidth: Int(UIScreen.main.bounds.width),
    adaptiveType: "CurrentOrientationInline"
))
```

</details>

<details>

<summary>Inline adaptive banner</summary>

```swift
let loader = AdSterAdLoader()
loader.delegate = self
loader.loadAd(adRequestConfiguration: AdRequestConfiguration(
    placement: "placement_name",
    viewController: self,
    adaptiveAdWidth: Int(UIScreen.main.bounds.width),
    adaptiveAdHeight: 300,
    adaptiveType: "Inline"
))
```

</details>

{% hint style="info" %}
`adaptiveType` accepts `"Anchored"`, `"Inline"`, and `"CurrentOrientationInline"` (case-insensitive). Any other value falls back to the placement's configured/fixed size.\
`adaptiveAdHeight` is only used by the `"Inline"` type and is ignored otherwise. \
Width is expressed in points — using the safe-area / screen width is recommended.
{% endhint %}

#### Receiving the ad :

Conform to the `MediationAdDelegate` protocol to be notified when the ad loads, then add the returned view to your layout.

```swift
extension BannerAdManager: MediationAdDelegate {
    func onBannerAdLoaded(bannerAd: AdsFramework.MediationBannerAd) {
        guard let bannerview = bannerAd.view else {
            print("Banner Ad request failed with reason banner ad null")
            return
        }
        addBannerViewToView(bannerview)
        bannerAd.eventDelegate = self
    }

    func onAdFailedToLoad(error: AdsFramework.AdError) {
        print("Banner Ad request failed with reason \(error.description)")
    }

    func onAdRevenuePaid(revenue: Double, adUnitId: String, network: String, currency: String, precisionType: AdsFramework.PrecisionType) {
        print("Revenue: \(revenue) \(currency), adUnitId: \(adUnitId), network: \(network), precision: \(precisionType)")
    }
```
