AdMob
Last updated
Was this helpful?
Last updated
Was this helpful?
This article explains how to display ads in your app using AdMob in Monaca. AdMob is a Google advertising service that can be easily integrated with a Google account. By reading this article, you will be able to integrate AdMob and display ads in your app.
The sample code for explanation is available at the following URL:
First, access and apply for advertising.
During this application process, an app ID will be issued, so be sure to copy it. (Example ID: ca-app-pub-3089782807744052~xxxxxxxx)
Once the application is approved, an ad ID will be issued, which will be used when displaying the ads, so make sure to also keep it on record.
Note that approval is required before ads can be displayed, so during development, it is recommended to use the test ads provided by Google.
Please install the following plugin:
admob-plus-cordova (URL: )
After installing the plugin, set "APP_ID_ANDROID" in the plugin's configuration screen. This value should specify the App ID obtained from AdMob. This is for Android settings. Additionally, for iOS settings, you need to set the value of "APP_ID_IOS".
The following code executes an ad that is displayed when the app is launched.
The ad is displayed when show() is executed.
To display a banner ad at the bottom of the app, create an object of "admob.BannerAd" as shown in the following code. The ad is displayed using show().
After applying to AdMob or during development, banners may not be displayed. In such cases, you can use the test ad ID provided by AdMob.
App Open
ca-app-pub-3940256099942544/5575463023
ca-app-pub-3940256099942544/9257395921
Adaptive Banner
ca-app-pub-3940256099942544/2435281174
ca-app-pub-3940256099942544/9214589741
Fixed Size Banner
ca-app-pub-3940256099942544/2934735716
ca-app-pub-3940256099942544/6300978111
Interstitial
ca-app-pub-3940256099942544/4411468910
ca-app-pub-3940256099942544/1033173712
Rewarded Ads
ca-app-pub-3940256099942544/1712485313
ca-app-pub-3940256099942544/5224354917
Rewarded Interstitial
ca-app-pub-3940256099942544/6978759866
ca-app-pub-3940256099942544/5354046379
Native
ca-app-pub-3940256099942544/3986624511
ca-app-pub-3940256099942544/2247696110
Native Video
ca-app-pub-3940256099942544/2521693316
ca-app-pub-3940256099942544/1044960115
You have now successfully integrated AdMob into your mobile application using Monaca. This will enable you to monetize your app with targeted ads from the AdMob platform. With Monaca's powerful tools and the AdMob service, you can create a profitable mobile application that provides value to both users and advertisers.