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:
getAdapterResponses()
Returns the list of
AdapterResponseInfo
containing metadata for each adapter included in the ad response. Can be used to debug the waterfall mediation and bidding execution.For each ad network,
AdapterResponseInfo
provides the following methods:Method Description getAdError
Gets the error associated with the request to the network. Returns null
if the network successfully loaded an ad or if the network was not attempted.getAdapterClassName
Gets a class name that identifies the ad network. getCredentials
Gets the network configuration set on the Ad Manager UI. getLatencyMillis
Gets the amount of time the ad network spent loading an ad. 0
if the network was not attempted.Querying these properties lets you drill into the outcome of a waterfall mediation and bidding for each ad request.
getLoadedAdapterResponseInfo()
Returns the
AdapterResponseInfo
corresponding to the adapter that was used to load the ad. Returnsnull
if the ad failed to load. See the methods provided byAdapterResponseInfo
above.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 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).
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"
}]
}