For debugging and logging purposes, successfully loaded ads provide a GADResponseInfo object. This object contains information about the ad it loaded, in addition to information about the mediation waterfall used to load the ad.
برای مواردی که یک تبلیغ با موفقیت بارگذاری میشود، شیء تبلیغ دارای یک ویژگی GADResponseInfo است. برای مثال، GADInterstitialAd.responseInfo اطلاعات پاسخ را برای یک تبلیغ بینابینی بارگذاری شده دریافت میکند.
برای مواردی که تبلیغات بارگذاری نمیشوند و فقط یک خطا موجود است، GADResponseInfo با استفاده از کلید GADErrorUserInfoKeyResponseInfo در دیکشنری userInfo مربوط به خطا در دسترس است.
سویفت
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))") } }
هدف-سی
- (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 | Returns the list of GADAdNetworkResponseInfo containing metadata for each adapter included in the ad response. Can be used to debug the waterfall mediation and bidding execution. The order of the list matches the order of the mediation waterfall for this ad request.برای اطلاعات بیشتر به اطلاعات پاسخ آداپتور مراجعه کنید. |
loadedAdNetworkResponseInfo | GADAdNetworkResponseInfo مربوط به آداپتوری که تبلیغ را بارگذاری کرده است را برمیگرداند. |
adNetworkClassName | نام کلاس آداپتور واسطهای شبکه تبلیغاتی که تبلیغ را بارگذاری کرده است، برمیگرداند. |
responseIdentifier | شناسه پاسخ، یک شناسه منحصر به فرد برای پاسخ تبلیغ است. از این شناسه میتوان برای شناسایی و مسدود کردن تبلیغ در مرکز بررسی تبلیغات (ARC) استفاده کرد. |
extrasDictionary | اطلاعات اضافی در مورد پاسخ تبلیغ را برمیگرداند. موارد اضافی ممکن است کلیدهای زیر را برگردانند:
|
سویفت
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"] } }
هدف-سی
- (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 contains metadata for each adapter included in the ad response which can be used to debug the waterfall mediation and bidding execution. The order of the list matches the order of the mediation waterfall for the ad request.
در اینجا نمونهای از خروجی 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 | نام نمونه منبع تبلیغ مرتبط با این پاسخ آداپتور. اگر توسط یک گروه yield پر نشده باشد، یک رشته خالی برمیگرداند. |
adSourceName | منبع تبلیغاتی که نشاندهندهی شبکهی تبلیغاتی خاصی است که به نمایش (یا نمایش) کمک میکند. |
adNetworkClassName | نام کلاس آداپتور شبکه تبلیغاتی که تبلیغ را بارگذاری کرده است. |
adUnitMapping | پیکربندی شبکه از رابط کاربری مدیر تبلیغات تنظیم شده است. |
latency | مدت زمانی که شبکه تبلیغاتی صرف بارگذاری یک تبلیغ کرده است. اگر شبکه تلاشی برای بارگذاری نداشته باشد، مقدار 0 را برمیگرداند. |
سویفت
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 } }
هدف-سی
- (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; }]; }