デバッグとログに使用できるよう、正常に読み込まれた広告では 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;
});
}