デバッグとロギングに使用できるよう、正常に読み込まれた広告では ResponseInfo オブジェクトが提供されます。このオブジェクトには、広告を読み込む際に使用されたメディエーションの順次処理の情報とともに、読み込まれた広告の情報が含まれています。
広告の読み込みが成功した場合、広告オブジェクトは GetResponseInfo() メソッドを持ちます。たとえば、interstitialAd.GetResponseInfo() により、読み込まれたインタースティシャル広告のレスポンス情報を取得可能です。
広告の読み込みが失敗し、エラーだけが返された場合、レスポンス情報は LoadAdError.GetResponseInfo() を通して取得できます。
private void LoadInterstitialAd()
{
  AdRequest adRequest = new AdRequest();
  InterstitialAd.Load("AD_UNIT_ID", adRequest, (InterstitialAd insterstitialAd, LoadAdError error) =>
  {
    // If the operation failed with a reason.
    if (error != null)
    {
        ResponseInfo errorInfo = error.GetResponseInfo();
        Debug.LogError("Interstitial ad failed to load an ad with error : " + error);
        return;
    }
    ResponseInfo loadInfo = insterstitialAd.GetResponseInfo();
  });
}
レスポンス情報
以下は ResponseInfo.ToString() によって返された出力の例です。読み込まれた広告についてのデバッグ用データが表示されています。
Android
{ "Response ID": "COOllLGxlPoCFdAx4Aod-Q4A0g", "Mediation Adapter Class Name": "com.google.ads.mediation.admob.AdMobAdapter", "Adapter Responses": [ { "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" } ], "Loaded Adapter Response": { "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" }, "Response Extras": { "mediation_group_name": "Campaign" } }
iOS
** Response Info ** Response ID: CIzs0ZO5kPoCFRqWAAAdJMINpQ Network: GADMAdapterGoogleAdMobAds ** Loaded Adapter Response ** 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 ** Extras Dictionary ** { "mediation_group_name" = Campaign; } ** Mediation line items ** Entry (1) 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
ResponseInfo オブジェクトには次のようなメソッドがあります。
| メソッド | 説明 | 
|---|---|
| GetAdapterResponses | 広告レスポンスに含まれる各アダプタのメタデータを含む AdapterResponseInfoのリストを返します。このメソッドは、ウォーターフォール メディエーションと入札の実行をデバッグする際に使用できます。リストの順序は、この広告リクエストのメディエーション ウォーターフォールの順序と同じです。詳しくはアダプタ レスポンス情報をご覧ください。 | 
| GetLoadedAdapterResponseInfo | 広告を読み込んだアダプタに対応する AdapterResponseInfoを返します。 | 
| GetMediationAdapterClassName | 広告を読み込んだ広告ネットワークのメディエーション アダプタ クラス名を返します。 | 
| GetResponseId | レスポンス ID は、広告レスポンスごとに固有の ID で、広告レビュー センター(ARC)で広告を識別してブロックするために使われます。 | 
| GetResponseExtras | 広告レスポンスについての追加情報を返します。追加情報には次のキーが含まれます。 
 | 
以下は読み込まれた ResponseInfo から値を読み取るコードの例です。
private void LoadInterstitialAd()
{
  AdRequest adRequest = new AdRequest();
  InterstitialAd.Load("AD_UNIT_ID", adRequest, (InterstitialAd insterstitialAd, LoadAdError error) =>
  {
    // If the operation failed with a reason.
    if (error != null)
    {
        Debug.LogError("Interstitial ad failed to load an ad with error : " + error);
        return;
    }
    ResponseInfo responseInfo = insterstitialAd.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 mediationGroupName = extras["mediation_group_name"];
    string mediationABTestName = extras["mediation_ab_test_name"];
    string mediationABTestVariant = extras["mediation_ab_test_variant"]; 
  });
}
アダプタ レスポンス情報
AdapterResponseInfo には、広告レスポンスに含まれる各アダプタのメタデータが格納されており、この情報はウォーターフォール メディエーションと入札処理のデバッグに使用できます。リストの順序は、広告リクエストのメディエーション ウォーターフォールの順序と同じです。
以下は 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
各広告ネットワークについて、AdapterResponseInfo は次のメソッドを提供します。
| メソッド | 説明 | 
|---|---|
| AdError | ネットワークへのリクエストに関連付けられているエラーを取得します。ネットワークが広告の読み込みに成功した場合や、読み込みを試行しなかった場合は、「 null」が返されます。 | 
| AdSourceId | このアダプタ レスポンスに関連付けられている広告ソース ID を取得します。キャンペーンについて、キャンペーンの目標タイプがメディエーション広告なら 6060308706800320801が、インプレッション(表示回数)やクリックなら7068401028668408324が返されます。広告ネットワークが広告を配信する際に使用される可能性がある広告ソース ID の一覧は、広告ソースで確認できます。 | 
| AdSourceInstanceId | このアダプタ レスポンスに関連付けられている広告ソースのインスタンス ID を取得します。 | 
| AdSourceInstanceName | このアダプタ レスポンスに関連付けられている広告ソースのインスタンス名を取得します。 | 
| AdSourceName | インプレッションを配信する広告ネットワークに対応する広告ソースを取得します。キャンペーンについて、キャンペーンの目標タイプがメディエーション広告なら Mediated House Adsが、インプレッション(表示回数)やクリックならReservation Campaignが返されます。広告ネットワークが広告を配信する際の広告ソース名の一覧は、広告ソースで確認できます。 | 
| AdapterClassName | 広告ネットワークを識別するクラス名を取得します。 | 
| AdUnitMapping | AdMob 管理画面で設定されたネットワーク設定を取得します。 | 
| LatencyMillis | 広告ネットワークが広告の読み込みに費やした時間を取得します。試行されなかったネットワークについては 0を返します。 | 
以下は読み込まれた AdapterResponseInfo から値を読み取るコードの例です。
private void LoadInterstitialAd()
{
  AdRequest adRequest = new AdRequest();
  InterstitialAd.Load("AD_UNIT_ID", adRequest, (InterstitialAd insterstitialAd, LoadAdError error) =>
  {
    // If the operation failed with a reason.
    if (error != null)
    {
        Debug.LogError("Interstitial ad failed to load an ad with error : " + error);
        return;
    }
    ResponseInfo responseInfo = insterstitialAd.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;
  });
}