For more detailed debugging and logging, such as programmatically obtaining an
ad response identifier for blocking ads, successfully loaded ads provide a
GADResponseInfo
object. This contains information about the ad that was loaded. On interstitial
ads for example, this information is obtained via the
responseInfo
property.
Response info properties
Properties of the GADResponseInfo
object include:
adNetworkClassName
- The class name of the ad network that fetched the current ad. Values that can
be returned from this property include:
Ad Source Class name Google Ads Value of GADGoogleAdNetworkClassName
Rewarded Custom events Your custom event's class name All other custom events Value of GADCustomEventAdNetworkClassName
Mediation The mediation adapter's class name
Sample code
Here is a sample snippet from a GADBannerViewDelegate
callback implementation:
Swift
func adViewDidReceiveAd(_ bannerView: GADBannerView) { print("adViewDidReceiveAd from network: \(bannerView.responseInfo?.adNetworkClassName)") }
Objective-C
- (void)adViewDidReceiveAd:(GADBannerView *)adView { NSLog(@"adViewDidReceiveAd from network: %@", adView.responseInfo.adNetworkClassName); }