After an ad loads or fails to load, inspect the
ResponseInfo object. This object details the loaded ad
and metadata about the mediation waterfall used to process the request.
If an ad loads successfully, the ad instance contains a
getResponseInfo method. For example, the
interstitialAd.getResponseInfo method returns the response info for a loaded
InterstitialAd object.
If an ad fails to load, access the optional
responseInfo property on the
LoadAdError object, for example, error.responseInfo.
Inspect the response info object
The ResponseInfo object provides diagnostic details
returned from an ad request.
The following example shows the response info output for a loaded ad:
Android
{
"responseId": "COOllLGxlPoCFdAx4Aod-Q4A0g",
"responseExtras": {},
"loadedAdSourceResponseInfo": {
"adapterClassName": "com.google.ads.mediation.admob.AdMobAdapter",
"latencyMillis": 328,
"name": "Reservation campaign",
"id": "7068401028668408324",
"instanceName": "[DO NOT EDIT] Publisher Test Interstitial",
"instanceId": "4665218928925097",
"credentials": {},
"mediationAdError": null
},
"adSourceResponses": [
{
"adapterClassName": "com.google.ads.mediation.admob.AdMobAdapter",
"latencyMillis": 328,
"name": "Reservation campaign",
"id": "7068401028668408324",
"instanceName": "[DO NOT EDIT] Publisher Test Interstitial",
"instanceId": "4665218928925097",
"credentials": {},
"mediationAdError": null
}
]
}
iOS
{
"responseId": "COOllLGxlPoCFdAx4Aod-Q4A0g",
"responseExtras": {},
"loadedAdSourceResponseInfo": {
"adapterClassName": "GADMAdapterGoogleAdMobAds",
"latencyMillis": 328,
"name": "Reservation campaign",
"id": "7068401028668408324",
"instanceName": "[DO NOT EDIT] Publisher Test Interstitial",
"instanceId": "4665218928925097",
"credentials": {},
"mediationAdError": null
},
"adSourceResponses": [
{
"adapterClassName": "GADMAdapterGoogleAdMobAds",
"latencyMillis": 328,
"name": "Reservation campaign",
"id": "7068401028668408324",
"instanceName": "[DO NOT EDIT] Publisher Test Interstitial",
"instanceId": "4665218928925097",
"credentials": {},
"mediationAdError": null
}
]
}
The ResponseInfo object provides the following properties:
| Property | Type | Description |
|---|---|---|
adSourceResponses |
readonly AdSourceResponseInfo[] |
A list of AdSourceResponseInfo objects representing each ad source attempt in the mediation waterfall. |
loadedAdSourceResponseInfo |
AdSourceResponseInfo | undefined |
Metadata for the ad source adapter that successfully loaded the ad. If the ad didn't load, this value is undefined. |
responseExtras |
Readonly<Record<string, unknown>> |
Extra metadata the ad response returns, such as the mediation_group_name key. |
responseId |
string |
A unique identifier for the ad response. Use this ID to identify blocking ads in the Ads Review Center (ARC). |
Read the ad source response info
The AdSourceResponseInfo object provides
metadata for an adapter included in the ad response. These objects are listed
in the calling order of each ad source in the mediation waterfall.
The following example shows the ad source response info output for a loaded ad:
Android
{
"adapterClassName": "com.google.ads.mediation.admob.AdMobAdapter",
"latencyMillis": 328,
"name": "Reservation campaign",
"id": "7068401028668408324",
"instanceName": "[DO NOT EDIT] Publisher Test Interstitial",
"instanceId": "4665218928925097",
"credentials": {},
"mediationAdError": null
}
iOS
{
"adapterClassName": "GADMAdapterGoogleAdMobAds",
"latencyMillis": 328,
"name": "Reservation campaign",
"id": "7068401028668408324",
"instanceName": "[DO NOT EDIT] Publisher Test Interstitial",
"instanceId": "4665218928925097",
"credentials": {},
"mediationAdError": null
}
For each ad source, AdSourceResponseInfo provides the following properties:
| Property | Type | Description |
|---|---|---|
adapterClassName |
string |
The class name of the ad network adapter. |
credentials |
Readonly<Record<string, string>> |
Server-side parameters configured in the AdMob UI for this adapter. |
id |
string |
The unique ID of the ad source. |
instanceId |
string |
The unique ID of the ad source instance. |
instanceName |
string |
The name of the ad source instance. |
latencyMillis |
number |
The time in milliseconds taken for the network attempt. |
mediationAdError |
MediationAdError | undefined |
If the network attempt failed, this property describes the error. If successful, this value is undefined. |
name |
string |
The name of the ad source, for example, "Reservation campaign". |
Log the full response info
This section covers an implementation to inspect the full response info for a loaded ad.
The following example logs and inspects the response info when an ad loads or fails to load:
import {InterstitialAd, LoadAdError} from '@google/mobile-ads';
import type {AdSourceResponseInfo, ResponseInfo} from '@google/mobile-ads';
export async function logResponseInfo(adUnitId: string): Promise<void> {
try {
const interstitial = await InterstitialAd.load({adUnitId});
const responseInfo: ResponseInfo = interstitial.getResponseInfo();
console.log('Ad Loaded Response ID:', responseInfo.responseId);
console.log(
'Loaded Adapter Class Name:',
responseInfo.loadedAdSourceResponseInfo?.adapterClassName,
);
// Inspect each ad source response in the mediation waterfall
responseInfo.adSourceResponses.forEach(
(adSourceResponse: AdSourceResponseInfo, index: number) => {
console.log(
`Waterfall index ${index}:`,
adSourceResponse.adapterClassName,
`Latency: ${adSourceResponse.latencyMillis}ms`,
adSourceResponse.mediationAdError
? `Error: ${adSourceResponse.mediationAdError.message}`
: 'Success',
);
},
);
} catch (error) {
if (error instanceof LoadAdError) {
console.error('Ad failed to load:', error.message);
if (error.responseInfo) {
console.log('Failed Response ID:', error.responseInfo.responseId);
}
}
}
}