Retrieving Information about the Ad Response

For debugging and logging purposes, successfully loaded ads provide a ResponseInfo object. This object contains information about the ad it loaded. Each ad format class has a method to get the response info. On interstitial ads for example, use the getResponseInfo() method.

Methods on the ResponseInfo object include:

getResponseId()
The response identifier is a unique identifier for the ad response. This identifier can be used to identify and block the ad in the Ads Review Center (ARC).
getMediationAdapterClassName()
The class name of the ad network that fetched the current ad. Values that can be returned from this method include:

Ad Source Class name
Google Ads com.google.ads.mediation.admob.AdMobAdapter
Rewarded Custom events Your custom event's class name
All other custom events com.google.ads.mediation.customevent.CustomEventAdapter
Mediation The mediation adapter's class name
getAdapterResponses()

Returns the list of AdapterResponseInfo containing metadata for each adapter included in the ad response. Can be used to debug the mediation waterfall execution.

For each ad network in the waterfall, AdapterResponseInfo provides the following properties:

Property Description
getAdapterClassName A class name that identifies the ad network.
getCredentials Network configuration set on the AdMob UI.
getAdError Error associated with the request to the network. Null if the network successfully loaded an ad or if the network was not attempted.
getLatencyMillis Amount of time the ad network spent loading an ad. 0 if the network was not attempted.

Querying these properties allows you to drill into the outcome of a mediation waterfall for each ad request.

Sample code

Here is a sample snippet from an AdListener callback implementation:

Java

@Override
public void onAdLoaded() {
    ResponseInfo responseInfo = bannerAdView.getResponseInfo();
    Log.d(TAG, responseInfo.toString());
}

@Override
public void onAdFailedToLoad(LoadAdError loadAdError) {
    ResponseInfo responseInfo = loadAdError.getResponseInfo();
    Log.d(TAG, responseInfo.toString());
}

Kotlin

override fun onAdLoaded() {
    val responseInfo = ad_view.responseInfo
    Log.d(TAG, responseInfo.toString())

}

override fun onAdFailedToLoad(adError: LoadAdError) {
    val responseInfo = adError.responseInfo
    Log.d(TAG, responseInfo.toString())
}

Here is a sample output when using Google Mobile Ads SDK version 19.4.0 or higher:

{
  "Response ID": "MwRtX5mnEYqYmLAPwMKFkAk",
  "Mediation Adapter Class Name": "com.google.ads.mediation.admob.AdMobAdapter",
  "Adapter Responses": [{
    "Adapter": "com.google.ads.mediation.admob.AdMobAdapter",
    "Latency": 89,
    "Credentials": {},
    "Ad Error": "null"
    }]
}