جارٍ استرداد معلومات حول استجابة الإعلان

لأغراض تصحيح الأخطاء وتسجيل البيانات، تقدّم الإعلانات التي تم تحميلها بنجاح عنصرًا GADResponseInfo. يحتوي هذا العنصر على معلومات عن الإعلان الذي حمّله، بالإضافة إلى معلومات عن العرض الإعلاني بدون انقطاع للتوسّط المستخدَم لتحميل الإعلان.

في الحالات التي يتم فيها تحميل إعلان بنجاح، يحتوي عنصر الإعلان على سمة GADResponseInfo. على سبيل المثال، GADInterstitialAd.responseInfo يحصل على معلومات الاستجابة لإعلان بيني تم تحميله.

في الحالات التي يتعذّر فيها تحميل الإعلانات ويتوفّر خطأ فقط، يكون الرمز GADResponseInfo متاحًا باستخدام المفتاح GADErrorUserInfoKeyResponseInfo في قاموس userInfo الخاص بالخطأ.

Swift

fileprivate func loadInterstitial() {
  GADInterstitialAd.load(
    withAdUnitID: "/21775744923/example/interstitial", request: request
  ) { (ad, error) in
    if let error = error {
      let responseInfo = (error as NSError).userInfo[GADErrorUserInfoKeyResponseInfo] as? GADResponseInfo
      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 **
    {
    }

  ** 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 معرّف الاستجابة هو معرّف فريد لاستجابة الإعلان. يمكن استخدام هذا المعرّف لتحديد الإعلان وحظره في مركز مراجعة الإعلانات (ARC).
extrasDictionary

تعرِض هذه السمة معلومات إضافية عن استجابة الإعلان.

Swift

fileprivate func loadInterstitial() {
  GADInterstitialAd.load(
    withAdUnitID: "/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
  }
}

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;
  }];
}

معلومات استجابة المحوِّل

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() {
  GADInterstitialAd.load(
    withAdUnitID: "/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;
  }];
}