Google Ad Manager and AdMob mediation
This article shows you how to deliver Teads ads — Media, Native, Interstitial, and Banner (Anchored) — on your application using the AdMob adapter or Google Ad Manager (GAM) Mediation adapter.
The official Teads SDK sample application includes working AdMob and Google Ad Manager integrations. Use it for implementation examples and as a reference while you set up this adapter.
Prerequisites
- Platform: iOS 14+
- Xcode: 26.2+
- Built with Swift 6.2.3
- GoogleMobileAdsSDK: >=12.2.0
Installation
Before installing the Teads AdMob adapter, you will need to integrate GoogleMobileAds SDK into your application.
CocoaPods
CocoaPods Trunk stopped accepting new pod versions on December 2, 2026, so Teads SDK 6.3.0 and later
are not published there. Install the pods from the Teads public repository instead, pinned to a
release tag. List TeadsSDK next to the adapter with the same tag: the adapter requires the same
version of it. To upgrade, change the tag on both lines; version ranges such as ~> 6.3 don't
work with :git.
- Add both pods to your Podfile:
pod 'TeadsSDK', :git => 'https://github.com/teads/TeadsSDK-iOS.git', :tag => '6.3.0'
pod 'TeadsAdMobAdapter', :git => 'https://github.com/teads/TeadsSDK-iOS.git', :tag => '6.3.0'
- Run the following to install them in your project.
$ pod install
- Register the adapter, then create the Teads custom event for your format below to finish the integration.
Swift Package Manager
SPM is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
Installing from Xcode
- Add a package by selecting
File→Add Packages…in Xcode’s menu bar. - Search for the Teads iOS SDK using the repo's URL:
https://github.com/teads/TeadsSDK-iOS
- Next, set the Dependency Rule to be
Up to Next Major Versionand specify6.2.1 < 7.0.0. - Choose the Teads product that you want to be installed in your app:
TeadsAdMobAdapter - Register the adapter, then create the Teads custom event for your format below to finish the integration.
Alternatively, add Teads to your Package.swift manifest
- Add it to the
dependenciesof yourPackage.swift:
dependencies: [
.package(url: "https://github.com/teads/TeadsSDK-iOS", .upToNextMajor(from: "6.2.1"))
]
- in any target that depends on a Teads product, add it to the
dependenciesarray of that target:
.target(
name: "MyTargetName",
dependencies: [
.product(name: "TeadsAdMobAdapter", package: "Teads"),
]
),
- Register the adapter, then create the Teads custom event for your format below to finish the integration.
Register the Adapter
TeadsAdMobAdapter is statically linked into your app — as a static binary framework via Swift Package Manager (since 6.2.1), and compiled from source via CocoaPods. Its custom-event classes are instantiated by name by the Google Mobile Ads SDK from your AdMob dashboard configuration, so nothing in your own code references them and the linker can strip them from optimised builds — the app then builds, launches and runs normally while Teads never serves.
Call TeadsAdMobMediation.register() once at startup, before MobileAds.shared.start(completionHandler:) or your first ad request:
import GoogleMobileAds
import TeadsAdMobAdapter
TeadsAdMobMediation.register()
MobileAds.shared.start()
It is safe to call unconditionally, with either CocoaPods or Swift Package Manager.
Adding -ObjC to Other Linker Flags on your app target has the same effect. CocoaPods integrations get it automatically from the Google Mobile Ads podspec, which is why this step has not been needed there; Swift Package Manager does not, so register() is the recommended route.
There is no crash and no error — the only symptom is zero Teads fill through mediation. Dead stripping happens in optimised builds, so check a Release build and search the console for Cannot find Custom Event class named followed by the class name you configured.
Formats
Pick the ad format you are integrating. Each format has its own setup.
- Media
- Native Ad
- Interstitial
- Banner
Defining a Custom Event
In order to display a Teads ad using AdMob or Google Ad Manager mediation, you need to create a custom event.
See the SDK documentation for more test PIDs serving different creative formats.
AdMob
Follow the custom event documentation on the AdMob dashboard using the below values.
| Name | Value |
|---|---|
| Class Name | GADMAdapterTeadsBanner |
| Parameter | Teads placement ID (PID) |
Google Ad Manager
Follow the custom event documentation on Google Ad Manager using the below values.
| Name | Value |
|---|---|
| Class Name | GADMAdapterTeadsBanner |
| Parameter | Teads placement ID (PID) |
Integration
See the sample ViewController from our iOS GitHub repository.
You have the ability to pass extra parameters in order to customize third-party ad network settings. For Teads, you need to pass TeadsAdapterSettings.
- Create an instance of
TeadsAdapterSettingsand add the settings you want. - Register it into GADRequest calling
register
- Swift
- Objective-C
import TeadsAdMobAdapter
// 1. Create AdMob view and add it to hierarchy
admobAdView = GAMBannerView(adSize: GADAdSizeFluid)
slotView.addSubview(admobAdView)
admobAdView.translatesAutoresizingMaskIntoConstraints = false
admobAdView.centerXAnchor.constraint(equalTo: slotView.centerXAnchor).isActive = true
admobAdView.centerYAnchor.constraint(equalTo: slotView.centerYAnchor).isActive = true
// 2. Attach Delegate (will include Teads events)
admobAdView.adUnitID = pid // Replace with your adunit
admobAdView.rootViewController = self
admobAdView.delegate = self
// 3. Load a new ad (this will call AdMob and Teads afterward)
let adSettings = TeadsAdapterSettings { (settings) in
settings.pageUrl("https://example.com/article1")
}
let request = GADRequest()
// 4. Register adSettings to the request
request.register(adSettings)
admobAdView.load(request)
#import <TeadsAdMobAdapter/TeadsAdMobAdapter.h>
// 1. Create AdMob view and add it to hierarchy
self.admobAdView = [[GAMBannerView alloc] initWithAdSize:GADAdSizeFluid];
[self.slotView addSubview:self.admobAdView];
self.admobAdView.translatesAutoresizingMaskIntoConstraints = NO;
[self.admobAdView.centerXAnchor constraintEqualToAnchor:self.slotView.centerXAnchor].active = YES;
[self.admobAdView.centerYAnchor constraintEqualToAnchor:self.slotView.centerYAnchor].active = YES;
// 2. Attach Delegate (will include Teads events)
self.admobAdView.adUnitID = pid; // Replace with your adunit
self.admobAdView.rootViewController = self;
self.admobAdView.delegate = self;
// 3. Load a new ad (this will call AdMob and Teads afterward)
TeadsAdapterSettings *adSettings = [[TeadsAdapterSettings alloc] initWithBuild:^(TeadsAdapterSettings *settings) {
[settings pageUrl:@"https://example.com/article1"];
}];
GADRequest *request = [GADRequest request];
// 4. Register adSettings to the request
[request registerAdNetworkExtras:adSettings];
[self.admobAdView loadRequest:request];
Ad Resizing
To resize the GAMBannerView you must use GAMBannerView.resize(). Otherwise, GAM will perform a new request each time you manipulate the view frame or constraints, as stated in the Google for Developers documentation.
Known issue: the ad is flickering
- GoogleMobileAds asks TeadsAdapter to perform a new request
- Ad is loading
- Once ad is rendering, the ad asks for a new ratio to better fit the creative
- This ratio is applied using a frame/constraints update which is not allowed by GoogleMobileAds
- This UI move is not permitted by GoogleMobileAds, go back to step 1
The code below must be implemented to enable the resizing of the mediated ad slot making possible the rendering of square and vertical creatives.
Register to ad resizing through TeadsAdapterSettings by providing your delegate class and the GAMBannerView that need to be resized.
- Swift
- Objective-C
var admobAdView: GAMBannerView!
@IBOutlet weak var slotView: UIView!
@IBOutlet weak var slotViewHeightConstraint: NSLayoutConstraint! // set to 0 on InterfaceBuilder
let adSettings = TeadsAdapterSettings { settings in
settings.registerAdView(admobAdView, delegate: self)
}
@property (nonatomic, strong) GAMBannerView *admobAdView;
@property (nonatomic, weak) IBOutlet UIView *slotView;
@property (nonatomic, weak) IBOutlet NSLayoutConstraint *slotViewHeightConstraint; // set to 0 on InterfaceBuilder
TeadsAdapterSettings *adSettings = [[TeadsAdapterSettings alloc] initWithBuild:^(TeadsAdapterSettings *settings) {
[settings registerAdView:self.admobAdView delegate:self];
}];
Simply conform to the Teads delegate TeadsMediatedAdViewDelegate and implements the didUpdateRatio function.
You can instantiate a new listener as below, the listener needs to be a class member field or strong referenced somewhere, we keep internally a weak reference to it, so you are responsible to retain it and destroy it when you don't need it anymore:
- Swift
- Objective-C
func didUpdateRatio(_ adView: UIView, adRatio: TeadsAdRatio) {
let height = adRatio.calculateHeight(for: slotView.frame.width) // call calculateHeight
slotViewHeightConstraint.constant = height //update NSLayoutConstraint of the slot
admobAdView.resize(GADAdSizeFromCGSize(CGSize(width: slotView.frame.width, height: height))) //call resize on GAMBannerView
}
- (void)didUpdateRatio:(UIView *)adView adRatio:(TeadsAdRatio *)adRatio {
CGFloat height = [adRatio calculateHeightForWidth:self.slotView.frame.size.width]; // call calculateHeight
self.slotViewHeightConstraint.constant = height; //update NSLayoutConstraint of the slot
[self.admobAdView resize:GADAdSizeFromCGSize(CGSizeMake(self.slotView.frame.size.width, height))]; //call resize on GAMBannerView
}
To resize the GAMBannerView you must use GAMBannerView.resize(). Otherwise, GAM will perform a new request each time you manipulate the view frame or constraints, as stated in the Google for Developers documentation.
Mediation settings
Find the full settings list in Settings Configuration — TeadsAdapterSettings.
This native implementation is specifically designed to fit feed views. You can customize the view to look like the other cells around, to offer a more immersive experience.
Defining a Custom Event
In order to display a Teads ad using AdMob or Google Ad Manager mediation, you need to create a custom event.
See the SDK documentation for more test PIDs serving different creative formats.
AdMob
Follow the custom event documentation on the AdMob dashboard using the below values.
| Name | Value |
|---|---|
| Class Name | GADMAdapterTeadsNative |
| Parameter | Teads placement ID (PID) |
Google Ad Manager
Follow the custom event documentation on Google Ad Manager using the below values.
| Name | Value |
|---|---|
| Class Name | GADMAdapterTeadsNative |
| Parameter | Teads placement ID (PID) |
Integration
See the sample ViewController from our iOS GitHub repository.
You're responsible for positioning the elements (title label, main image, call to action button...). Those elements need to be visible (without overlay, even transparent ones) otherwise our visibility algorithm will consider the ad view as hidden.
Interface
- Add a GADNativeAdView to the storyboard
- set
GADNativeAdViewas a cell property
class AdmobNativeAdTableViewCell: UITableViewCell {
@IBOutlet weak var nativeAdView: GADNativeAdView!
}
Load an Ad
You have the ability to pass extra parameters in order to customize third-party ad network settings. For Teads, you need to pass TeadsAdapterSettings.
- Create an instance of
TeadsAdapterSettingsand add the settings you want. - Register it into GADRequest calling
register
- Swift
- Objective-C
import TeadsAdMobAdapter
adLoader = GADAdLoader(adUnitID: pid, rootViewController: self,
adTypes: [ .native ], options: nil)
adLoader?.delegate = self
let adSettings = TeadsAdapterSettings { settings in
settings.enableDebug()
settings.pageUrl("https://example.com/article1")
}
let request = GADRequest()
// 4. Register adSettings to the request
request.register(adSettings)
adLoader.load(request)
#import <TeadsAdMobAdapter/TeadsAdMobAdapter.h>
self.adLoader = [[GADAdLoader alloc]
initWithAdUnitID:pid
rootViewController:self
adTypes:@[ GADAdLoaderAdTypeNative ]
options:nil];
self.adLoader.delegate = self;
TeadsAdapterSettings *adSettings = [[TeadsAdapterSettings alloc] initWithBuild:^(TeadsAdapterSettings *settings) {
[settings enableDebug];
[settings pageUrl:@"https://example.com/article1"];
}];
GADRequest *request = [GADRequest request];
// 4. Register adSettings to the request
[request registerAdNetworkExtras:adSettings];
[self.adLoader loadRequest:request];
Store Ad (Sequence)
When implementing native in a tableView or collectionView we suggest to add GADNativeAd inside your sequence structure
private var elements = [GADNativeAd?]()
override func viewDidLoad() {
super.viewDidLoad()
(0..<8).forEach { _ in
elements.append(nil) //nil reprensents all other data of cells
}
...
}
implement GADNativeAdLoaderDelegate to store ad in you sequence structure
func adLoader(_ adLoader: GADAdLoader, didReceive nativeAd: GADNativeAd) {
elements.insert(nativeAd, at: adRowNumber)
let indexPaths = [IndexPath(row: adRowNumber, section: 0)]
tableView.insertRows(at: indexPaths, with: .automatic)
nativeAd.delegate = self
}
Ad Binding
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if let ad = elements[indexPath.row] {
guard let cell = tableView.dequeueReusableCell(withIdentifier: teadsAdCellIndentifier, for: indexPath) as? AdmobNativeAdTableViewCell else {
return UITableViewCell()
}
cell.nativeAdView.bind(ad, videoControllerDelegate: nil)
return cell
}
...
}
Bind GADNativeAd into your cell using custom func bind
extension GADNativeAdView {
func bind(_ ad: GADNativeAd, videoControllerDelegate: GADVideoControllerDelegate? = nil) {
self.nativeAd = ad
// Populate the native ad view with the native ad assets.
// The headline and mediaContent are guaranteed to be present in every native ad.
(headlineView as? UILabel)?.text = ad.headline
mediaView?.mediaContent = ad.mediaContent
mediaView?.isAccessibilityElement = true
// Some native ads will include a video asset, while others do not. Apps can use the
// GADVideoController's hasVideoContent property to determine if one is present, and adjust their
// UI accordingly.
let mediaContent = ad.mediaContent
if mediaContent.hasVideoContent, let delegate = videoControllerDelegate {
// By acting as the delegate to the GADVideoController, this ViewController receives messages
// about events in the video lifecycle.
mediaContent.videoController.delegate = delegate
}
}
}
Event Monitoring
The Admob SDK provides a delegate to monitor events during the ad life cycle and help you customize the ad experience in your apps.
protocol GADNativeAdDelegate {
// When an event click has been fired
func nativeAdDidRecordClick(_ nativeAd: GADNativeAd)
// When an impression has occured
func nativeAdDidRecordImpression(_ nativeAd: GADNativeAd)
...
}
Combining Custom-Rendered Native Ad and Banner Ad Requests
The GADAdLoader object offers the flexibility to customize ad requests, allowing them to yield either banner or native ads. By including GADAdLoaderAdTypeGAMBanner in the adTypes array parameter during the creation of the GADAdLoader object, along with native ad types like GADAdLoaderAdTypeNative, you indicate that banner ads should be considered alongside native ads in the competition to fulfill the request.
import TeadsAdMobAdapter
adLoader = GADAdLoader(adUnitID: pid, rootViewController: self,
adTypes: [ .native, **.gamBanner** ], options: nil)
adLoader?.delegate = self
let adSettings = TeadsAdapterSettings { settings in
settings.enableDebug()
settings.pageUrl("https://example.com/article1")
}
let request = GADRequest()
// 4. Register adSettings to the request
request.register(adSettings)
adLoader.load(request)
Mediation settings
Find the full settings list in Settings Configuration — TeadsAdapterSettings.
You never call Teads SDK directly in this integration. Google Mobile Ads loads Teads through the adapter, and your code uses Google's interstitial API only.
- Install and register the adapter.
- Create the Teads custom event in Google Ad Manager or AdMob.
- Load the interstitial before you need it.
- Show it at a natural transition point.
- Load the next one after it closes.
Step 1: Install and register the adapter
Install TeadsAdMobAdapter as described in Installation, then call TeadsAdMobMediation.register() before MobileAds.shared.start(), as shown in Register the Adapter. The adapter initializes Teads SDK itself.
Without register(), or -ObjC in Other Linker Flags, Release builds can strip the adapter class. Nothing crashes and no error appears, but Teads never fills.
Step 2: Create the Teads custom event
Custom Event Parameters
The custom event parameter must be a JSON string containing the following fields:
| Parameter | Type | Required | Description |
|---|---|---|---|
| articleUrl | String | Yes | The URL of the article/page |
| widgetId | String | Yes | Teads widget ID |
| installationKey | String | Yes | Teads installation key |
| pbf | Double | No | Floor price in US dollars. Forwarded to the auction as the placement floor price. |
Example JSON parameter, using the test configuration:
{"articleUrl":"https://mobile-demo.outbrain.com","widgetId":"INT_APP_1","installationKey":"NANOWDGT01"}
Replace these values with your own widget ID and installation key before release.
Google Ad Manager
In the yield group that serves your interstitial ad unit, add Teads as a yield partner with the Custom event integration type, using the values below. See Google's custom event documentation for the Ad Manager steps.
| Name | Value |
|---|---|
| Class Name | GADMAdapterTeadsInterstitial |
| Parameter | JSON string (see above) |
AdMob
In the mediation group that serves your interstitial ad unit, add a custom event using the values below. See Google's custom event documentation for the AdMob dashboard steps.
| Name | Value |
|---|---|
| Class Name | GADMAdapterTeadsInterstitial |
| Parameter | JSON string (see above) |
Type GADMAdapterTeadsInterstitial with no module prefix. The adapter exposes the class to Objective-C under that exact name.
Step 3: Load the interstitial
Load the ad ahead of the moment you want to show it, for example in viewDidLoad. The examples use Google Ad Manager classes:
import GoogleMobileAds
import UIKit
class ArticleViewController: UIViewController {
// Keep a strong reference until the ad is shown
private var interstitialAd: AdManagerInterstitialAd?
override func viewDidLoad() {
super.viewDidLoad()
loadInterstitial()
}
private func loadInterstitial() {
AdManagerInterstitialAd.load(
with: "/1234567/your_interstitial_ad_unit", // Your Ad Manager ad unit
request: AdManagerRequest()
) { [weak self] ad, error in
if let error {
print("Interstitial failed to load: \(error.localizedDescription)")
return
}
self?.interstitialAd = ad
self?.interstitialAd?.fullScreenContentDelegate = self
}
}
}
For AdMob, the code is the same with these changes. They also apply to the extras example below:
| Google Ad Manager | AdMob | |
|---|---|---|
| Ad unit ID | /1234567/your_interstitial_ad_unit | ca-app-pub-XXXXXXXXXXXXXXXX/NNNNNNNNNN |
| Ad class (Swift) | AdManagerInterstitialAd | InterstitialAd |
| Request class (Swift) | AdManagerRequest | Request |
| Ad class (Objective-C) | GAMInterstitialAd | GADInterstitialAd |
| Request class (Objective-C) | GAMRequest | GADRequest |
| Load method (Objective-C) | loadWithAdManagerAdUnitID:request:completionHandler: | loadWithAdUnitID:request:completionHandler: |
Step 4: Show the interstitial
At your transition point, show the ad if one is loaded. If not, carry on without it.
func showInterstitialIfReady() {
guard let interstitialAd else { return }
interstitialAd.present(from: self)
}
Step 5: Handle events and load the next interstitial
A Google Mobile Ads interstitial can be shown only once. Release it and load a new one when it closes, or when it fails to show:
extension ArticleViewController: FullScreenContentDelegate {
func adWillPresentFullScreenContent(_ ad: FullScreenPresentingAd) {
// Pause audio, video and timers
}
func adDidDismissFullScreenContent(_ ad: FullScreenPresentingAd) {
// Resume your app, then load the next interstitial
interstitialAd = nil
loadInterstitial()
}
func ad(_ ad: FullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
print("Interstitial failed to show: \(error.localizedDescription)")
interstitialAd = nil
loadInterstitial()
}
}
Impressions and clicks are reported to Google Mobile Ads by the adapter. adDidRecordImpression(_:) and adDidRecordClick(_:) are available if you want to track them. The click URL opens automatically.
Overriding Parameters via Extras (Optional)
You can override the custom event parameters programmatically using TeadsAdapterSettings. This is useful for testing or when you need to change parameters at runtime:
- Swift
- Objective-C
import GoogleMobileAds
import TeadsAdMobAdapter
import TeadsSDK
let request = AdManagerRequest()
let adSettings = TeadsAdapterSettings { settings in
settings.addExtras("https://mobile-demo.outbrain.com", for: "articleUrl")
settings.addExtras("INT_APP_1", for: "widgetId")
settings.addExtras("NANOWDGT01", for: "installationKey")
settings.setFloorPrice(0.5) // Optional floor price in US dollars
}
request.register(adSettings)
AdManagerInterstitialAd.load(with: "/1234567/your_interstitial_ad_unit", request: request) { ad, error in
// ...
}
@import GoogleMobileAds;
@import TeadsAdMobAdapter;
@import TeadsSDK;
GAMRequest *request = [GAMRequest request];
TeadsAdapterSettings *adSettings = [[TeadsAdapterSettings alloc] initWithBuild:^(TeadsAdapterSettings *settings) {
[settings addExtras:@"https://mobile-demo.outbrain.com" for:@"articleUrl"];
[settings addExtras:@"INT_APP_1" for:@"widgetId"];
[settings addExtras:@"NANOWDGT01" for:@"installationKey"];
[settings setFloorPrice:0.5]; // Optional floor price in US dollars
}];
[request registerAdNetworkExtras:adSettings];
[GAMInterstitialAd
loadWithAdManagerAdUnitID:@"/1234567/your_interstitial_ad_unit"
request:request
completionHandler:^(GAMInterstitialAd * _Nullable ad, NSError * _Nullable error) {
// ...
}];
When extras are provided, they take priority over the custom event parameters configured in the AdMob/GAM dashboard.
setFloorPrice(_:) takes a Double from SDK 6.3.0 (an Int in earlier versions). Values of zero or less are ignored.
Ad Cache TTL
Interstitial ads have a cache TTL (time-to-live) configured server-side via the widget settings. Once loaded, the ad must be presented within this window or it expires. The default TTL is 3600 seconds (1 hour).
If the ad expires before being shown, ad(_:didFailToPresentFullScreenContentWithError:) is called on your FullScreenContentDelegate.
Mediation settings
Find the full custom-event JSON parameter list in Settings Configuration — Interstitial (AdMob Mediation).
This section shows you how to deliver Teads anchored Banner ads on your application using the AdMob mediation adapter.
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.
| Name | Value |
|---|---|
| Class Name | GADMAdapterTeadsBanner |
| Parameter | JSON 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).
| Parameter | Type | Required | Description |
|---|---|---|---|
| articleUrl | String | Yes | The URL of the article/page |
| widgetId | String | Yes | Teads widget ID |
| installationKey | String | Yes | Teads installation key |
| widgetIndex | Int | No | Index when multiple widgets share the same page (default 0) |
| userId | String | No | Publisher-provided user identifier |
| darkMode | Bool | No | Enable dark mode theme (default false) |
| extId | String | No | External tracking id |
| extSecondaryId | String | No | Secondary external tracking id |
| obPubImp | String | No | Publisher impression id override |
| pbf | Double | No | Floor 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"}
Production articleUrl, widgetId, and installationKey come from your account manager.
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())
}
}
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 custom-event JSON parameter list in Settings Configuration — Banner (AdMob Mediation).
Checklist
- ✅ Ensure Brand Safety is enabled
- ✅ Ensure you comply with privacy legal requirements (GDPR/CCPA/GPP)
- ✅ Comply with app-ads.txt
- ✅ Implement proper error handling
- ✅ Test on different devices and screen sizes
- ✅ Enable ad view resizing for Media
- ✅ Test different PIDs with various ad formats and sizes. See Test PIDs and Configurations
- ✅ Test with different JSON parameter configurations for Interstitial and Banner