For debugging and logging purposes, successfully loaded ads provides a ResponseInfo
object. This object contains information about the ad it loaded,
in addition to information about the mediation waterfall used to load the ad.
For cases where an ad loads successfully, the ad object has a GetResponseInfo()
method. For example, InterstitialAd.GetResponseInfo()
gets the response info for a loaded interstitial ad.
For cases where ads fail to load and only an error is available, the response
info is available through AdFailedToLoadEventArgs.LoadAdError.GetResponseInfo()
.
InterstitialAd
ad
;
private
void
RequestInterstitial
()
{
ad
=
new
InterstitialAd
(
" AD_UNIT_ID
"
);
this
.
interstitial
.
OnAdLoaded
+=
OnAdLoaded
;
this
.
interstitial
.
OnAdFailedToLoad
+=
HandleOnAdFailedToLoad
;
AdRequest
request
=
new
AdRequest
.
Builder
().
Build
();
this
.
interstitial
.
LoadAd
(
request
);
}
private
void
OnAdLoaded
(
object
sender
,
EventArgs
args
)
{
ResponseInfo
info
=
ad
.
GetResponseInfo
();
}
private
void
OnAdFailedToLoad
(
object
sender
,
AdFailedToLoadEventArgs
args
)
{
ResponseInfo
info
=
args
.
LoadAdError
.
GetResponseInfo
();
}
Response info
Here is a sample output returned by ResponseInfo.ToString()
showing the
debugging data returned for a loaded ad:
Android
{
"Response ID"
:
"NI3BZZDbGdyQtOUP4o21gAM"
,
"Mediation Adapter Class Name"
:
"com.google.ads.mediation.admob.AdMobAdapter"
,
"Adapter Responses"
:
[
{
"Adapter"
:
"com.google.ads.mediation.admob.AdMobAdapter"
,
"Latency"
:
3585
,
"Ad Source Name"
:
"AdMob Network"
,
"Ad Source ID"
:
""
,
"Ad Source Instance Name"
:
"AdMob (default)"
,
"Ad Source Instance ID"
:
""
,
"Credentials"
:
{
"pubid"
:
"ca-pub-9939518381636264//21775744923/example/rewarded-interstitial/cak=no_cache&cadc=8e&caqid=NI3BZfDhGICQtOUP7ayS4Aw"
},
"Ad Error"
:
"null"
}
],
"Loaded Adapter Response"
:
{
"Adapter"
:
"com.google.ads.mediation.admob.AdMobAdapter"
,
"Latency"
:
3585
,
"Ad Source Name"
:
"AdMob Network"
,
"Ad Source ID"
:
""
,
"Ad Source Instance Name"
:
"AdMob (default)"
,
"Ad Source Instance ID"
:
""
,
"Credentials"
:
{
"pubid"
:
"ca-app-pub-3940256099942544\/9257395921\/cak=no_cache&cadc=8e&caqid=NI3BZfDhGICQtOUP7ayS4Aw"
},
"Ad Error"
:
"null"
},
"Response Extras"
:
{
"creative_id"
:
"138471856178"
,
"line_item_id"
:
"6707237225"
,
}
}
iOS
**
Respo
nse
I
nf
o
**
Respo
nse
ID
:
Bm
n
CZaSbE_
6
Mur
8
P
5
su
8
gAY
Ne
t
work
:
GADMAdap
ter
GoogleAdMobAds
**
Loaded
Adap
ter
Respo
nse
**
Ne
t
work
:
GADMAdap
ter
GoogleAdMobAds
Ad
Source
Name
:
AdMob
Ne
t
work
Ad
Source
ID
:
Ad
Source
I
nstan
ce
Name
:
AdMob
(de
fault
)
Ad
Source
I
nstan
ce
ID
:
AdMob
(de
fault
)
AdU
n
i
t
Mappi
n
g
:
{
pubid
=
"ca-pub-9939518381636264//21775744923/example/rewarded-interstitial/cak=no_cache&cadc=b0&caqid=BmnCZZjMEvzpkPIP5cWfQA"
;
}
Error
:
(
null
)
La
ten
cy
:
2.724
**
Ex
tras
Dic
t
io
nar
y
**
{
"creative_id"
=
"138471856178"
;
"line_item_id"
=
"6707237225"
;
}
**
Media
t
io
n
li
ne
i
te
ms
**
E
ntr
y
(
1
)
Ne
t
work
:
GADMAdap
ter
GoogleAdMobAds
Ad
Source
Name
:
AdMob
Ne
t
work
Ad
Source
ID
:
Ad
Source
I
nstan
ce
Name
:
AdMob
(de
fault
)
Ad
Source
I
nstan
ce
ID
:
AdMob
(de
fault
)
AdU
n
i
t
Mappi
n
g
:
{
pubid
=
"ca-pub-9939518381636264//21775744923/example/rewarded-interstitial/cak=no_cache&cadc=b0&caqid=BmnCZZjMEvzpkPIP5cWfQA"
;
}
Error
:
(
null
)
La
ten
cy
:
2.724
Methods on the ResponseInfo
object include:
GetAdapterResponses
AdapterResponseInfo
containing metadata
for each adapter included in the ad response. Can be used to debug the
waterfall mediation and bidding execution. The order of the list matches the
order of the mediation waterfall for this ad request. See Adapter Response Info for more information.
GetLoadedAdapterResponseInfo
AdapterResponseInfo
corresponding to the adapter
that loaded the ad.GetMediationAdapterClassName
GetResponseId
GetResponseExtras
-
creative_id
: The creative ID of the selected ad. Returned for reservation ads only. -
line_item_id
: The line item ID of the selected ad. Returned for reservation ads only.
Here is a sample reading values from a loaded ResponseInfo
:
private
void
OnAdLoaded
(
object
sender
,
EventArgs
args
)
{
ResponseInfo
info
=
ad
.
GetResponseInfo
();
string
responseId
=
responseInfo
.
GetResponseId
();
string
mediationAdapterClassName
=
responseInfo
.
GetMediationAdapterClassName
();
List<AdapterResponseInfo>
adapterResponses
=
responseInfo
.
GetAdapterResponses
();
AdapterResponseInfo
loadedAdapterResponseInfo
=
responseInfo
.
GetLoadedAdapterResponseInfo
();
Dictionary<string
,
string
>
extras
=
responseInfo
.
GetResponseExtras
();
string
creativeId
=
extras
[
"creative_id"
];
string
lineItemId
=
extras
[
"line_item_id"
];
}
Adapter response info
AdapterResponseInfo
contains metadata for each adapter included in the ad
response, which can be used to debug the waterfall mediation and bidding
execution. The order of the list matches the order of the mediation waterfall
for the ad request.
Here is a sample output returned by AdapterResponseInfo
:
Android
{ "Adapter" : "com.google.ads.mediation.admob.AdMobAdapter" , "Latency" : 328 , "Ad Source Name" : "Reservation campaign" , "Ad Source ID" : "7068401028668408324" , "Ad Source Instance Name" : "[DO NOT EDIT] Publisher Test Interstitial" , "Ad Source Instance ID" : "4665218928925097" , "Credentials" : {}, "Ad Error" : "null" }
iOS
Network : GADMAdapterGoogleAdMobAds Ad Source Name : Reservation campaign Ad Source ID : 7068401028668408324 Ad Source Instance Name : [ DO NOT EDIT ] Publisher Test Interstitial Ad Source Instance ID : [ DO NOT EDIT ] Publisher Test Interstitial AdUnitMapping : { } Error : ( null ) Latency : 0.391
For each ad network, AdapterResponseInfo
provides the following methods:
Method | Description |
---|---|
AdError
|
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. |
AdSourceId
|
Gets the ad source ID associated with this adapter response. For campaigns, 6060308706800320801
is returned for a mediated ads campaign goal type
,
and 7068401028668408324
is returned for impression and click
goal types. See Ad sources
for the list of possible ad source IDs when an ad network serves the ad. |
AdSourceInstanceId
|
Gets the ad source instance ID associated with this adapter response. |
AdSourceInstanceName
|
Gets the ad source instance name associated with this adapter response. |
AdSourceName
|
Gets the ad source representing the specific ad network that serves the
impression. For campaigns, Mediated House Ads
is returned for a mediated ads campaign goal type
,
and Reservation Campaign
is returned for impression and click
goal types. See Ad sources
for the list of possible ad source names when an ad network serves the
ad. |
AdapterClassName
|
Gets a class name that identifies the ad network. |
AdUnitMapping
|
Gets the network configuration set from the Admob UI. |
LatencyMillis
|
Gets the amount of time the ad network spent loading an ad.
Returns 0
if the network was not attempted. |
Here is a sample reading values from a loaded AdapterResponseInfo
:
private
void
OnAdLoaded
(
object
sender
,
EventArgs
args
)
{
ResponseInfo
responseInfo
=
ad
.
GetResponseInfo
();
AdapterResponseInfo
loadedAdapterResponseInfo
=
responseInfo
.
getLoadedAdapterResponseInfo
();
AdError
adError
=
loadedAdapterResponseInfo
.
AdError
;
string
adSourceId
=
loadedAdapterResponseInfo
.
AdSourceId
;
string
adSourceInstanceId
=
loadedAdapterResponseInfo
.
AdSourceInstanceId
;
string
adSourceInstanceName
=
loadedAdapterResponseInfo
.
AdSourceInstanceName
;
string
adSourceName
=
loadedAdapterResponseInfo
.
AdSourceName
;
string
adapterClassName
=
loadedAdapterResponseInfo
.
AdapterClassName
;
Dictionary<string
,
string
>
credentials
=
loadedAdapterResponseInfo
.
AdUnitMapping
;
long
latencyMillis
=
loadedAdapterResponseInfo
.
LatencyMillis
;
}