정상적으로 로드된 광고는 디버깅 및 로깅을 위해 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 |
응답 식별자는 광고 응답의 고유한 식별자입니다. 이 식별자는 광고 심사 센터(ARC)에서 광고를 식별 및 차단할 때 사용될 수 있습니다. |
GetResponseExtras |
광고 응답에 대한 추가 정보를 반환합니다. Extras는 다음 키를
반환할 수 있습니다.
|
다음은 로드된 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 UI에서 설정된 네트워크 구성을 가져옵니다. |
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;
});
}