ระบบจะแสดงออบเจ็กต์ 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 |
แสดงข้อมูลเพิ่มเติมเกี่ยวกับการตอบกลับของโฆษณา ข้อมูลเพิ่มเติมสามารถแสดงคีย์ต่อไปนี้
|
ต่อไปนี้เป็นตัวอย่างการอ่านค่าจาก 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 |
รับรหัสแหล่งที่มาของโฆษณาที่เชื่อมโยงกับการตอบกลับของอะแดปเตอร์นี้ สำหรับแคมเปญ ระบบจะแสดง 6060308706800320801 สำหรับประเภทเป้าหมายของแคมเปญโฆษณาสื่อกลาง และ 7068401028668408324 สำหรับประเภทเป้าหมายการแสดงผลและการคลิก ดูรายการรหัสแหล่งที่มาของโฆษณาที่เป็นไปได้เมื่อเครือข่ายโฆษณาแสดงโฆษณา |
AdSourceInstanceId |
รับรหัสอินสแตนซ์แหล่งที่มาของโฆษณาที่เชื่อมโยงกับการตอบกลับของอะแดปเตอร์นี้ |
AdSourceInstanceName |
รับชื่ออินสแตนซ์แหล่งที่มาของโฆษณาที่เชื่อมโยงกับการตอบกลับของอะแดปเตอร์นี้ |
AdSourceName |
รับแหล่งที่มาของโฆษณาที่แสดงถึงเครือข่ายโฆษณาเฉพาะที่แสดง
การแสดงผล สำหรับแคมเปญ ระบบจะแสดง Mediated House Ads สำหรับประเภทเป้าหมายของแคมเปญโฆษณาสื่อกลาง และ Reservation Campaign สำหรับประเภทเป้าหมายการแสดงผลและการคลิก ดูรายการชื่อแหล่งที่มาของโฆษณาที่เป็นไปได้เมื่อเครือข่ายโฆษณาแสดงโฆษณา |
AdapterClassName |
รับชื่อคลาสที่ระบุเครือข่ายโฆษณา |
AdUnitMapping |
รับการกำหนดค่าเครือข่ายที่ตั้งค่าจาก UI ของ 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;
});
}