Settings for Adfox
Adfox allows the application owner to directly negotiate with advertisers about ad placement using the same Mobile Ads SDK as for standard monetization through an open auction. More in this article.
Adfox supports multiple ad types:
- Adaptive inline banner
- Adaptive sticky banner
- Interstitial ads
- Native ads
Adaptive inline banner
To enable an adaptive inline banner, follow the instructions. In addition, use the AdRequest
class to transmit the code received in the Adfox interface (for more information, see Adfox Help):
// Code from the Adfox interface for working with direct campaigns.
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)
Adaptive sticky banner
To enable an adaptive sticky banner, follow the instructions. In addition, use the AdRequest
class to transmit the code received in the Adfox interface (for more information, see Adfox Help):
// Code from the Adfox interface for working with direct campaigns.
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)
Interstitial advertising
To enable an interstitial ad, follow the instructions. In addition, use the AdRequest
class to transmit the code received in the Adfox interface (for more information, see Adfox Help):
// Code from the Adfox interface for working with direct campaigns.
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)
Native ads
To enable a native ad, follow the instructions. In addition, use the MutableNativeAdRequestConfiguration
class to transmit the code received in the Adfox interface (for more information, see Adfox Help).
Code example for loading a single ad:
// Code from the Adfox interface for working with direct campaigns.
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)
Code example for loading multiple ads:
// Code from the Adfox interface for working with direct campaigns.
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)