Skip to main content

AdMob mediation - Banner (Anchored)


info

This page covers AdMob mediation. If you integrate Teads directly (no mediator), see the direct integration guide.

This article shows you how to deliver Teads anchored Banner ads on your application using the AdMob mediation adapter.

Using CocoaPods to have the Teads AdMob mediation plugin will automatically import the Teads inApp SDK framework.

Prerequisites

  • Platform: iOS 14+
  • Xcode: 26.2+
  • Built with Swift 6.2.3
  • GoogleMobileAdsSDK: >=12.2.0

Installation

Add TeadsAdMobAdapter to your project. It includes the Teads inApp SDK as a transitive dependency. You'll also need the GoogleMobileAds SDK integrated separately.

CocoaPods

pod 'TeadsAdMobAdapter', '~> 6.2'

Swift Package Manager

Add https://github.com/teads/TeadsSDK-iOS with the Up to Next Major Version rule (6.2.0 ..< 7.0.0), then select the TeadsAdMobAdapter product.

Then follow Defining a Custom Event below.

Defining a Custom Event

In order to display a Teads anchored Banner using AdMob mediation, you need to create a custom event.

Follow the custom event documentation on the AdMob dashboard using the values below.

NameValue
Class NameGADMAdapterTeadsBanner
ParameterJSON string (see below)

Custom Event Parameter

The parameter must be a JSON string. The adapter routes to the anchored Banner path as soon as the JSON contains the three required keys (articleUrl, widgetId, installationKey).

ParameterTypeRequiredDescription
articleUrlStringYesThe URL of the article/page
widgetIdStringYesTeads widget ID
installationKeyStringYesTeads installation key
widgetIndexIntNoIndex when multiple widgets share the same page (default 0)
userIdStringNoPublisher-provided user identifier
darkModeBoolNoEnable dark mode theme (default false)
extIdStringNoExternal tracking id
extSecondaryIdStringNoSecondary external tracking id
obPubImpStringNoPublisher impression id override
pbfIntNoFloor price in US dollars. Forwarded to the auction as the placement floor price.

For testing purposes, use the following:

{"articleUrl":"https://mobile-demo.outbrain.com/","widgetId":"MB_10","installationKey":"NANOWDGT01"}
warning

For production, your articleUrl, widgetId, and installationKey will be unique values provided by your product manager. Contact your local account manager to obtain your production parameters.

Integration

Initialize Google Mobile Ads

Initialize the Google Mobile Ads SDK once at app launch, before loading any ads:

import GoogleMobileAds

MobileAds.shared.start(completionHandler: nil)

Load and Display the Banner

Add a BannerView to your view hierarchy, configure it with your ad unit id and the fixed AdSizeBanner size, disable autoload, then call load(_:).

import UIKit
import GoogleMobileAds

final class BannerViewController: UIViewController {

private var bannerView: BannerView!

override func viewDidLoad() {
super.viewDidLoad()

// 1. Build the banner view with a fixed banner size (320×50pt).
bannerView = BannerView(adSize: AdSizeBanner)
bannerView.adUnitID = "YOUR_AD_UNIT_ID" // Ad unit id configured on your AdMob dashboard
bannerView.rootViewController = self

// 2. Disable autoloading so the ad loads only via the explicit load(_:)
// call below, not automatically.
bannerView.isAutoloadEnabled = false

// 3. Pin centre + bottom to your view.
bannerView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(bannerView)
NSLayoutConstraint.activate([
bannerView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
bannerView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])

// 4. Load the ad.
bannerView.load(Request())
}
}
info

AdSizeBanner requests a fixed 320×50pt slot from the AdMob waterfall. Adaptive sizes such as currentOrientationAnchoredAdaptiveBanner re-resolve when the banner's bounds change (rotation, SwiftUI layout passes), which can trigger duplicate ad requests; the fixed size is invariant. The Teads creative still resizes its own height inside the slot via the JS engine.

Mediation settings

Find the full settings list in the Integration Guide and Settings Configuration.

Check list

  • Ensure Brand Safety is enabled
  • Ensure you comply with privacy legal requirements (GDPR/CCPA/GPP)
  • Comply with app-ads.txt
  • Test with different JSON parameter configurations
  • Enable validation mode to ensure key features are working
  • Implement proper error handling
  • Test on different devices and screen sizes