Smart AdServer mediation - inRead

  1. Prerequisites
  2. Installation
  3. Manually
  4. Defining a Custom Event
  5. Integration
  6. Ad Resizing
  7. Mediation settings

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

Using CocoaPods to have Teads Smart Ad Server mediation plugin will automatically import the Teads inApp SDK framework.

Sample App on GitHub
Teads inApp SDK iOS sample App


  • Platform: iOS 14.5+
  • Xcode: 12.5+
  • Smart-Display-SDK 7.6.2+


Before installing the Teads SAS adapter, you will need to integrate Smart Ad Server 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 TeadsSASAdapter your Podfile:
pod 'TeadsSASAdapter', '~> 5.1'
  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 TeadsSASAdapter.
  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 Smart Ad, you need to create a custom event.

See this article for more test PIDs serving different creative formats.

Name Value
SDK Name TeadsSDK
Ad Format Type Banner
Adapter Class TeadsSASAdapter.TeadsSASBannerAdapter
Placement Info { "placementId": #PID#, "teadsAdSettingsKey": "[sas_kw | teadsAdSettingsKey]" }


Don't forget to replace the #PID# with your Teads placement ID.



Check out the sample ViewController from our iOS GitHub repository

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

  • Concat your existing keywordsTargeting using TeadsSASAdapterHelper.concatAdSettingsToKeywords.
  • Create SASAdPlacement with your keywordsTargeting
let settings = TeadsAdapterSettings { settings in

let webSiteId = #WebSiteId
let pageId = #PageId
let formatId = #formatId
var keywordsTargetting = "yourkeyword=something"
keywordsTargetting = TeadsSASAdapterHelper.concatAdSettingsToKeywords(keywordsStrings: keywordsTargetting, adSettings: teadsAdSettings)

// Create a placement
let adPlacement = SASAdPlacement(siteId: webSiteId, pageId: pageId, formatId: formatId, keywordTargeting: keywordsTargetting)

banner?.load(with: adPlacement)

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

var sasAdView: SASBannerView!
@IBOutlet weak var slotHeight: NSLayoutConstraint! // set to 0 on InterfaceBuilder

let adSettings = TeadsAdapterSettings { settings in
    settings.registerAdView(sasAdView, 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 you are responsible to retain it and destroy it when you don't need it anymore:

func didUpdateRatio(_ adView: UIView, adRatio: TeadsAdRatio) {
    let height = adRatio.calculateHeight(for: slotView.frame.width) // call calculateHeight
    slotHeight.constant = height //update NSLayoutConstraint of the slot

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.