Impression Delegate (ILRD)

Listen to placements' impressions events (Impression-Level Revenue Data)

Impression Delegate

AATImpressionDelegate enables publishers to listen to impression events for all ad formats. Impression listener provides - amongst others - impression-level revenue data (ILRD) as an instance ofAATImpression object, in case the mediation type is supported (see details below).

Listen to Placement Impressions

To set the impression delegate for a specific placement, use the following code:

placement.impressionDelegate = self

If the ad network provides impression-level revenue data, AATKit will use this information during the AATImpression instantiation and pass it to AATImpressionDelegate via the didCountImpression(placement:_:) callback. Otherwise, AATKit will detect and collect the impression-level information internally and provide it to the impression delegate via the same didCountImpression(placement:_:) callback. See the accuracy matrix below to learn how exact price information should be for given network and mediation type.

Google Impression-Level Revenue

AATKit uses impression-level revenue data provided by Google to report impressions. To ensure this functionality works correctly for Google ads, please enable the impression-level ad revenue feature in your account's UI:

Ad Network

Use the func getAdNetworkName() -> String method to get the string representation of the AATAdNetwork enum.

Price Information

Use the getPriceInfo method to get the object representing detailed impression price information (if available), like price, currency and precision type

The price value passed in the impression object is the CPM price.

Accuracy matrix

The accuracy of price information and used currency varies between ad networks and mediation types. Please see the following table for more information.

AdNetwork
Mediation type
Accuracy
Currency

AmazonHB

Any

Exact

USD

AppNexus

Any

Exact

USD

Criteo

Auction

Exact

USD

Waterfall, MAYO

Exact

EUR

GraviteRTB

Any

Exact

USD

Google: AdMob, AdManager(DFP)

Any

Depends on ad response from the network

USD

Equativ (SmartAdServer)

Auction

Exact

USD

MAYO

Floor price

EUR

Waterfall

no price information

no price information

YOC

Auction

Exact

USD

Waterfall, MAYO

Exact

Depends on ad response from the network

All other networks

Waterfall

no price information

no price information

MAYO

Floor price

EUR

Complete Code Example

The below example can be applied to all types of placements.


class ViewController: UIViewController {
    override func viewDidAppear(_ animated: Bool) {
	super.viewDidAppear(animated)
        AATSDK.controllerViewDidAppear(controller: self)
        
        // Setting the impression delegate for the infeed-banner placement
        inFeedBannerPlacement?.impressionDelegate = self
        let request = AATBannerRequest(delegate: self)
        inFeedBannerPlacement?.requestAd(request: request, completion: {[weak self] bannerView, error in
            // Display banner view if not nil and the error is nil
        })
    }
}

extension ViewController: AATImpressionDelegate {
    func didCountImpression(placement: AATPlacement?, _ impression: AATImpression) {
        print("placement: \(placement) - impression: \(impression)")
        print("Banner Size: \(impression.bannerSize)")
        print("Network Key: \(impression.networkKey)")
        print("Ad Network: \(impression.adNetwork)")
        print("Direct Deal: \(impression.isDirectDeal)")
        print("CPM Price: \(impression.priceInfo)")
        print("Ad Network Name: \(impression.getAdNetworkName())")
    }
}

Last updated