Best Practice for integrate google Admob into the apps in code level

This article will list some best practices for integrate google Admob into the app (mainly for unity apps, but it still useful for other ios or android app).

1. Always stay with latest Admob SDK

Please always stay with current version of Admob SDK. Otherwise your Ads at risk of not serving. There will be less ads or no ads if you use an out-date version. For more version you can check Deprecation and sunset section.

You need to confirm with your used version, and check that version will works or not. Then you need to arrange a schedule to update your apps anally to following with the latest version.

2. Pre-cache ads

After the Admob initialized successfully, you need to load those interstitial and reward videos immediately. Preload or cache those ads before it need to show. When it’s time for watching video, then show it without any lagging. This is a good experience suggested by Google Admob.

3. Failure handling

Sometimes, you will encounter loading failure. You will need to try again may be 10s or 15s later. And If you come across continues loading failure, you need to count how many times failure happened. If it reach a maximum number (may 10 or 20 times), you need to stop try to load and never load again, or try with a bigger interval that such as 5 or 10 minutes.

Your user device may have less stable network condition. Their network may temporarily become lost. So do some trying work is a good idea.

By the way, please remember reset the failure counter if the ad was successfully loaded.

4. Destroy ads after ads closed

Clean up the interstitial ad , Google Admob already added this line now. This line was not exists before. It’s sample code will do the clean up work while do an ad request.

Call Destroy can release those unused ad resources. There is another reason why you MUST do this. If you do not do this, some ad element (such as app download link bar) still display overlap on the screen after you close the ads. There is no way to close such ad element by user proactively. This is VERY VERY annoying. It looks like a critical Admob SDK BUG!

if (interstitialAd != null)
{
    interstitialAd.Destroy();
    interstitialAd = null;
}

5. Mobile Ads Plugin In Unity Asset Store

Try to search with key words “mobile ads” in unity asset store. You will find bunch of plugins that help you integrate with ads (not only Admob, but also include others as Unityads, AppLovin, IronSource and so on).

With those plugins, you will no need to touch low level code, such as listen to events, failure handling. Most of them will have equivalent implement. For safe, you should go with a glance peek.

6. Use Mediation or NOT

Mediation is mean how to select ad among multiple ad providers. If you have several ads providers are ready, how to pick one of them? By max avenue ? Or by pre-defined order?

Actually, you ready did some mediation work in your app before. You integrate multiple Ad SDK, and choose play one ad-network in one placement, and another ad-network in other placement. For example, watch Chartboost video for earn some free cash, watch Admob for earn some coins, or watch UnityAds video for re-live.

With mediation, it seems the work was shift from app to ad-provider. They make the decision for you. Just as there is only one ad-provider in your app’s code.

To implement mediation of multiple ad providers, Admob gives us some methods to work and configure 3rd party SDKs. With such method, you only deal with Admob, other 3rd party ads will be choose by Admob Mediation.

Mediation can save your work a lots! It seems a trend. Unity mobile-ads plugin “Mobile Ads 2.0” already change it’s code to mediation way.

But put all your eggs in one basket is a bad idea.

For example, currently if you work with Admob mediation, your apps are taken down for Google Play Store, and the Admob ads are banned consequently. How about other ads with Admob mediation under that app? This is the key point that you should think twice especially with strict Google Admob | Google Play Store App policy now.

Some app site will craw your google play store apps, you may still have some users. So why not make other ad-providers make money for you even google Admob say no? In this situation, integrating multiple ad-providers in client with your local choosing logic may introduce more work but it deserved.

留下评论

您的邮箱地址不会被公开。 必填项已用 * 标注