Banner Cache

Integrate Banner Cache

The banner cache is a special tool to help you integrate infeed banners more easily. It will wrap an infeed banner and use it to automatically preload banner ads, aiming to have a defined amount of banners available for an immediate handout to the app whenever they are needed. Compared to using the infeed banner directly, it comes with the following

Pros

  • Automatically caches banner ads, so your app can consume and present them whenever needed (i.e. when the dedicated feed cell enters the visible area of the screen)

  • Automatically takes care of correct ad space counting (it counts an ad space whenever you try to consume an ad because we assume, you only consume an ad when you need to present it right now).

  • Allows server-side configuration of frequency capping: You can configure frequency capping for banner cache placements within the Dashboard at page "Settings / Placements" (e.g. show not more than 1 impression per hour), so you don’t need to implement frequency capping yourself.

Cons

  • You cannot specify specific configurations for the ad request (like e.g. keyword targeting X for the first ad request and keyword targeting Y for the next one and so on) and control the load cycle of a specific ad.

We strongly recommend using the banner cache instead of the infeed banner, unless you actually need to control the ad request configuration separately per loaded ad (e.g. in very specific targeting scenarios per ad position in the feed).

Create Banner Cache

let configuration = AATBannerCacheConfiguration(placementName: "<PLACEMENT_NAME>", size: 3)
configuration.delegate = self
bannerCache = AATSDK.createBannerCache(configuration: configuration)

AATBannerCacheConfiguration can be configured with the following:

  • placementName defines the name of the internally wrapped placement (e.g. important for the statistics on the Dashboard).

  • size defines how many preloaded banners should be available in the cache. Max value: 5.

Starting with AATKit 3.15, you can skip the size parameter to let banner the cache try to automatically adjust its size.

We recommend starting with a cache size of 1 and testing, if all your ad spaces get filled. If not, increase the cache size by 1 and repeat your test. The general rule should be: use the smallest possible cache size to achieve good fill rates but avoid waisting ads at the same time. Waisted ads may influence paid prices in a negative way.

  • delegate an instance of AATBannerCacheDelegate that will notify you when the first banner is loaded and ready to be consumed.

  • requestConfiguration an instance of AATBannerRequest that will be used internally for requesting banner ads from the AATInfeedBannerPlacement.

  • minDelay represents the minimum delay between two banner consumptions in seconds. Useful to prevent consuming too many ads when the user is fast scrolling. Default: 1 s.

  • shouldCacheAdditionalAdAtStart defines if the cache should load an additional ad at the beginning. false by default.

Configure Banner Request

See the banner request configuration for infeed banner placement.

Consume Banners

To consume banners, use this API: func consume(force: Bool = false) -> AATBannerPlacementWrapperView?. It returns an instance of UIView to be used within the app. Can return nil if there are no banners available in the cache. Also automatically counts an ad space. BannerCache will no longer hold any references to returned banners, and they need to be destroyed manually by the app.

If the force parameter is true, the minDelay parameter of the AATBannerCacheConfiguration instance will be ignored.

Cache Status Delegate

To listen to the banner cache status, conform to the AATBannerCacheStatusDelegate and set the banner cache cacheStatusDelegate property.

Complete Code Example

Last updated