광고 응답에 대한 정보를 가져옵니다.

정상적으로 로드된 광고는 디버깅 및 로깅을 위해 ResponseInfo 객체를 제공합니다. 이 객체에는 로드된 광고에 대한 정보와 광고를 로드하는 데 사용된 연쇄 광고 호출 조정에 대한 정보가 포함됩니다.

광고가 성공적으로 로드되면 광고 객체에 GetResponseInfo() 메서드가 있습니다. 예를 들어 InterstitialAd.GetResponseInfo()는 로드된 전면 광고의 응답 정보를 가져옵니다.

광고가 로드되지 않고 오류만 발생하는 경우에는 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();
}

응답 정보

다음은 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는 다음 키를 반환할 수 있습니다.
  • mediation_group_name: 미디에이션 그룹의 이름
  • mediation_ab_test_name: 미디에이션 A/B 테스트의 이름입니다(해당하는 경우).
  • mediation_ab_test_variant: 미디에이션 A/B 테스트에 사용된 대안입니다(해당하는 경우).

다음은 로드된 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 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 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;
}