面向 Adfox 的设置
Adfox 允许应用程序所有者使用与通过公开竞价进行标准变现相同的 Mobile Ads SDK 直接与广告商协商广告投放事宜。详情请参见本文。
Adfox 支持多种广告类型:
- 自适应内联横幅
- 自适应粘性横幅
- 插屏广告
- 原生广告
自适应内联横幅
要启用自适应内联横幅,请按照 说明 进行操作。另外,使用 AdRequest
类来传输 Adfox 界面中接收到的代码(详情请参阅 Adfox 帮助)。
// 来自 Adfox 界面的代码,用于处理直接营销活动。
var parameters = [String: String]()
parameters["adf_ownerid"] = "<example>"
parameters["adf_p1"] = "<example>"
parameters["adf_p2"] = "<example>"
parameters["adf_pfc"] = "<example>"
parameters["adf_pfb"] = "<example>"
parameters["adf_pt"] = "<example>"
parameters["adf_pd"] = "<example>"
parameters["adf_pw"] = "<example>"
parameters["adf_pv"] = "<example>"
parameters["adf_prr"] = "<example>"
parameters["adf_pdw"] = "<example>"
parameters["adf_pdh"] = "<example>"
let request = MutableAdRequest()
request.age = age
request.contextQuery = contextQuery
request.contextTags = contextTags
request.gender = gender
request.location = location
request.parameters = parameters
adView.loadAd(with: adRequest)
自适应粘性横幅
要启用自适应粘性横幅,请按照 说明 进行操作。另外,使用 AdRequest
类来传输 Adfox 界面中接收到的代码(详情请参阅 Adfox 帮助)。
// 来自 Adfox 界面的代码,用于处理直接营销活动。
var parameters = [String: String]()
parameters["adf_ownerid"] = "<example>"
parameters["adf_p1"] = "<example>"
parameters["adf_p2"] = "<example>"
parameters["adf_pfc"] = "<example>"
parameters["adf_pfb"] = "<example>"
parameters["adf_pt"] = "<example>"
parameters["adf_pd"] = "<example>"
parameters["adf_pw"] = "<example>"
parameters["adf_pv"] = "<example>"
parameters["adf_prr"] = "<example>"
parameters["adf_pdw"] = "<example>"
parameters["adf_pdh"] = "<example>"
let request = MutableAdRequest()
request.age = age
request.contextQuery = contextQuery
request.contextTags = contextTags
request.gender = gender
request.location = location
request.parameters = parameters
adView.loadAd(with: adRequest)
插屏广告
要启用插屏广告,请按照 说明 进行操作。另外,使用 AdRequest
类来传输 Adfox 界面中接收到的代码(详情请参阅 Adfox 帮助)。
// 来自 Adfox 界面的代码,用于处理直接营销活动。
var parameters = [String: String]()
parameters["adf_ownerid"] = "<example>"
parameters["adf_p1"] = "<example>"
parameters["adf_p2"] = "<example>"
parameters["adf_pfc"] = "<example>"
parameters["adf_pfb"] = "<example>"
parameters["adf_pt"] = "<example>"
parameters["adf_pd"] = "<example>"
parameters["adf_pw"] = "<example>"
parameters["adf_pv"] = "<example>"
parameters["adf_prr"] = "<example>"
parameters["adf_pdw"] = "<example>"
parameters["adf_pdh"] = "<example>"
let configuration = MutableAdRequestConfiguration(adUnitID: "R-M-XXXXX-YY")
configuration.age = age
configuration.contextQuery = contextQuery
configuration.contextTags = contextTags
configuration.gender = gender
configuration.location = location
configuration.parameters = parameters
interstitialAdLoader = InterstitialAdLoader()
interstitialAdLoader.delegate = self
interstitialAdLoader.loadAd(with: configuration)
原生广告
要启用原生广告,请按照 说明 操作。此外,使用 MutableNativeAdRequestConfiguration
类来传输 Adfox 界面中接收到的代码(详情请参阅 Adfox 帮助)。
加载单个广告的代码示例:
// 来自 Adfox 界面的代码,用于处理直接营销活动。
var parameters = [String: String]()
parameters["adf_ownerid"] = "<example>"
parameters["adf_p1"] = "<example>"
parameters["adf_p2"] = "<example>"
parameters["adf_pfc"] = "<example>"
parameters["adf_pfb"] = "<example>"
parameters["adf_pt"] = "<example>"
parameters["adf_pd"] = "<example>"
parameters["adf_pw"] = "<example>"
parameters["adf_pv"] = "<example>"
parameters["adf_prr"] = "<example>"
parameters["adf_pdw"] = "<example>"
parameters["adf_pdh"] = "<example>"
let requestConfiguration = MutableNativeAdRequestConfiguration(adUnitID: "R-M-XXXXXX")
requestConfiguration.age = age
requestConfiguration.contextQuery = contextQuery
requestConfiguration.contextTags = contextTags
requestConfiguration.gender = gender
requestConfiguration.location = location
requestConfiguration.parameters = parameters
adLoader.loadAd(with: requestConfiguration)
加载多个广告的代码示例:
// 来自 Adfox 界面的代码,用于处理直接营销活动。
var parameters = [String: String]()
parameters["adf_ownerid"] = "<example>"
parameters["adf_p1"] = "<example>"
parameters["adf_p2"] = "<example>"
parameters["adf_pfc"] = "<example>"
parameters["adf_pfb"] = "<example>"
parameters["adf_pt"] = "<example>"
parameters["adf_pd"] = "<example>"
parameters["adf_pw"] = "<example>"
parameters["adf_pv"] = "<example>"
parameters["adf_prr"] = "<example>"
parameters["adf_pdw"] = "<example>"
parameters["adf_pdh"] = "<example>"
let requestConfiguration = MutableNativeAdRequestConfiguration(adUnitID: "R-M-XXXXXX")
requestConfiguration.age = age
requestConfiguration.contextQuery = contextQuery
requestConfiguration.contextTags = contextTags
requestConfiguration.gender = gender
requestConfiguration.location = location
requestConfiguration.parameters = parameters
adLoader.loadAds(with: requestConfiguration, adsCount: adsCount)
这篇文章是否有用?
下一篇