Login
Welcome
Login

AdMob - Google Ad Manager

On this page


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 TeadsSDK framework.

Requirements

  • Android SDK: 16+
  • GoogleMobileAds SDK: 12.0.1+
  • Platform: iOS 9+
  • Xcode: 9.0+
  • GoogleMobileAdsSDK: 7.31+

Limitation

The mediated slot size cannot be modified externally. Teads can't resize the slot to the ratio that fits square nor vertical creatives. As a consequence, only landscape creatives are compatible ( LARGE_BANNER and MEDIUM_RECTANGLE)

The mediated slot size cannot be modified externally. Teads can't resize the slot to the ratio that fits square nor vertical creatives. As a consequence, only landscape creative are compatible (kGADAdSizeMediumRectangle or similar size only)

Installation

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

Gradle

app build.gradle

// Teads Repository
repositories{
maven {
url "http://dl.bintray.com/teads/TeadsSDK-android"
}
}

Next, in the same file, edit the app dependencies node:

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'

// Required dependency
implementation 'com.google.android.gms:play-services-basement:12.0.1'

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

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

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

CocoaPods

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 SDK.

  1. Add pod named GoogleMobileAdsMediationTeadsin your Podfile:
    platform :ios, ‘9.0’
    pod ‘GoogleMobileAdsMediationTeads’
  2. Run pod install --repo-update to install the adapter in your project.
  3. Follow the Defining a Custom Event step below to finish the integration.

Manually

  1. Integrate the latest version of the Teads 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.

AdMob Google Ad Manager
Define a custom event following this link on the AdMob dashboard using the below values.
AdMob Google Ad Manager

Define a custom event following this link on the AdMob dashboard using the below values.

Name
Value
Class Name
tv.teads.adapter.admob.TeadsAdapter
  • v4.6.0 and above TeadsAdMobAdapter.GADMAdapterTeadsBanner
  • v4.5.0 and below GADMAdapterTeadsBanner
Parameter
Teads placement ID (PID)

Migrating from v4.5.0 (and below) to v4.6.0 (and above)

To handle v4.5.0 (and below) and v4.6.0 (and above) at the same time: define 2 custom events following

  1. Custom Event
    Name
    Value
    Class Name
    TeadsAdMobAdapter.GADMAdapterTeadsBanner
    Parameter
    Teads placement ID (PID)
  2. Custom Event
    Name
    Value
    Class Name
    GADMAdapterTeadsBanner
    Parameter
    Teads placement ID (PID)

Mediation settings

You have the ability to pass extra parameters in order to customize third-party ad network settings. For Teads, you need to use TeadsAdNetworkExtras class to pass extra parameters.

  1. Create an instance of TeadsAdNetworkExtras.
  2. Populate it with your custom settings.
  3. Set the userConsent to be compliant with GDPR.
  4. Set the UsPrivacy to be compliant with CCPA.
  5. Set the pageUrl if you are in article placement to enable brand safety
  6. Register it into AdRequest using addCustomEventExtrasBundle.
  7. Teads ads will receive your specific custom settings when it will load.
// Create extra parameters for Teads
TeadsAdNetworkExtras.Builder extrasBuilder = new TeadsAdNetworkExtras.Builder()
.enableDebug()
.userConsent("subjectToGDPR", "consentString")
.setUsPrivacy("1YNN")
.hideBrowserUrl()
.pageUrl("https://page.com/article1/");

TeadsAdNetworkExtras extras = extrasBuilder.build();

// AdMob: Create ad request
AdRequest adRequest = new AdRequest.Builder()
.addCustomEventExtrasBundle(TeadsAdapter.class, extras.getExtras())
.build();

// GAM: Create ad request
PublisherAdRequest request = new PublisherAdRequest.Builder()
.addCustomEventExtrasBundle(TeadsAdapter.class, extras.getExtras())
.build();

You have the ability to pass extra parameters in order to customize third-party ad network settings. For Teads, you need to use GADMAdapterTeadsExtras class to pass extra parameters.

  • Create an instance of GADMAdapterTeadsExtras
  • Populate it with your custom settings. 
  • Register it into GADRequest using registerAdNetworkExtras: method.
// Setup ad request
let request = GADRequest() // DFPRequest() for GAM
// Add extra parameters for Teads network
let adSettings = TeadsAdSettings { (settings) in
settings.setUsPrivacy(consent: "1YNN")
settings.enableDebug() // For test purposes
}
request.register(adSettings, for: "__custom_event_label__")

// Load banner
let banner = GADBannerView(adSize: MediationConstants.AdMobBannerAdSize)
banner.adUnitID = adUnitID
banner.delegate = self
banner.rootViewController = self
banner.load(request)

Important

You need to replace __custom_event_label__ by the name defined in the AdMob/GAM dashboard for the Custom Event Label parameter.

It's the name of your custom event.

Here is a list of available extra parameters:

SettingsDescription
enableDebug()Enable debug logs from Teads SDK.
enableLigtEndScreen()Enable light mode for the end screen
disableLocation()Disable the collection of user location. By default, SDK will collect user location if corresponding permissions have been granted to the host application.
disableMediaPreload()Disable preload of media files (like videos). If disabled, media files will be loaded lazily.
pageUrl(_ urlString: String)The publisher equivalent web page URL (for brand safety purposes).
userConsent(subjectToGDPR: String, consent: String) The user consent, European regulation requirement, see the GDPR consent management documentation
disableTeadsAudioSessionManagement()Disable audio session management
enableValidationMode()Enable validation tool session, see the Validate your integration section
disableCrashMonitoring()Disable crash monitoring, see the Crash monitoring documentation

Ad Containers

Important

adContainerId is deprecated since Android SDK v4.3.0. The metric associated with it has been replaced. Contact your Teads Publisher Manager to verify that you don't need this metric before removing the related code.

In order to provide you with accurate stats and optimize your revenues, it's necessary to give the ad container to the Teads ad view. This will allow us to determine ad opportunities.

The Ad container is the view in which you will add the ad view. In the case of the AdMob/GAM mediation, you can provide it thanks to TeadsAdNetworkExtras.

TeadsAdNetworkExtras.Builder extrasBuilder = new TeadsAdNetworkExtras.Builder()
.adContainerId(mBannerAdContainer.getId());

Did you find it helpful? Yes No

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