广告定位

您可以使用 Yandex Mobile Ads SDK API 添加额外的用户信息。 向请求中添加上下文数据可显著提升广告质量进而增加收入。

设置定位

您可以在创建 AdRequest 时通过 AdTargeting 传递用户信息。

您可以提供以下用户信息:

参数

描述

age

用户年龄:数字。

gender

用户的性别: Gender.male, Gender.female。

location

由您的应用检测到的用户的位置。

contextQuery

用户在应用中的搜索查询。

例如,如果用户搜索汽车,此参数可能如下:"在莫斯科购买二手车"。

contextTags

用户正在查看的页面中的关键字。 可能是页面的标题、页面的部分内容、标签及其他元素。

对于包含汽车搜索的页面,此参数可能为: "购买汽车"、"二手车"、"在莫斯科"。

定位示例 (Swift)

所有广告格式

let targeting = AdTargeting(
    age: 20,
    gender: .male,
    location: CLLocation(latitude: 1, longitude: 2),
    contextQuery: "Buy a used car in Moscow",
    contextTags: ["Buy a car", "used car", "in Moscow"]
)
let request = AdRequest(adUnitID: "your_block_id", targeting: targeting)

自适应内联和粘性横幅

let request = AdRequest(adUnitID: "your_block_id", targeting: targeting)
bannerAdView.loadAd(with: request)

插屏广告、激励广告和开屏广告

let request = AdRequest(adUnitID: "your_block_id", targeting: targeting)
interstitialAdLoader.loadAd(with: request) { result in ... }

原生广告

let request = AdRequest(adUnitID: "your_block_id", targeting: targeting)
let options = NativeAdOptions()
adLoader.loadAd(with: request, options: options) { result in ... }
下一篇