Google Ad Manager and AdMob mediation - inRead

This article shows you how to deliver Teads ads on your application using the AdMob adapter or Google Ad Manager (GAM) Mediation adapter.

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

Sample App on GitHub
Teads inApp SDK iOS sample App


  • Platform: iOS 10+
  • Xcode: 12.1+
  • GoogleMobileAdsSDK: >=7.59


Before installing the Teads AdMob adapter, you will need to integrate GoogleMobileAds SDK into your application.


If your project is managing dependencies through CocoaPods, you just need to add this pod in your Podfile.

It will install the Teads adapter along with the Teads inApp SDK.

  1. Add Pod named TeadsAdMobAdapter in your Podfile:
pod 'TeadsAdMobAdapter', '~> 5.0'
  1. Run the following to install the adapter in your project.
$ pod install --repo-update to install
  1. Follow the Defining a Custom Event step below to finish the integration.


  1. Integrate the latest version of the Teads inApp SDK to your project.
  2. Download the latest release of TeadsAdMobAdapter.
  3. Drop adapter files in your iOS project.
  4. Follow the Defining a Custom Event step below to finish the integration.

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 this article for more test PIDs serving different creative formats.


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

Name Value
Class Name TeadsAdMobAdapter.GADMAdapterTeadsBanner
Parameter Teads placement ID (PID)

Follow the custom event documentation on Google Ad Manager using the below values.

Name Value
Class Name TeadsAdMobAdapter.GADMAdapterTeadsBanner
Parameter Teads placement ID (PID)


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 GADMAdapterTeadsExtras, using GADMAdapterTeads.customEventExtra.
  • Specify the label used in your configuration (default Teads). Note that if the label is not identical to the one you use on Google dashboard it will not work, this is a common error so please double-check that your label is correct.
  • Populate it with your custom settings.
  • Register it into GADRequest calling register
// 1. Create AdMob view and add it to hierarchy
admobAdView = GAMadmobAdView(adSize: kGADAdSizeFluid)

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

let customEventExtras = GADMAdapterTeads.customEventExtra(with: adSettings, for: "[YOUR_LABEL_HERE]")

let request = GADRequest()


Ad Resizing

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 GAMadmobAdView that need to be resized.

var admobAdView: GAMadmobAdView!
@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)

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 it goes garbage collected when you don't need it anymore:

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 GAMadmobAdView

Mediation settings

Find the full settings list here

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.