# Network-Key Replacement

{% hint style="info" %}
This feature is designed for very specific use cases only. Please consult your Account Manager before using it.
{% endhint %}

* 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 or `extraInfo` with corresponding values from your dictionary. For example:
  * ```swift
    request.networkKeyReplacements = [
      "key1": "value1",
      "key2": "value2",
      "anotherKey": "anotherValue"
    ]
    ```
  * A network key like `1234:{key1}-{anotherKey}` will be transformed into `1234:value1-anotherValue`.

#### Infeed Banner Example

```swift
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

```swift
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)
```
