<br />

After an ad loads or fails to load, inspect the
[`ResponseInfo`](https://developers.google.com/admob/react-native/reference/interface/ResponseInfo.md.txt) 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`](https://developers.google.com/admob/react-native/reference/class/InterstitialAd.md.txt#InterstitialAd.getResponseInfo) method. For example, the
`interstitialAd.getResponseInfo` method returns the response info for a loaded
[`InterstitialAd`](https://developers.google.com/admob/react-native/reference/class/InterstitialAd.md.txt) object.

If an ad fails to load, access the optional
[`responseInfo`](https://developers.google.com/admob/react-native/reference/class/LoadAdError.md.txt#LoadAdError.responseInfo) property on the
[`LoadAdError`](https://developers.google.com/admob/react-native/reference/class/LoadAdError.md.txt) object, for example, `error.responseInfo`.

## Inspect the response info object

The [`ResponseInfo`](https://developers.google.com/admob/react-native/reference/interface/ResponseInfo.md.txt) object provides diagnostic details
returned from an ad request.

The following example shows the response info output for a loaded ad:

### Android

```json
{
  "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

```json
{
  "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`](https://developers.google.com/admob/react-native/reference/interface/ResponseInfo.md.txt#ResponseInfo.adSourceResponses) | `readonly AdSourceResponseInfo[]` | A list of `AdSourceResponseInfo` objects representing each ad source attempt in the mediation waterfall. |
| [`loadedAdSourceResponseInfo`](https://developers.google.com/admob/react-native/reference/interface/ResponseInfo.md.txt#ResponseInfo.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`](https://developers.google.com/admob/react-native/reference/interface/ResponseInfo.md.txt#ResponseInfo.responseExtras) | `Readonly<Record<string, unknown>>` | Extra metadata the ad response returns, such as the `mediation_group_name` key. |
| [`responseId`](https://developers.google.com/admob/react-native/reference/interface/ResponseInfo.md.txt#ResponseInfo.responseId) | `string` | A unique identifier for the ad response. Use this ID to identify blocking ads in the [Ads Review Center (ARC)](https://support.google.com/admob/answer/3480906). |

## Read the ad source response info

The [`AdSourceResponseInfo`](https://developers.google.com/admob/react-native/reference/interface/AdSourceResponseInfo.md.txt) 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

```json
{
  "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

```json
{
  "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`](https://developers.google.com/admob/react-native/reference/interface/AdSourceResponseInfo.md.txt#AdSourceResponseInfo.adapterClassName) | `string` | The class name of the ad network adapter. |
| [`credentials`](https://developers.google.com/admob/react-native/reference/interface/AdSourceResponseInfo.md.txt#AdSourceResponseInfo.credentials) | `Readonly<Record<string, string>>` | Server-side parameters configured in the AdMob UI for this adapter. |
| [`id`](https://developers.google.com/admob/react-native/reference/interface/AdSourceResponseInfo.md.txt#AdSourceResponseInfo.id) | `string` | The unique ID of the ad source. |
| [`instanceId`](https://developers.google.com/admob/react-native/reference/interface/AdSourceResponseInfo.md.txt#AdSourceResponseInfo.instanceId) | `string` | The unique ID of the ad source instance. |
| [`instanceName`](https://developers.google.com/admob/react-native/reference/interface/AdSourceResponseInfo.md.txt#AdSourceResponseInfo.instanceName) | `string` | The name of the ad source instance. |
| [`latencyMillis`](https://developers.google.com/admob/react-native/reference/interface/AdSourceResponseInfo.md.txt#AdSourceResponseInfo.latencyMillis) | `number` | The time in milliseconds taken for the network attempt. |
| [`mediationAdError`](https://developers.google.com/admob/react-native/reference/interface/AdSourceResponseInfo.md.txt#AdSourceResponseInfo.mediationAdError) | `MediationAdError | undefined` | If the network attempt failed, this property describes the error. If successful, this value is `undefined`. |
| [`name`](https://developers.google.com/admob/react-native/reference/interface/AdSourceResponseInfo.md.txt#AdSourceResponseInfo.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:

```tsx
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);
      }
    }
  }
}
```