لأغراض تصحيح الأخطاء والتسجيل، توفّر الإعلانات التي تم تحميلها بنجاح عنصر
GADResponseInfo. يحتوي هذا العنصر على معلومات عن الإعلان الذي تم تحميله، بالإضافة إلى معلومات عن تدفق التوسّط المستخدَم لتحميل الإعلان.
في الحالات التي يتم فيها تحميل إعلان بنجاح، يحتوي عنصر الإعلان على الموقع GADResponseInfo. على سبيل المثال،
GADInterstitialAd.responseInfo
يحصل على معلومات الاستجابة لإعلان بيني تم تحميله.
في الحالات التي يتعذّر فيها تحميل الإعلانات ولا يتوفّر سوى خطأ، يتوفّر GADResponseInfo باستخدام المفتاح GADErrorUserInfoKeyResponseInfo في قاموس userInfo للخطأ.
Swift
fileprivate func loadInterstitial() { AdManagerInterstitialAd.load( with: "/21775744923/example/interstitial", request: request ) { (ad, error) in if let error = error { let responseInfo = (error as NSError).userInfo[GADErrorUserInfoKeyResponseInfo] as? ResponseInfo print("\(String(describing: responseInfo))") return } let responseInfo = ad?.responseInfo print("\(String(describing: responseInfo))") } }
Objective-C
- (void)loadInterstitial { [GADInterstitialAd loadWithAdUnitID:@"/21775744923/example/interstitial" request:request completionHandler:^(GADInterstitialAd *ad, NSError *error) { if (error) { GADResponseInfo *responseInfo = error.userInfo[GADErrorUserInfoKeyResponseInfo]; NSLog(@"%@", responseInfo.description); return; } GADResponseInfo *responseInfo = ad.responseInfo; NSLog(@"%@", responseInfo.description); }]; }
معلومات الاستجابة
في ما يلي نموذج للناتج يعرض بيانات تصحيح الأخطاء التي تم عرضها لإعلان تم تحميله:
** Response Info **
Response ID: BmnCZaSbE_6Mur8P5su8gAY
Network: GADMAdapterGoogleAdMobAds
** Loaded Adapter Response **
Network: GADMAdapterGoogleAdMobAds
Ad Source Name:AdMob Network
Ad Source ID:
Ad Source Instance Name:AdMob (default)
Ad Source Instance ID:AdMob (default)
AdUnitMapping:
{
pubid = "ca-pub-9939518381636264//21775744923/example/rewarded-interstitial/cak=no_cache&cadc=b0&caqid=BmnCZZjMEvzpkPIP5cWfQA";
}
Error: (null)
Latency: 2.724
** Extras Dictionary **
{
"creative_id" = "138471856178";
"line_item_id" = "6707237225";
}
** Mediation line items **
Entry (1)
Network: GADMAdapterGoogleAdMobAds
Ad Source Name:AdMob Network
Ad Source ID:
Ad Source Instance Name:AdMob (default)
Ad Source Instance ID:AdMob (default)
AdUnitMapping:
{
pubid = "ca-pub-9939518381636264//21775744923/example/rewarded-interstitial/cak=no_cache&cadc=b0&caqid=BmnCZZjMEvzpkPIP5cWfQA";
}
Error: (null)
Latency: 2.724
تشمل المواقع في GADResponseInfo
ما يلي:
| الموقع | الوصف |
|---|---|
adNetworkInfoArray |
تعرِض قائمة GADAdNetworkResponseInfo
التي تحتوي على بيانات وصفية لكل محوّل مضمّن في استجابة الإعلان. يمكن استخدامها لتصحيح أخطاء التوسّط المستند إلى العرض الإعلاني بدون انقطاع وتنفيذ عروض الأسعار. يتطابق ترتيب القائمة مع ترتيب تدفق التوسّط لطلب عرض الإعلان هذا.
راجِع معلومات استجابة المحوّل لمزيد من المعلومات. |
loadedAdNetworkResponseInfo |
تعرِض GADAdNetworkResponseInfo المقابلة للمحوّل
الذي حمّل الإعلان. |
adNetworkClassName |
تعرِض اسم فئة محوّل التوسّط لشبكة الإعلانات التي حمّلت الإعلان. |
responseIdentifier |
معرّف الاستجابة هو معرّف فريد لاستجابة الإعلان. يمكن استخدام هذا المعرّف لتحديد الإعلان وحظره في مركز مراجعة الإعلانات. |
extrasDictionary |
تعرِض معلومات إضافية عن استجابة الإعلان. قد تعرِض المعلومات الإضافية المفاتيح التالية:
|
Swift
fileprivate func loadInterstitial() { AdManagerInterstitialAd.load( with: "/21775744923/example/interstitial", request: request ) { (ad, error) in let responseInfo = ad?.responseInfo let responseIdentifier = responseInfo?.responseIdentifier let adNetworkClassName = responseInfo?.adNetworkClassName let adNetworkInfoArray = responseInfo?.adNetworkInfoArray let loadedAdNetworkResponseInfo = responseInfo?.loadedAdNetworkResponseInfo let creativeID = responseInfo?.extrasDictionary["creative_id"] let lineItemID = responseInfo?.extrasDictionary["line_item_id"] } }
Objective-C
- (void)loadInterstitial { [GADInterstitialAd loadWithAdUnitID:@"/21775744923/example/interstitial" request:request completionHandler:^(GADInterstitialAd *ad, NSError *error) { GADResponseInfo *responseInfo = ad.responseInfo; NSString *responseIdentifier = responseInfo.responseIdentifier; NSString *adNetworkClassName = responseInfo.adNetworkClassName; NSArray *adNetworkInfoArray = responseInfo.adNetworkInfoArray; GADAdNetworkResponseInfo *loadedAdNetworkResponseInfo = responseInfo.loadedAdNetworkResponseInfo; NSString *creativeID = responseInfo.extrasDictionary[@"creative_id"]; NSString *lineItemID = responseInfo.extrasDictionary[@"line_item_id"]; }]; }
معلومات استجابة المحوّل
GADAdNetworkResponseInfo
تحتوي على بيانات وصفية لكل محوّل مضمّن في استجابة الإعلان، ويمكن استخدامها
لتصحيح أخطاء توسّط العرض الإعلاني بدون انقطاع وتنفيذ عروض الأسعار. يتطابق ترتيب القائمة مع ترتيب تدفق التوسط لطلب عرض الإعلان.
في ما يلي نموذج لناتج GADAdNetworkResponseInfo:
Network: GADMAdapterGoogleAdMobAds
Ad Source Name:AdMob Network
Ad Source ID:
Ad Source Instance Name:AdMob (default)
Ad Source Instance ID:AdMob (default)
AdUnitMapping:
{
pubid = "ca-pub-9939518381636264//21775744923/example/rewarded-interstitial/cak=no_cache&cadc=b0&caqid=BmnCZZjMEvzpkPIP5cWfQA";
}
Error: (null)
Latency: 2.724
لكل شبكة إعلانات، توفّر GADAdNetworkResponseInfo المواقع التالية:
| الموقع | الوصف |
|---|---|
error |
الخطأ المرتبط بالطلب المقدَّم إلى الشبكة. تعرِض
nil إذا حمّلت الشبكة إعلانًا بنجاح أو إذا لم تتم محاولة استخدام الشبكة. |
adSourceId |
رقم تعريف مصدر الإعلان المرتبط باستجابة المحوّل هذه. |
adSourceInstanceId |
رقم تعريف مثال مصدر الإعلان المرتبط باستجابة المحوّل هذه. |
adSourceInstanceName |
اسم مثال مصدر الإعلان المرتبط باستجابة المحوّل هذه. تعرِض سلسلة فارغة إذا لم تملأها مجموعة الشبكات الإعلانية المدِرّة للأرباح. |
adSourceName |
مصدر الإعلان الذي يمثّل شبكة الإعلانات المحدّدة التي تعرض ظهور الإعلان. |
adNetworkClassName |
اسم فئة محوّل شبكة الإعلانات الذي حمّل الإعلان. |
adUnitMapping |
إعدادات الشبكة التي تم ضبطها من واجهة مستخدم "مدير إعلانات Google". |
latency |
مقدار الوقت الذي استغرقه تحميل الإعلان في شبكة الإعلانات. تعرِض
0 إذا لم تتم محاولة استخدام الشبكة. |
Swift
fileprivate func loadInterstitial() { AdManagerInterstitialAd.load( with: "/21775744923/example/interstitial", request: request ) { (ad, error) in let responseInfo = ad?.responseInfo let loadedAdNetworkResponseInfo = responseInfo?.loadedAdNetworkResponseInfo let adNetworkError = loadedAdNetworkResponseInfo?.error let adSourceId = loadedAdNetworkResponseInfo?.adSourceID let adSourceInstanceId = loadedAdNetworkResponseInfo?.adSourceInstanceID let adSourceInstanceName = loadedAdNetworkResponseInfo?.adSourceInstanceName let adSourceName = loadedAdNetworkResponseInfo?.adSourceName let adNetworkClassName = loadedAdNetworkResponseInfo?.adNetworkClassName let adUnitMapping = loadedAdNetworkResponseInfo?.adUnitMapping let latency = loadedAdNetworkResponseInfo?.latency } }
Objective-C
- (void)loadInterstitial { [GADInterstitialAd loadWithAdUnitID:@"/21775744923/example/interstitial" request:request completionHandler:^(GADInterstitialAd *ad, NSError *error) { GADResponseInfo *responseInfo = ad.responseInfo; GADAdNetworkResponseInfo *loadedAdNetworkResponseInfo = responseInfo.loadedAdNetworkResponseInfo; NSError *adNetworkError = loadedAdNetworkResponseInfo.error; NSString *adSourceId = loadedAdNetworkResponseInfo.adSourceID; NSString *adSourceInstanceId = loadedAdNetworkResponseInfo.adSourceInstanceID; NSString *adSourceInstanceName = loadedAdNetworkResponseInfo.adSourceInstanceName; NSString *adSourceName = loadedAdNetworkResponseInfo.adSourceName; NSString *adNetworkClassName = loadedAdNetworkResponseInfo.adNetworkClassName; NSDictionary*adUnitMapping = loadedAdNetworkResponseInfo.adUnitMapping; NSTimeInterval latency = loadedAdNetworkResponseInfo.latency; }]; }