3

I had created a banner admob ad using this link. App it was working good. I even got publisher id and I was able to view impressions and clicks from Admob website. But after I completed the development, I uploaded the app on play store and i am not able to view any ads impression/clicks from Admob website though ads are showing inside the app downloaded from playstore. Though Impressions/clicks are showing as long as I am viewing it on test device. But no impression/clicks are updating if I download and use it from google playstore. I have linked the app from playstore. Around 50 people have downloaded the app and it has been 3 days but no update in Impressions/clicks. Now what I need to do to be able to track impressions or clicks. Do I need to get a new publisher ID? If so what are the steps to obtain it. Thanks in advance. Help me I'm new in admob.

I am using this code in the activities where I want to show the ad

import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
.
.
    AdView mAdView = (AdView) findViewById(R.id.adView);
            AdRequest adRequest = new AdRequest.Builder().build();
            mAdView.loadAd(adRequest);

Inside android manifest file

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
.
.
.
 <activity
            android:name="com.google.android.gms.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
            android:theme="@android:style/Theme.Translucent" />

In the strings.xml file

<string name="banner_ad_unit_id">ca-app-pub-3**************3/*********7</string>

Inside the activities xml I have used the following code

 <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_alignParentBottom="true"
        ads:adSize="BANNER"
        ads:adUnitId="@string/banner_ad_unit_id">
    </com.google.android.gms.ads.AdView>

Also, I'm using two different email-Ids the one for admob is different from that of play store id from which I have uploaded the app. Here's the link of the screenshot of the admob.

http://postimg.org/image/kh26x3oyh/

Ahmed Raza
  • 73
  • 6

1 Answers1

0

Note: Ads can only be shown to the user, if they are available from the ad network.

  1. Do you have both these permissions defined?

    < uses-permission android:name="android.permission.INTERNET" />

    < uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

  2. Make sure the banner add unit is not a test.

  3. Add a listener to see if adds are being loaded:

    mAdView = (AdView) findViewById(R.id.adView);
    mAdView.setAdListener(new AdListener() {
        // Called when an ad is loaded.
        @Override
        public void onAdLoaded() {
            Log.e(TAG, "Google onAdLoaded");
        }
    
        // Called when an ad failed to load.
        @Override
        public void onAdFailedToLoad(int error) {
            String message = "Google onAdFailedToLoad: " + getErrorReason(error);
            Log.e(TAG, message);
        }
    
        // Called when an Activity is created in front of the app
        // (e.g. an interstitial is shown, or an ad is clicked and launches a new Activity).
        @Override
        public void onAdOpened() {
            Log.e(TAG, "Google onAdOpened");
        }
    
        // Called when an ad is clicked and about to return to the application.
        @Override
        public void onAdClosed() {
            Log.e(TAG, "Google onAdClosed");
        }
    
        // Called when an ad is clicked and going to start a new Activity that will leave the application
        // (e.g. breaking out to the Browser or Maps application).
        @Override
        public void onAdLeftApplication() {
            Log.d(TAG, "Google onAdLeftApplication");
        }
    });
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);
    

You also need this function:

private String getErrorReason(int errorCode) {
    // Gets a string error reason from an error code.
    String errorReason = "";
    switch (errorCode) {
        case AdRequest.ERROR_CODE_INTERNAL_ERROR:
            errorReason = "Internal error";
            break;
        case AdRequest.ERROR_CODE_INVALID_REQUEST:
            errorReason = "Invalid request";
            break;
        case AdRequest.ERROR_CODE_NETWORK_ERROR:
            errorReason = "Network Error";
            break;
        case AdRequest.ERROR_CODE_NO_FILL:
            errorReason = "No fill";
            break;
    }
    return errorReason;
}
Philip Herbert
  • 4,599
  • 2
  • 37
  • 40
  • Actually Ads are showing but impressions/clicks are not updating. – Ahmed Raza Jul 26 '15 at 21:10
  • How do I make sure that the banner add unit is not a test. I have posted all the code is there any clue that it is a test ad from the given code? – Ahmed Raza Jul 26 '15 at 21:11
  • 1. I see you are using a relative layout, is the add visible to the user? Did you test on more than one device? 2. Note you can only get clicks, if someone can see and does click an ad. – Philip Herbert Jul 26 '15 at 21:17
  • These are what test ads look like: http://www.google.com/imgres?imgurl=http://www.androidbegin.com/wp-content/uploads/2014/07/AdmobAds.png&imgrefurl=http://www.androidbegin.com/tutorial/integrating-new-google-admob-banner-interstitial-ads/&h=456&w=519&tbnid=bGtTfYlCy-d8sM:&docid=n59fkiq6PH3XyM&ei=jE61Vc7KHcPS-QH2z7TgCA&tbm=isch&ved=0CCAQMygDMANqFQoTCM7AvK7c-cYCFUNpPgod9icNjA – Philip Herbert Jul 26 '15 at 21:18
  • If they are not test ads and are new ads, it takes 24-48hrs to propagate the system. – Philip Herbert Jul 26 '15 at 21:22
  • Yes app is visible to the user. In variety of devices including phone and tablet. Even you can see it yourself. https://play.google.com/store/apps/details?id=in.ahmedraza.journey – Ahmed Raza Jul 26 '15 at 21:28
  • The point is whenever I use it from emulator or any other test device during development impressions are counted. While the same app downloaded from playstore the ads show but it doesn't update any impressions. – Ahmed Raza Jul 26 '15 at 21:33
  • Ok, I just downloaded the app and I can see the ads. But what I can tell you from my experience is that if no one clicks them, there will be no stats for clicks. – Philip Herbert Jul 26 '15 at 21:37
  • I am actually developing an app using the Adsense Management API and I am getting some strange results as it relates to impressions. The statistics I see for admob impressions vary on the adsense dashboard, admob dashboard and the web api reports generator. – Philip Herbert Jul 26 '15 at 21:41
  • You can use the generator to see there are stats available: https://developers.google.com/adsense/management/v1.4/reference/accounts/reports/generate#try-it – Philip Herbert Jul 26 '15 at 21:42
  • Create a new ad unit and replace the old one here: `ca-app-pub-3**************3/*********7`. I think this will fix your problem. – Philip Herbert Jul 29 '15 at 14:16