Skip to main content

Smart AdServer mediation

This article shows you how to deliver Teads ads on your application using the Smart Ad Server Mediation adapter.


Sample App

The official Teads SDK sample application includes working Smart AdServer integrations. Use it for implementation examples and as a reference while you set up this adapter.

Teads Android Sample App on GitHub

Prerequisites​

Installation​

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

Gradle​

project/build.gradle

allprojects {
repositories {
...
maven { url "https://teads.jfrog.io/artifactory/SDKAndroid-maven-prod" }
maven { url 'https://packagecloud.io/smartadserver/android/maven2' }
}
}

app/build.gradle

dependencies {
...
implementation 'com.smartadserver.android:smart-core-sdk:7.14.0@aar'
implementation ("com.smartadserver.android:smart-display-sdk:7.14.0@aar") {
transitive = true
}
// Teads inApp SDK
implementation("tv.teads.sdk.android:sdk:6.2.3@aar") {
transitive = true
}

// Teads Smart Adapter
implementation 'tv.teads.sdk.android:smartadapter:6.2.3'
}

Defining a Custom Event​

In order to display a Teads ad using Smart, you need to create a custom event.

NameValue
SDK NameTeadsSDK
Ad Format TypeBanner
Adapter Classtv.teads.adapter.smart.SmartAdapter
Placement Info{ "placementId": #PID#, "teadsAdSettingsKey": "[sas_kw | teadsAdSettingsKey]" }
Production PID

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

Formats​

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

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 bannerPlacement = SASAdPlacement(
siteID,
pageName,
formatID,
SmartHelper.getTargetFromTeadsAdSettings(settings),
supplyChainObjectString
)

Mediation settings​

Find the full settings list in Settings Configuration — TeadsMediationSettings.

Checklist​