Skip to main content

Response Info

NAM SDK provides the GfpResponseInfo object, which can be used for debugging and logging purposes when an ad is successfully loaded or fails to load.

This object contains information related to ad loading and can be obtained by calling the getResponseInfo() method of objects that inherit from GfpAd, such as GfpBannerAd, GfpNativeAd, GfpRewardedAd, and GfpInterstitialAd.

Example of Checking Response Information

When Using GfpBannerAdView

When integrating banner ads using GfpBannerAdView, you can check the ad response information as shown in the example below.

val bannerAdView = GfpBannerAdView(this, adParam)
bannerAdView.setAdListener(object: BannerAdListener() {
override fun onAdLoaded(ad: GfpBannerAd) {
val responseInfo = ad.responseInfo
Log.d("response info", responseInfo.toString())
}

override fun onError(ad: GfpBannerAd, error: GfpError) {
val responseInfo = ad.responseInfo
Log.d("response info", responseInfo.toString())
}
})

When Using GfpRewardedAdManager

When integrating rewarded ads using GfpRewardedAdManager, you can check the ad response information as shown in the example below.

val rewardedAdManager = GfpRewardedAdManager(this, adParam)
rewardedAdManager.setAdListener(object: RewardedAdListener() {
override fun onAdLoaded(ad: GfpRewardedAd) {
val responseInfo = ad.responseInfo
Log.d("response info", responseInfo.toString())
}

override fun onError(ad: GfpRewardedAd, error: GfpError) {
val responseInfo = ad.responseInfo
Log.d("response info", responseInfo.toString())
}
})

When Using GfpInterstitialAdManager

When integrating interstitial ads using GfpInterstitialAdManager, you can check the ad response information as shown in the example below.

val interstitialAdManager = GfpInterstitialAdManager(this, adParam)
interstitialAdManager.setAdListener(object: InterstitialAdListener() {
override fun onAdLoaded(ad: GfpInterstitialAd) {
val responseInfo = ad.responseInfo
Log.d("response info", responseInfo.toString())
}

override fun onError(ad: GfpInterstitialAd, error: GfpError) {
val responseInfo = ad.responseInfo
Log.d("response info", responseInfo.toString())
}
})

When Using GfpAdLoader

When using GfpAdLoader, which supports loading Banner, Native, and Native Simple ads, you can check the ad response information as shown in the example below.

In case of load failure or errors during the rendering process, the response information can be checked through the second argument of the AdEventListener.onError() callback.

val builder = GfpAdLoader.Builder(this, adParam)
.withAdListener(object: AdEventListener() {
override fun onError(error: GfpError, responseInfo: GfpResponseInfo) {
Log.d("response info", responseInfo.toString());
}
})
.withBannerAd(getBannerAdOptions()) { bannerAd ->
GfpResponseInfo responseInfo = bannerAd.getResponseInfo();
Log.d("banner ad response info", responseInfo.toString());
}
.withNativeAd(getNativeAdOptions(false)) { nativeAd ->
GfpResponseInfo responseInfo = nativeAd.getResponseInfo();
Log.d("native ad response info", responseInfo.toString());
}
.withNativeSimpleAd(getNativeSimpleAdOptions()) { nativeSimpleAd ->
GfpResponseInfo responseInfo = nativeSimpleAd.getResponseInfo();
Log.d("native simple ad response info", responseInfo.toString());
}
.build()

Response Information

The GfpResponseInfo object includes the following methods:

MethodDescription
getRequestId()The Request ID is a unique identifier for the ad request and can be a useful key for identifying the cause of issues with specific ad requests.
getAdCallLatency()The time (in milliseconds) it took to send a request to the ad server and receive a response during the ad request process. If no ad request was made, 0 is returned.
getTotalLoadLatency()The time (in milliseconds) it took to send a request to the ad server and successfully load the ad during the ad request process. If no ad request was made or only errors occurred without loading the ad, 0 is returned.
getAdapterLoadLatency()The time (in milliseconds) it took for the mediation adapter to request and load the ad. If no ad request was made or no mediation adapter successfully loaded the ad, 0 is returned.
getLoadedAdapterName()Returns the class name of the mediation adapter that successfully loaded the ad. If no ad request was made or no mediation adapter successfully loaded the ad, null is returned.
getAdapterResponses()Returns a list of GfpAdapterResponseInfo objects containing metadata for each mediation adapter included in the ad response. This can be used to debug the waterfall mediation process, and the order of the list matches the mediation call order for this ad request.

Adapter Response Information

GfpAdapterResponseInfo contains response information for individual mediation adapters processed during the mediation process. The methods of this object include the following:

MethodDescription
getAdapterName()The class name identifying the ad network.
getLoadLatency()The time (in milliseconds) it took for the adapter to request and load the ad. If the adapter did not request an ad or the ad request failed, 0 is returned.
getLoadErrorLatency()The time (in milliseconds) it took for the adapter to request the ad and encounter an error. If the adapter did not request an ad or the ad request succeeded, 0 is returned.
getError()The error that occurred within the adapter. Returns error information as a GfpError object, which can be used to check details about the error. If the ad request succeeded, null is returned.