Login
Welcome
Login

Standard Prebid Integration - TeadsPBMPluginRenderer

  1. Prerequisites
  2. Installation
  3. Register the Teads plugin renderer
  4. TeadsMediationSettings
  5. Specify contextUrl targeting
  6. Ad Formats
  7. Ad Request
  8. Ad Listener
  9. Ad Resizing
  10. Plugin Renderer under the hood
  11. Prebid Server setup
  12. Check list

This article shows you how to deliver Teads ads on your application using the Prebid Mobile SDK.

Currently to integrate Teads with Prebid SDK it is mandatory to integrate as well our Plugin Renderer since Teads works with non standard ad formats.

Notice that this guide assumes that you are familiar with Prebid.

Sample Teads App on GitHub
Teads inApp SDK Sample App

Sample Prebid App on GitHub
Prebid Internal Test App

Prerequisites

Installation

Before installing the Teads Prebid adapter, you will need to integrate Prebid 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 'org.prebid:prebid-mobile-sdk:2.1.6' // or higher

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

  // Teads Prebid Adapter
  implementation 'tv.teads.sdk.android:prebidadapter:5.1.x' // or higher
}

Register the Teads plugin renderer

You need to register the Teads plugin renderer. Such registration can be done just once during the initialisation of your Application class or Activity class.
By doing this the Prebid SDK gets ready to delegate the ad rendering for Teads SDK once Teads is the one returning an ad response.

import org.prebid.mobile.PrebidMobile
import tv.teads.adapter.prebid.TeadsPBMPluginRenderer

PrebidMobile.registerPluginRenderer(TeadsPBMPluginRenderer(context))

TeadsMediationSettings

You can also pass in the plugin renderer constructor a TeadsMediationSettings class.

import org.prebid.mobile.PrebidMobile
import tv.teads.adapter.prebid.TeadsPBMPluginRenderer
import tv.teads.sdk.TeadsMediationSettings

val teadsMediationSettings = TeadsMediationSettings().Builder.build()

val teadsPluginRenderer = TeadsPBMPluginRenderer(
        context = context,
        teadsMediationSettings = teadsMediationSettings
)

PrebidMobile.registerPluginRenderer(teadsPluginRenderer)

Find the full settings list here

Specify contextUrl targeting

Set the publisher http page url that matches the content where Teads ad will be loaded.
This values helps to target context and also guaranty brand safety to our advertisers.

import org.prebid.mobile.TargetingParams

TargetingParams.addExtData("contextUrl", "https://example.com/my_article_1")

Find more about the Prebid SDK targeting parameters here.

Ad Formats

Currently the Teads plugin renderer supports Banner only.

ℹ️ Notice that banners could serve image and video as well according to your banner ad unit setup.

If you make use of other ad formats in your Prebid SDK implementation, other demand partners will continue to be able to serve your bid requests normally.

Find more about the Prebid SDK ad formats here.

Ad Request

No additional step should be made on your app implementation in order to request ads, just integrate your Prebid BannerView normally according to the Prebid SDK docs.

Find more about Prebid SDK ad request here.

Ad Listener

To be fully aware of Teads ad lifecycle, subscribe on your Prebid BannerView to the TeadsPBMEventListener interface.

import org.prebid.mobile.api.rendering.BannerView
import tv.teads.adapter.prebid.TeadsPBMEventListener

bannerView?.setPluginEventListener(object : TeadsPBMEventListener {    
    fun onAdRatioUpdate(adRatio: AdRatio) { }
    fun onAdExpandedToFullscreen() { }
    fun onAdCollapsedFromFullscreen() { }
    fun onFailToReceiveAd(failReason: String) { }
})

Other ad events such as onAdClicked, onAdDisplayed and so on can be listened by implementing Prebid BannerViewListener and BannerVideoListener interfaces directly.

Find more about all available listeners directly on the Prebid SDK samples [here](Prebid Internal Test App).

Ad Resizing

This part is a must and not implementing it will drastically affect the fill rate from Teads demand.

Having the ad creative correctly rendered is crucial to ensure great user experience and good performance measurement.

Allowed by VPAID standard; ads can adopt modular dimensions and ratio in place of pre-defined fixed sizes making necessary to be able to dynamically adapt the size and ratio of the ad view depending on the loaded creative.

Even though resize requests occur generally in the ad initialisation steps, it is necessary to be able to satisfy them all along the ad experience.

No action is required if the height constraint of the ad view (and its parent) is set to "wrap_content". The ad View will natively adapt to the requested ratio.

In the other case, it is mandatory to programmatically adapt the size of the Ad container.
The Teads inApp SDK will notify you each resize request coming from the creative.

AdRatio contains all information to calculate the corresponding height for the requested width.
Use calculateHeight to ease the calculation.

See the sample below where the containerAdView is the view group that encapsulates your BannerView

import org.prebid.mobile.api.rendering.BannerView
import tv.teads.adapter.prebid.TeadsPBMEventListener

bannerView?.setPluginEventListener(object : TeadsPBMEventListener {    
    fun onAdRatioUpdate(adRatio: AdRatio) {
        val adViewParams = containerAdView.layoutParams

        adViewParams.height = adRatio.calculateHeight(bannerView.measuredWidth)
        containerAdView.layoutParams = adViewParams
    }


    fun onAdExpandedToFullscreen() { }
    fun onAdCollapsedFromFullscreen() { }
    fun onFailToReceiveAd(failReason: String) { }
})

Plugin Renderer under the hood

If you look for more understanding regarding how a plugin renderer works over the Prebid Mobile SDK, please find more here.

Prebid Server setup

Notice that in order to turn your Teads plugin renderer fully functional and leverage from Teads demand you need to wire the Teads Adapter to your Prebid Server, please find more here.

The following configuration for each of your ad slots name is required:

{
  "name": "imp-300x250-banner"
}

A placement id provided by your publisher manager is required as the sample below:

{
  "ext": {
    "teads": {
      "placementId": 204344
    }
  }
}

Check list

  • ✅ Register the Teads plugin renderer
  • ✅ Subscribe to the event listeners
  • ✅ Implement ad view resizing
  • ✅ Setup your Prebid Server with the Teads Adapter
  • ✅ Ensure Brand Safety is enabled
  • ✅ Ensure you comply with privacy legal requirements (GDPR/CCPA).
  • ✅ Comply with app-ads.txt

Did you find it helpful? Yes No

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