Smart AdServer mediation (legacy)
This article shows you how to deliver Teads ads on your application using the Smart Ad Server Mediation adapter.
TeadsSASAdapter targets Smart Display SDK 7 and is deprecated as of Teads SDK 6.3.0. It gets no further updates; critical fixes only.
- Media / Media Native have no Equativ Display SDK 8 path yet. Stay on this adapter for them.
- Interstitial is new with Equativ Display SDK 8. Use Equativ mediation (
TeadsEquativAdapter). This adapter never served interstitials. - The two adapters cannot be installed in the same target. Pick one generation.
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.
Prerequisites
- Platform: iOS 14+
- Xcode: 26.2+
- Built with Swift 6.2.3
- Smart-Display-SDK 7.6.2+
Installation
Before installing the Teads SAS adapter, you will need to integrate Smart Ad Server SDK into your application.
CocoaPods
CocoaPods Trunk stopped accepting new pod versions on December 2, 2026, so Teads SDK 6.3.0 and later
are not published there. Install the pods from the Teads public repository instead, pinned to a
release tag. List TeadsSDK next to the adapter with the same tag: the adapter requires the same
version of it. To upgrade, change the tag on both lines; version ranges such as ~> 6.3 don't
work with :git.
- Add both pods to your Podfile:
pod 'TeadsSDK', :git => 'https://github.com/teads/TeadsSDK-iOS.git', :tag => '6.3.0'
pod 'TeadsSASAdapter', :git => 'https://github.com/teads/TeadsSDK-iOS.git', :tag => '6.3.0'
- Run the following to install them in your project.
$ pod install
- Follow the Defining a Custom Event step below (in the relevant tab) to finish the integration.
Manually
- Integrate the latest version of the Teads inApp SDK to your project.
- Download the latest release of TeadsSASAdapter.
- Drop adapter files in your iOS project.
- Follow the Defining a Custom Event step below to finish the integration.
Formats
Pick the ad format you are integrating. Each format has its own setup.
- Media
- Native Ad
Defining a Custom Event
In order to display a Teads ad using Smart Ad, you need to create a custom event.
See the SDK documentation 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]" } |
Integration
See 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
SASAdPlacementwith your keywordsTargeting
- Swift
- Objective-C
let settings = TeadsAdapterSettings { settings in
settings.pageUrl("https://example.com/article1")
}
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)
TeadsAdapterSettings *settings = [[TeadsAdapterSettings alloc] initWithBuild:^(TeadsAdapterSettings *settings) {
[settings pageUrl:@"https://example.com/article1"];
}];
NSInteger webSiteId = #WebSiteId;
NSInteger pageId = #PageId;
NSInteger formatId = #formatId;
NSString *keywordsTargetting = @"yourkeyword=something";
keywordsTargetting = [TeadsSASAdapterHelper
concatAdSettingsToKeywordsWithKeywordsStrings:keywordsTargetting
adSettings:teadsAdSettings];
// Create a placement
SASAdPlacement *adPlacement = [[SASAdPlacement alloc]
initWithSiteId:webSiteId
pageId:pageId
formatId:formatId
keywordTargeting:keywordsTargetting];
[self.banner loadWithPlacement: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
- Swift
- Objective-C
var sasAdView: SASBannerView!
@IBOutlet weak var slotHeight: NSLayoutConstraint! // set to 0 on InterfaceBuilder
let adSettings = TeadsAdapterSettings { settings in
settings.registerAdView(sasAdView, delegate: self)
}
@property (nonatomic, strong) SASBannerView *sasAdView;
@property (nonatomic, weak) IBOutlet NSLayoutConstraint *slotHeight; // set to 0 on InterfaceBuilder
TeadsAdapterSettings *adSettings = [[TeadsAdapterSettings alloc] initWithBuild:^(TeadsAdapterSettings *settings) {
[settings registerAdView:self.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:
- Swift
- Objective-C
func didUpdateRatio(_ adView: UIView, adRatio: TeadsAdRatio) {
let height = adRatio.calculateHeight(for: slotView.frame.width) // call calculateHeight
slotHeight.constant = height //update NSLayoutConstraint of the slot
}
- (void)didUpdateRatio:(UIView *)adView adRatio:(TeadsAdRatio *)adRatio {
CGFloat height = [adRatio calculateHeightForWidth:self.slotView.frame.size.width]; // call calculateHeight
self.slotHeight.constant = height; //update NSLayoutConstraint of the slot
}
This native implementation is specifically designed to fit feed views. You can customize the view to look like the other cells around, to offer a more immersive experience.
Defining a Custom Event
In order to display a Teads ad using Smart Ad, you need to create a custom event.
See the SDK documentation for more test PIDs serving different creative formats.
| Name | Value |
|---|---|
| SDK Name | TeadsSDK |
| Ad Format Type | Banner |
| Adapter Class | TeadsSASAdapter.TeadsSASNativeAdapter |
| Placement Info | { "placementId": #PID#, "teadsAdSettingsKey": "[sas_kw | teadsAdSettingsKey]" } |
Integration
See the sample ViewController from our iOS GitHub repository.
You're responsible for positioning the elements (title label, main image, call to action button...). Those elements need to be visible (without overlay, even transparent ones) otherwise our visibility algorithm will consider the ad view as hidden.
Interface
- Add a
SmartNativeAdTableViewCellto the storyboard - Set UI elements as a cell properties
- Make sure to link IBOutlet to Interface Builder
class SmartNativeAdTableViewCell: UITableViewCell {
@IBOutlet public var titleLabel: UILabel?
@IBOutlet public var contentLabel: UILabel?
@IBOutlet public var mediaView: UIView!
@IBOutlet public var iconImageView: UIImageView?
@IBOutlet public var advertiserLabel: UILabel?
@IBOutlet public var callToActionButton: UIButton?
@IBOutlet public var ratingView: UIView?
@IBOutlet public var priceLabel: UILabel?
}
Load an Ad
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
SASAdPlacementwith your keywordsTargeting
- Swift
- Objective-C
let teadsAdSettings = TeadsAdapterSettings { settings in
settings.pageUrl("https://example.com/article1")
}
let adRowNumber = 3
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)
nativeAdManager = SASNativeAdManager(placement: adPlacement)
nativeAdManager?.requestAd { (ad: SASNativeAd?, error: Error?) in
if let nativeAd = ad {
self.elements.insert(nativeAd, at: self.adRowNumber)
self.tableView.reloadData()
} else if let error = error {
print("Unable to load ad: \(error.localizedDescription)")
} else {
print("Unknown error")
}
}
TeadsAdapterSettings *teadsAdSettings = [[TeadsAdapterSettings alloc] initWithBuild:^(TeadsAdapterSettings *settings) {
[settings pageUrl:@"https://example.com/article1"];
}];
NSInteger adRowNumber = 3;
NSInteger webSiteId = #WebSiteId;
NSInteger pageId = #PageId;
NSInteger formatId = #formatId;
NSString *keywordsTargetting = @"yourkeyword=something";
keywordsTargetting = [TeadsSASAdapterHelper
concatAdSettingsToKeywordsWithKeywordsStrings:keywordsTargetting
adSettings:teadsAdSettings];
// Create a placement
SASAdPlacement *adPlacement = [[SASAdPlacement alloc]
initWithSiteId:webSiteId
pageId:pageId
formatId:formatId
keywordTargeting:keywordsTargetting];
self.nativeAdManager = [[SASNativeAdManager alloc] initWithPlacement:adPlacement];
[self.nativeAdManager requestAdWithCompletionHandler:^(SASNativeAd * _Nullable ad, NSError * _Nullable error) {
if (ad) {
[self.elements insertObject:ad atIndex:self.adRowNumber];
[self.tableView reloadData];
} else if (error) {
NSLog(@"Unable to load ad: %@", error.localizedDescription);
} else {
NSLog(@"Unknown error");
}
}];
Store Ad (Sequence)
When implementing native in a tableView or collectionView we suggest to add SASNativeAd inside your sequence structure
private var elements = [SASNativeAd?]()
private var nativeAdManager: SASNativeAdManager?
override func viewDidLoad() {
super.viewDidLoad()
(0..<8).forEach { _ in
elements.append(nil) //nil reprensents all other data of cells
}
...
}
Ad Binding
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if let nativeAd = elements[indexPath.row] {
guard let cell = tableView.dequeueReusableCell(withIdentifier: teadsAdCellIndentifier, for: indexPath) as? SmartNativeAdTableViewCell else {
return UITableViewCell()
}
nativeAd.delegate = self
cell.bind(sasNativeAd: nativeAd)
return cell
}
...
}
Bind SASNativeAd into your cell using custom func bind
extension SmartNativeAdTableViewCell {
func bind(sasNativeAd: SASNativeAd) {
titleLabel?.text = sasNativeAd.title
contentLabel?.text = sasNativeAd.subtitle
if sasNativeAd.hasMedia {
let sasMediaView = SASNativeAdMediaView()
sasMediaView.frame = mediaView.bounds
sasMediaView.registerNativeAd(sasNativeAd)
mediaView.addSubview(sasMediaView)
} else {
sasNativeAd.coverImage?.load { image in
let imageView = UIImageView(image: image)
imageView.frame = self.mediaView.bounds
imageView.contentMode = .scaleAspectFill
self.mediaView?.addSubview(imageView)
}
}
sasNativeAd.icon?.load { image in
self.iconImageView?.image = image
self.iconImageView?.contentMode = .scaleAspectFill
}
advertiserLabel?.text = sasNativeAd.sponsored
callToActionButton?.setTitle(sasNativeAd.callToAction, for: .normal)
priceLabel?.text = sasNativeAd.price
}
}
Load images using a custom extension on SASNativeAdImage
extension SASNativeAdImage {
func load(success: @escaping (UIImage) -> Void) {
let defaultSession = URLSession(configuration: URLSessionConfiguration.default)
let dataTask = defaultSession.dataTask(with: url) { data, urlResponse, error in
if let data = data, let image = UIImage(data: data) {
DispatchQueue.main.async {
success(image)
}
}
}
dataTask.resume()
}
}
Event Monitoring
The Smart Ad Server SDK provides a delegate to monitor events during the ad life cycle and help you customize the ad experience in your apps.
protocol SASNativeAdDelegate {
// When an event click has been fired
func nativeAd(_ nativeAd: SASNativeAd, didClickWith URL: URL)
// Notifies the delegate that a modal view will appear to display the ad's landing page.
func nativeAdWillPresentModalView(_ nativeAd: SASNativeAd)
...
}
Mediation settings
Find the full settings list in Settings Configuration — TeadsAdapterSettings.
Checklist
- ✅ Ensure Brand Safety is enabled
- ✅ Ensure you comply with privacy legal requirements (GDPR/CCPA/GPP)
- ✅ Comply with app-ads.txt
- ✅ Implement proper error handling
- ✅ Enable ad view resizing for Media
- ✅ Test different PIDs with various ad formats and sizes. See Test PIDs and Configurations