Skip to main content

Google Ad Manager and AdMob mediation

This article shows you how to deliver Teads ads on your application using the AdMob adapter or Google Ad Manager (GAM) Mediation adapter, for the Media, Native Ad, Interstitial, and Banner (Anchored) formats.


Sample App

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.

Teads Android Sample App on GitHub

Installation​

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

Gradle​

project/build.gradle

allprojects {
repositories {
...
maven { url "https://teads.jfrog.io/artifactory/SDKAndroid-maven-prod" }
}
}

app/build.gradle

dependencies {
...
implementation 'com.google.android.gms:play-services-ads:23.6.0' // or higher

// Teads inApp SDK
implementation("tv.teads.sdk.android:sdk:6.2.3@aar") {
transitive = true
}

// Teads Admob Adapter
implementation 'tv.teads.sdk.android:admobadapter:6.2.3'
}

Prerequisites​

FormatGoogleMobileAds SDK
Media, Native Ad20+
Interstitial, Banner (Anchored)23.6.0+

Formats​

Pick the ad format you are integrating. Each format has its own setup.

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.

AdMob​

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

NameValue
Class Nametv.teads.adapter.admob.TeadsAdapter
ParameterTeads placement ID (PID)

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

NameValue
Class Nametv.teads.adapter.admob.TeadsAdapter
ParameterTeads placement ID (PID)
Production PID

Production PIDs come from your account manager. See the troubleshooting guide for test PIDs and creative formats.

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.

Initialize the TeadsHelper first.

TeadsHelper.initialize()

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:

listener = object : TeadsAdapterListener {
override fun onRatioUpdated(adRatio: AdRatio) {
val params: ViewGroup.LayoutParams = adView.layoutParams

// Here the width is MATCH_PARENT
params.height = adRatio.calculateHeight(adView.measuredWidth)
adView.layoutParams = params
}

override fun adOpportunityTrackerView(trackerView: AdOpportunityTrackerView) {
}
}

Use the helper to attach a listener, it will return you a UNIQUE key to reference the current listener attached.

val key = TeadsHelper.attachListener(listener)

Finally, add it to your current ad settings for the specific ad request

val settings = TeadsMediationSettings.Builder()
.setMediationListenerKey(key)
.build()

val adRequest = AdRequest.Builder()
.addNetworkExtrasBundle(TeadsAdapter::class.java, settings.toBundle())
.build()

Mediation settings​

Find the full settings list in Settings Configuration — TeadsMediationSettings.

Checklist​