Skip to main content

Response Info

The NAM SDK provides a GFPLoadResponseInfo object that you can use for debugging and logging when an ad load succeeds or fails. It carries the unique identifier of the ad request (Request ID), the latency of each stage, and a record of which adapters the mediation waterfall tried and in what order.

There are two ways to obtain the response info:

  • On load success : the responseInfo property of the loaded ad object
  • On load failure : the responseInfo argument delivered through each delegate's didFailWithError:responseInfo: callback

How to obtain

Ad formatOn load successOn load failure
BanneradLoader:didReceiveBannerAd:bannerView.responseInfoadLoader:didFailWithError:responseInfo:
NativeadLoader:didReceiveNativeAd:nativeAd.responseInfoadLoader:didFailWithError:responseInfo:
Native SimpleadLoader:didReceiveNativeSimpleAd:nativeSimpleAd.responseInfoadLoader:didFailWithError:responseInfo:
InterstitialinterstitialAdManager:didLoadAd:interstitialAd.responseInfointerstitialAdManager:didFailWithError:responseInfo:
RewardedrewardedAdManager:didLoadAd:rewardedAd.responseInforewardedAdManager:didFailWithError:responseInfo:

Examples

Using GFPAdLoader

When you use GFPAdLoader, which supports loading banner, native, and native simple ads, you can check the ad response info as shown below.

func adLoader(_ unifiedAdLoader: GFPAdLoader!, didReceiveBannerAd bannerView: GFPBannerView!) {
print("banner ad response info: \(bannerView.responseInfo)")
}

func adLoader(_ unifiedAdLoader: GFPAdLoader!, didReceiveNativeAd nativeAd: GFPNativeAd!) {
print("native ad response info: \(nativeAd.responseInfo)")
}

func adLoader(_ unifiedAdLoader: GFPAdLoader!, didReceiveNativeSimpleAd nativeSimpleAd: GFPNativeSimpleAd!) {
print("native simple ad response info: \(nativeSimpleAd.responseInfo)")
}

func adLoader(_ unifiedAdLoader: GFPAdLoader!, didFailWithError error: GFPError!, responseInfo: GFPLoadResponseInfo!) {
print("on error response info: \(String(describing: responseInfo))")
}

Using GFPInterstitialAdManager

func interstitialAdManager(_ manager: GFPInterstitialAdManager, didLoadAd interstitialAd: GFPInterstitialAd) {
print("response info: \(interstitialAd.responseInfo)")
}

func interstitialAdManager(_ manager: GFPInterstitialAdManager, didFailWithError error: GFPError, responseInfo: GFPLoadResponseInfo!) {
print("response info: \(String(describing: responseInfo))")
}

Using GFPRewardedAdManager

func rewardedAdManager(_ manager: GFPRewardedAdManager, didLoadAd rewardedAd: GFPRewardedAd) {
print("response info: \(rewardedAd.responseInfo)")
}

func rewardedAdManager(_ manager: GFPRewardedAdManager, didFailWithError error: GFPError, responseInfo: GFPLoadResponseInfo!) {
print("response info: \(String(describing: responseInfo))")
}

Sample log output

Logging GFPLoadResponseInfo as-is lets you inspect the whole mediation waterfall at a glance.

[GFPLoadResponseInfo] requestID: 0f0f1d3c-..., adCallLatency: 0.083, adaptorLoadLatency: 0.402, totalLoadLatency: 0.485, adaptorResponses: (
"[GFPAdaptorResponseInfo] adaptorName: GFPSDKMediationDFP.GFPDFPBannerAdaptor, loadErrorLatency: 0.156, errorMessage: no ad to show",
"[GFPAdaptorResponseInfo] adaptorName: GFPNDABannerAdaptor, loadLatency: 0.246"
)

The example above means the first adapter failed and the ad was then selected from the second adapter.

Response info

The properties of the GFPLoadResponseInfo object include the following.

PropertyTypeDescription
requestIDNSStringThe unique identifier for the ad request. It is a useful key for tracking down the cause when a problem occurs on a specific ad request.
adCallLatencyNSNumberThe time in seconds it took to send the request to the ad server and receive the response. Returns 0 if no ad was requested or no response was received.
adaptorLoadLatencyNSNumberThe time in seconds from the start of the mediation selection process until it finished. This includes the time spent on failed adapter attempts. Returns 0 if mediation did not proceed because no response was received from the ad server.
totalLoadLatencyNSNumberThe total time in seconds from sending the request to the ad server until the mediation selection process finished. Returns 0 if no response was received from the ad server.
adContextNSString?The ad context string of the selected ad. Returns nil if it is not included in the ad response.
cridNSString?The Creative ID of the selected ad creative. Returns nil if no ad was loaded successfully.
loadResponseList[GFPInternalResponseInfo]The list of response info for each mediation adapter tried on this ad request. It can be used to debug the waterfall mediation process, and the order of the list matches the mediation call order of this ad request.

Adapter response info

GFPInternalResponseInfo holds the response info for an individual mediation adapter processed during mediation, and its properties include the following.

PropertyTypeDescription
adaptorNameNSStringThe class name of the mediation adapter that identifies the ad network. The value is not set if the attempt failed before the adapter was created.
loadLatencyNSNumberThe time in seconds it took to request and load the ad inside the adapter. Returns 0 if no ad was requested inside the adapter or if the ad request failed.
loadErrorLatencyNSNumberThe time in seconds from requesting the ad inside the adapter until the error occurred. Returns 0 if no ad was requested inside the adapter or if the ad request succeeded.
errorMesageNSStringThe error message that occurred inside the adapter. EMPTY is recorded when the ad response is empty, and no value is set when the ad request succeeded.
errorCodeNSNumber?The code of the error that occurred inside the adapter. Returns nil if no error code was delivered or the ad request succeeded. See Error Codes for details on each code.
errorSubcodeNSString?The sub-code of the error that occurred inside the adapter. Returns nil if no sub-code was delivered or the ad request succeeded.