Network-Key Replacement
This feature enables you to replace the Infeed-Banner placement and Banner Cache network keys with custom values you provide.
It substitutes placeholders enclosed in curly brackets (
{}
) within the ad network key orextraInfo
with corresponding values from your dictionary. For example:request.networkKeyReplacements = [ "key1": "value1", "key2": "value2", "anotherKey": "anotherValue" ]
A network key like
1234:{key1}-{anotherKey}
will be transformed into1234:value1-anotherValue
.
Infeed Banner Example
let configuration = AATBannerConfiguration()
placement = AATSDK.createInfeedBannerPlacement(name: "<PLACEMENT_NAME>", configuration: configuration)
// Set placement delegate to listen to the callbacks
placement.delegate = self
// Create the banner request instance
let request = AATBannerRequest(delegate: self)
// Set network-key replacement
request.networkKeyReplacements = [
"key1": "value1",
"key2": "value2",
"anotherKey": "anotherValue"
]
// Perform the request
placement?.requestAd(request: request, completion: {[weak self] bannerView, error in
guard error == nil else {
// Handle Error
return
}
let adInfo = adView.adInfo
// Handle banner display
})
Banner Cache Example
let configuration = AATBannerCacheConfiguration(placementName: "<PLACEMENT_NAME>", size: 1)
configuration.delegate = self
// Create the banner request instance
let request = AATBannerRequest(delegate: self)
// Set network-key replacement
request.networkKeyReplacements = [
"key1": "value1",
"key2": "value2",
"anotherKey": "anotherValue"
]
// Set configuration banner request
configuration.requestConfiguration = request
// Create the banner cache (once it has been created, it would start loading automatically)
bannerCache = AATSDK.createBannerCache(configuration: configuration)
Last updated