Using AdMob In Your Android App? Beware Of The Pre-Launch Report

on

Update: When this article was written, several years ago, it wasn’t clear whether AdMob automatically filtered out traffic originating from the Firebase Test Lab. Since then, Google has addressed the issue in their FAQ, clarifying that “Google ads already exclude traffic from the pre-launch report address ranges”. You only need to read this article if you are interested in temporarily disabling your ad units in the Test Lab for other ad networks.

About a year ago, Google introduced a new feature in the Play Console, the pre-launch report. Each time you upload a new APK, Firebase Test Lab automatically launches and tests your app on various devices running different Android versions.

After the tests are complete, you can access the results by going to Release managementPre-launch report.

The pre-launch report is a very useful feature, since it goes through all of your screens, performs basic actions, and catches common issues and crashes, before you deploy your app to production.

Pre-launch report

Unfortunately, if your application happens to integrate with AdMob, then there’s a chance that Test Lab might get you into trouble. How? Well, it might be inadvertently clicking on your ad units while testing your app!

It is not clear whether AdMob automatically filters out traffic originating from the Firebase Test Lab, but two things are for sure:

  1. Google considers any invalid clicks on your ad units as being your responsibility and may disable your account if they detect high levels of invalid activity:

    We understand that a third party may generate invalid activity on your ads without your knowledge or permission. However, ultimately it is your responsibility as the publisher to ensure that the activity on your ads is valid.

  2. Test Lab’s own documentation explicitly mentions that you should notify your digital ad provider to filter out Test Lab requests:

    App developers should notify any digital advertising providers they work with to filter out revenues and all corresponding traffic generated from devices that belong to testing providers, including Test Lab.

So what can you do about it?

One approach could be to opt-out of the pre-launch report all together — just go to SettingsPre-launch report and set to No. However, you will then lose the benefits of testing your app on all those devices before deployment.

Disable pre-launch report

Since Test Lab is unquestionably useful to many developers, the best approach would be to temporary disable your ad units, each time your application is running on that environment.

The good news is that detecting if you are running on Test Lab is trivial to implement by using the code snippet below.

private boolean isTestDevice() {
  String testLabSetting = Settings.System.getString(getContentResolver(), "firebase.test.lab");
  return "true".equals(testLabSetting);
}

In any case, there’s no reason to be testing your ad units in the Test Lab, so make sure to disable them — even just to be on the safe side.