user8965395
user8965395

Reputation:

onAdImpression() not getting Called in Admob Listener

In Banner ad onAdImpression() not getting called any more.

 mAdview = findViewById(R.id.bannertest);
    mAdview.setAdListener(new AdListener() {
        @Override
        public void onAdClosed() {
            super.onAdClosed();
            Log.w(TAG, "onAdClosed: ");
        }

        @Override
        public void onAdFailedToLoad(int i) {
            super.onAdFailedToLoad(i);
            Log.w(TAG, "onAdFailedToLoad: ");

        }

        @Override
        public void onAdLeftApplication() {
            super.onAdLeftApplication();
            Log.w(TAG, "onAdLeftApplication: ");
        }

        @Override
        public void onAdOpened() {
            super.onAdOpened();
            Log.w(TAG, "onAdOpened: ");
        }

        @Override
        public void onAdLoaded() {
            super.onAdLoaded();
            Log.w(TAG, "onAdLoaded: ");
        }

        @Override
        public void onAdClicked() {
            super.onAdClicked();
            Log.w(TAG, "onAdClicked: ");
        }

        @Override
        public void onAdImpression() {
            super.onAdImpression();
            Log.w(TAG, "onAdImpression: ");
        }
    });
    mAdview.loadAd(new AdRequest.Builder().build());

is there any way to track the impression for banner ad?

Upvotes: 8

Views: 2633

Answers (2)

AlexVPerl
AlexVPerl

Reputation: 8006

I found this method confusing as well, but according to the documentation, it is called only for some native ads.

public void onAdImpression ()

Called when an impression is recorded for an ad. At the current time, this method is only used with native ads originating from Google in one of the system-defined formats (App Install or Content).

https://developers.google.com/android/reference/com/google/android/gms/ads/AdListener#public-void-onadimpression

Upvotes: 0

Ashvin solanki
Ashvin solanki

Reputation: 4809

Ref: https://developers.google.com/android/reference/com/google/android/gms/ads/mediation/MediationNativeListener#onAdImpression(com.google.android.gms.ads.mediation.MediationNativeAdapter)

public abstract void onAdImpression (MediationNativeAdapter adapter)

Indicates that an impression has been recorded for the ad. This method should only be called if setOverrideImpressionRecording(boolean) is set to true. This is used for publisher metrics, and must be called in addition to any other events.

Read More https://developers.google.com/android/reference/com/google/android/gms/ads/mediation/MediationNativeListener#onAdImpression(com.google.android.gms.ads.mediation.MediationNativeAdapter)

Edit 2

https://developers.google.com/android/reference/com/google/android/gms/ads/mediation/NativeAdMapper

Edit 3

An impression simply says that the ad is present so the onAdLoaded is where you would want to place your impression tracking.

Upvotes: 4

Related Questions