Skip to content

Repository files navigation


AdMob

@capacitor-community/admob

Capacitor community plugin for native AdMob.

Read the full documentation


Maintainers

Maintainer GitHub Social Website
Masahiko Sakakibara rdlabo @rdlabo rdlabo.dev
Saninn Salas Diaz Saninn Salas Diaz @SaninnSalas

Maintenance Status: Actively Maintained

Contributors ✨

Made with contributors-img.

Demo

Demo code is here.

Screenshots

Banner Interstitial Reward App Open
iOS
Android

Overview

Capacitor community plugin for native AdMob. This plugin wraps the Google Mobile Ads SDK for iOS and Android so you can display banner, interstitial, rewarded, rewarded interstitial, and app open ads in Capacitor apps.

Features

  • Banner ads (including adaptive banners)
  • Interstitial ads
  • Rewarded video ads
  • Rewarded interstitial ads
  • App open ads
  • Google User Messaging Platform (UMP) consent support
  • App Tracking Transparency (iOS tracking permission) helpers

Choose by advertising goal

Goal Ad format Guide
Keep an ad visible alongside app content Banner Banner Ads
Show a full-screen ad at a natural break without granting a reward Interstitial Interstitial Ads
Offer a dedicated rewarded experience Rewarded Rewarded Ads
Offer a reward at a natural transition Rewarded interstitial Rewarded Ads
Monetize an app-open experience App Open App Open Ads

Quick start

After Installation, initialize the SDK, request consent, and show a banner:

import { AdMob, AdmobConsentStatus, BannerAdOptions, BannerAdSize, BannerAdPosition } from '@capacitor-community/admob';

async function startAdMob() {
  await AdMob.initialize();

  let consentInfo = await AdMob.requestConsentInfo();
  if (consentInfo.isConsentFormAvailable && consentInfo.status === AdmobConsentStatus.REQUIRED) {
    consentInfo = await AdMob.showConsentForm();
  }

  if (!consentInfo.canRequestAds) {
    return;
  }

  const options: BannerAdOptions = {
    adId: 'YOUR_AD_UNIT_ID',
    adSize: BannerAdSize.ADAPTIVE_BANNER,
    position: BannerAdPosition.BOTTOM_CENTER,
    margin: 0,
  };
  await AdMob.showBanner(options);
}

The banner sits on the native screen above the WebView, so it can cover your HTML. See Banner Ads to inset your layout. Details: Configuration, Consent, and the per-format guides.

Installation

This plugin already ships Google Mobile Ads SDK. Install the package, then add your AdMob application ID in AndroidManifest / Info.plist. Google's Get started guides for Android and iOS explain app IDs and SKAdNetwork identifiers (Apple's ad conversion IDs); do not add a second Mobile Ads dependency.

This plugin targets @capacitor-community/admob v8 and Capacitor 8. It supports iOS 15 or later and Android API 24 or later.

npm install @capacitor-community/admob
npx cap sync

If you still use Capacitor 7, install @capacitor-community/admob@7.

Google Mobile Ads SDK versions

This major version pins Google Mobile Ads SDK 25.4.x on Android and 13.6.0 on iOS (Swift Package Manager and CocoaPods). Leave those versions unless you have a specific need. Google's Next-Gen SDK for Android waits until the next plugin major. See Migration for the policy behind the pins.

Android configuration

In android/app/src/main/AndroidManifest.xml, add the following under <application>:

<meta-data
  android:name="com.google.android.gms.ads.APPLICATION_ID"
  android:value="@string/admob_app_id" />

In android/app/src/main/res/values/strings.xml:

<string name="admob_app_id">[APP_ID]</string>

Replace [APP_ID] with your AdMob application ID, not an ad unit ID.

Variables

You can leave these unset. Override them in your app's variables.gradle only when you need a specific artifact version:

Variable Artifact Default
playServicesAdsVersion com.google.android.gms:play-services-ads 25.4.+
userMessagingPlatformVersion com.google.android.ump:user-messaging-platform 4.0.0
androidxCoreKTXVersion androidx.core:core-ktx 1.15.0

iOS configuration

Add the following inside the outermost <dict> in ios/App/App/Info.plist:

<key>GADIsAdManagerApp</key>
<true/>
<key>GADApplicationIdentifier</key>
<string>[APP_ID]</string>
<key>SKAdNetworkItems</key>
<array>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>cstr6suwn9.skadnetwork</string>
  </dict>
</array>
<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>

Replace [APP_ID] with your AdMob application ID, and describe your actual tracking use in NSUserTrackingUsageDescription.

The SKAdNetworkItems snippet includes Google's own identifier. Add the other IDs from Google's iOS setup guide.

Troubleshooting

If CocoaPods cannot resolve Google-Mobile-Ads-SDK:

[error] Error running update: Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "Google-Mobile-Ads-SDK":

Run pod repo update in ios/, then npx cap sync ios again.

Documentation

Start with Installation above, then Configuration and Consent before loading ads. Pick an ad format from the table above. The same guides are also on the documentation site (English and Japanese). If you opened this README on npm, use that site for the guides — the docs/ files live in the GitHub repository. Method signatures are in the API section below.

  • ConfigurationAdMob.initialize and SDK options.
  • Consent — privacy consent and iOS tracking authorization.
  • Banner Ads — banner options, lifecycle, and events.
  • Full-screen ads:
    • Interstitial Ads — load, show, and multiple prepared ads.
    • Rewarded Ads — rewarded video, rewarded interstitial, and server-side verification.
  • App Open Ads — load and present on foreground transitions.
  • Ad Events — shared lifecycle events, errors, and revenue data.
  • Testing — demo ad units, test devices, and consent testing.
  • Migration Guide — historical notes when upgrading from older plugin versions.

Index

API

initialize(...)

initialize(options?: AdMobInitializationOptions | undefined) => Promise<void>

Initializes the Google Mobile Ads SDK.

Param Type Description
options AdMobInitializationOptions Optional SDK initialization settings.

Since: 1.1.2


trackingAuthorizationStatus()

trackingAuthorizationStatus() => Promise<TrackingAuthorizationStatusInterface>

Returns the current App Tracking Transparency authorization status on iOS 14 and later. Returns authorized on earlier iOS versions, Android, and web.

Returns: Promise<TrackingAuthorizationStatusInterface>

Since: 3.1.0


requestTrackingAuthorization()

requestTrackingAuthorization() => Promise<void>

Requests App Tracking Transparency authorization on iOS 14 and later. Resolves without taking action on earlier iOS versions, Android, and web.

Since: 5.2.0


setApplicationMuted(...)

setApplicationMuted(options: ApplicationMutedOptions) => Promise<void>

Reports whether the application audio is muted to the Google Mobile Ads SDK.

Param Type
options ApplicationMutedOptions

Since: 4.1.1


setApplicationVolume(...)

setApplicationVolume(options: ApplicationVolumeOptions) => Promise<void>

Reports the application audio volume to the Google Mobile Ads SDK.

Param Type
options ApplicationVolumeOptions

Since: 4.1.1


loadAppOpen(...)

loadAppOpen(options: AppOpenAdOptions) => Promise<AdLoadInfo>

Loads an App Open ad and returns the loaded ad unit ID.

Param Type
options AppOpenAdOptions

Returns: Promise<AdLoadInfo>


showAppOpen(...)

showAppOpen(options?: AdShowOptions | undefined) => Promise<void>

Shows a loaded App Open ad.

Param Type Description
options AdShowOptions Optional. Pass { adId } to show a specific prepared ad instead of the most recent one.

isAppOpenLoaded(...)

isAppOpenLoaded(options?: AdShowOptions | undefined) => Promise<{ value: boolean; }>

Checks whether an App Open ad is loaded.

Param Type Description
options AdShowOptions Optional. Pass an adId to check a specific prepared ad instead of the most recent one.

Returns: Promise<{ value: boolean; }>


addListener(AppOpenAdPluginEvents.Loaded, ...)

addListener(eventName: AppOpenAdPluginEvents.Loaded, listenerFunc: (info: AdLoadInfo) => void) => Promise<PluginListenerHandle>

Listens for App Open ad load events.

Param Type
eventName AppOpenAdPluginEvents.Loaded
listenerFunc (info: AdLoadInfo) => void

Returns: Promise<PluginListenerHandle>


addListener(AppOpenAdPluginEvents.FailedToLoad, ...)

addListener(eventName: AppOpenAdPluginEvents.FailedToLoad, listenerFunc: (error: AdMobError) => void) => Promise<PluginListenerHandle>

Listens for App Open ad load failures.

Param Type
eventName AppOpenAdPluginEvents.FailedToLoad
listenerFunc (error: AdMobError) => void

Returns: Promise<PluginListenerHandle>


addListener(AppOpenAdPluginEvents.Opened, ...)

addListener(eventName: AppOpenAdPluginEvents.Opened, listenerFunc: () => void) => Promise<PluginListenerHandle>

Listens for App Open ad opened events.

Param Type
eventName AppOpenAdPluginEvents.Opened
listenerFunc () => void

Returns: Promise<PluginListenerHandle>


addListener(AppOpenAdPluginEvents.Closed, ...)

addListener(eventName: AppOpenAdPluginEvents.Closed, listenerFunc: () => void) => Promise<PluginListenerHandle>

Listens for App Open ad closed events.

Param Type
eventName AppOpenAdPluginEvents.Closed
listenerFunc () => void

Returns: Promise<PluginListenerHandle>


addListener(AppOpenAdPluginEvents.FailedToShow, ...)

addListener(eventName: AppOpenAdPluginEvents.FailedToShow, listenerFunc: (error: AdMobError) => void) => Promise<PluginListenerHandle>

Listens for App Open ad show failures.

Param Type
eventName AppOpenAdPluginEvents.FailedToShow
listenerFunc (error: AdMobError) => void

Returns: Promise<PluginListenerHandle>


addListener(AppOpenAdPluginEvents.AdImpression, ...)

addListener(eventName: AppOpenAdPluginEvents.AdImpression, listenerFunc: (data: AdMobRevenueData) => void) => Promise<PluginListenerHandle>

Listens for App Open impression-level ad revenue events.

Param Type
eventName AppOpenAdPluginEvents.AdImpression
listenerFunc (data: AdMobRevenueData) => void

Returns: Promise<PluginListenerHandle>


showBanner(...)

showBanner(options: BannerAdOptions) => Promise<void>

Displays a banner ad.

Param Type Description
options BannerAdOptions AdOptions

Since: 1.1.2


hideBanner()

hideBanner() => Promise<void>

Hides the current banner without destroying it.

Since: 1.1.2


resumeBanner()

resumeBanner() => Promise<void>

Shows a previously hidden banner.

Since: 1.1.2


removeBanner()

removeBanner() => Promise<void>

Destroys the current banner and removes it from the screen.

Since: 1.1.2


addListener(BannerAdPluginEvents.SizeChanged, ...)

addListener(eventName: BannerAdPluginEvents.SizeChanged, listenerFunc: (info: AdMobBannerSize) => void) => Promise<PluginListenerHandle>

Listens for changes to the displayed banner dimensions.

Param Type Description
eventName BannerAdPluginEvents.SizeChanged bannerAdSizeChanged
listenerFunc (info: AdMobBannerSize) => void

Returns: Promise<PluginListenerHandle>

Since: 3.0.0


addListener(BannerAdPluginEvents.Loaded, ...)

addListener(eventName: BannerAdPluginEvents.Loaded, listenerFunc: () => void) => Promise<PluginListenerHandle>

Listens for banner ad load events.

Param Type Description
eventName BannerAdPluginEvents.Loaded bannerAdLoaded
listenerFunc () => void

Returns: Promise<PluginListenerHandle>

Since: 3.0.0


addListener(BannerAdPluginEvents.FailedToLoad, ...)

addListener(eventName: BannerAdPluginEvents.FailedToLoad, listenerFunc: (info: AdMobError) => void) => Promise<PluginListenerHandle>

Listens for banner ad load failures.

Param Type Description
eventName BannerAdPluginEvents.FailedToLoad bannerAdFailedToLoad
listenerFunc (info: AdMobError) => void

Returns: Promise<PluginListenerHandle>

Since: 3.0.0


addListener(BannerAdPluginEvents.Opened, ...)

addListener(eventName: BannerAdPluginEvents.Opened, listenerFunc: () => void) => Promise<PluginListenerHandle>

Listens for banner overlay opened events.

Param Type Description
eventName BannerAdPluginEvents.Opened bannerAdOpened
listenerFunc () => void

Returns: Promise<PluginListenerHandle>

Since: 3.0.0


addListener(BannerAdPluginEvents.Closed, ...)

addListener(eventName: BannerAdPluginEvents.Closed, listenerFunc: () => void) => Promise<PluginListenerHandle>

Listens for banner overlay closed events.

Param Type Description
eventName BannerAdPluginEvents.Closed bannerAdClosed
listenerFunc () => void

Returns: Promise<PluginListenerHandle>

Since: 3.0.0


addListener(BannerAdPluginEvents.AdImpression, ...)

addListener(eventName: BannerAdPluginEvents.AdImpression, listenerFunc: () => void) => Promise<PluginListenerHandle>

Listens for banner impression events.

Param Type Description
eventName BannerAdPluginEvents.AdImpression AdImpression
listenerFunc () => void

Returns: Promise<PluginListenerHandle>

Since: 3.0.0


addListener(BannerAdPluginEvents.AdPaid, ...)

addListener(eventName: BannerAdPluginEvents.AdPaid, listenerFunc: (data: AdMobRevenueData) => void) => Promise<PluginListenerHandle>

Listens for banner impression-level ad revenue events.

Param Type
eventName BannerAdPluginEvents.AdPaid
listenerFunc (data: AdMobRevenueData) => void

Returns: Promise<PluginListenerHandle>


requestConsentInfo(...)

requestConsentInfo(options?: AdmobConsentRequestOptions | undefined) => Promise<AdmobConsentInfo>

Request user consent information

Param Type Description
options AdmobConsentRequestOptions ConsentRequestOptions

Returns: Promise<AdmobConsentInfo>

Since: 5.0.0


showPrivacyOptionsForm()

showPrivacyOptionsForm() => Promise<void>

Shows a google privacy options form (rendered from your GDPR message config).

Since: 7.0.3


showConsentForm()

showConsentForm() => Promise<AdmobConsentInfo>

Shows a google user consent form (rendered from your GDPR message config).

Returns: Promise<AdmobConsentInfo>

Since: 5.0.0


resetConsentInfo()

resetConsentInfo() => Promise<void>

Resets the UMP SDK state. Call requestConsentInfo function again to allow user modify their consent

Since: 5.0.0


prepareInterstitial(...)

prepareInterstitial(options: AdOptions) => Promise<AdLoadInfo>

Loads an interstitial ad and returns the loaded ad unit ID.

Param Type Description
options AdOptions AdOptions

Returns: Promise<AdLoadInfo>

Since: 1.1.2


showInterstitial(...)

showInterstitial(options?: AdShowOptions | undefined) => Promise<void>

Shows a loaded interstitial ad.

Param Type Description
options AdShowOptions Optional. Pass { adId } to show a specific prepared ad instead of the most recent one.

Since: 1.1.2


addListener(InterstitialAdPluginEvents.FailedToLoad, ...)

addListener(eventName: InterstitialAdPluginEvents.FailedToLoad, listenerFunc: (error: AdMobError) => void) => Promise<PluginListenerHandle>

Listens for interstitial ad load failures.

Param Type
eventName InterstitialAdPluginEvents.FailedToLoad
listenerFunc (error: AdMobError) => void

Returns: Promise<PluginListenerHandle>


addListener(InterstitialAdPluginEvents.Loaded, ...)

addListener(eventName: InterstitialAdPluginEvents.Loaded, listenerFunc: (info: AdLoadInfo) => void) => Promise<PluginListenerHandle>

Listens for interstitial ad load events.

Param Type
eventName InterstitialAdPluginEvents.Loaded
listenerFunc (info: AdLoadInfo) => void

Returns: Promise<PluginListenerHandle>


addListener(InterstitialAdPluginEvents.Dismissed, ...)

addListener(eventName: InterstitialAdPluginEvents.Dismissed, listenerFunc: () => void) => Promise<PluginListenerHandle>

Listens for interstitial ad dismissed events.

Param Type
eventName InterstitialAdPluginEvents.Dismissed
listenerFunc () => void

Returns: Promise<PluginListenerHandle>


addListener(InterstitialAdPluginEvents.FailedToShow, ...)

addListener(eventName: InterstitialAdPluginEvents.FailedToShow, listenerFunc: (error: AdMobError) => void) => Promise<PluginListenerHandle>

Listens for interstitial ad show failures.

Param Type
eventName InterstitialAdPluginEvents.FailedToShow
listenerFunc (error: AdMobError) => void

Returns: Promise<PluginListenerHandle>


addListener(InterstitialAdPluginEvents.Showed, ...)

addListener(eventName: InterstitialAdPluginEvents.Showed, listenerFunc: () => void) => Promise<PluginListenerHandle>

Listens for interstitial ad shown events.

Param Type
eventName InterstitialAdPluginEvents.Showed
listenerFunc () => void

Returns: Promise<PluginListenerHandle>


addListener(InterstitialAdPluginEvents.AdImpression, ...)

addListener(eventName: InterstitialAdPluginEvents.AdImpression, listenerFunc: (data: AdMobRevenueData) => void) => Promise<PluginListenerHandle>

Listens for interstitial impression-level ad revenue events.

Param Type
eventName InterstitialAdPluginEvents.AdImpression
listenerFunc (data: AdMobRevenueData) => void

Returns: Promise<PluginListenerHandle>


prepareRewardVideoAd(...)

prepareRewardVideoAd(options: RewardAdOptions) => Promise<AdLoadInfo>

Loads a rewarded ad and returns the loaded ad unit ID.

Param Type Description
options RewardAdOptions RewardAdOptions

Returns: Promise<AdLoadInfo>

Since: 1.1.2


showRewardVideoAd(...)

showRewardVideoAd(options?: AdShowOptions | undefined) => Promise<AdMobRewardItem>

Shows a loaded rewarded ad and resolves when the user earns the reward.

Param Type Description
options AdShowOptions Optional. Pass { adId } to show a specific prepared ad instead of the most recent one.

Returns: Promise<AdMobRewardItem>

Since: 1.1.2


addListener(RewardAdPluginEvents.FailedToLoad, ...)

addListener(eventName: RewardAdPluginEvents.FailedToLoad, listenerFunc: (error: AdMobError) => void) => Promise<PluginListenerHandle>

Listens for rewarded ad load failures.

Param Type
eventName RewardAdPluginEvents.FailedToLoad
listenerFunc (error: AdMobError) => void

Returns: Promise<PluginListenerHandle>


addListener(RewardAdPluginEvents.Loaded, ...)

addListener(eventName: RewardAdPluginEvents.Loaded, listenerFunc: (info: AdLoadInfo) => void) => Promise<PluginListenerHandle>

Listens for rewarded ad load events.

Param Type
eventName RewardAdPluginEvents.Loaded
listenerFunc (info: AdLoadInfo) => void

Returns: Promise<PluginListenerHandle>


addListener(RewardAdPluginEvents.Rewarded, ...)

addListener(eventName: RewardAdPluginEvents.Rewarded, listenerFunc: (reward: AdMobRewardItem) => void) => Promise<PluginListenerHandle>

Listens for earned reward events.

Param Type
eventName RewardAdPluginEvents.Rewarded
listenerFunc (reward: AdMobRewardItem) => void

Returns: Promise<PluginListenerHandle>


addListener(RewardAdPluginEvents.Dismissed, ...)

addListener(eventName: RewardAdPluginEvents.Dismissed, listenerFunc: () => void) => Promise<PluginListenerHandle>

Listens for rewarded ad dismissed events.

Param Type
eventName RewardAdPluginEvents.Dismissed
listenerFunc () => void

Returns: Promise<PluginListenerHandle>


addListener(RewardAdPluginEvents.FailedToShow, ...)

addListener(eventName: RewardAdPluginEvents.FailedToShow, listenerFunc: (error: AdMobError) => void) => Promise<PluginListenerHandle>

Listens for rewarded ad show failures.

Param Type
eventName RewardAdPluginEvents.FailedToShow
listenerFunc (error: AdMobError) => void

Returns: Promise<PluginListenerHandle>


addListener(RewardAdPluginEvents.Showed, ...)

addListener(eventName: RewardAdPluginEvents.Showed, listenerFunc: () => void) => Promise<PluginListenerHandle>

Listens for rewarded ad shown events.

Param Type
eventName RewardAdPluginEvents.Showed
listenerFunc () => void

Returns: Promise<PluginListenerHandle>


addListener(RewardAdPluginEvents.AdImpression, ...)

addListener(eventName: RewardAdPluginEvents.AdImpression, listenerFunc: (data: AdMobRevenueData) => void) => Promise<PluginListenerHandle>

Listens for rewarded impression-level ad revenue events.

Param Type
eventName RewardAdPluginEvents.AdImpression
listenerFunc (data: AdMobRevenueData) => void

Returns: Promise<PluginListenerHandle>


prepareRewardInterstitialAd(...)

prepareRewardInterstitialAd(options: RewardInterstitialAdOptions) => Promise<AdLoadInfo>

Loads a rewarded interstitial ad and returns the loaded ad unit ID.

Param Type Description
options RewardInterstitialAdOptions RewardInterstitialAdOptions

Returns: Promise<AdLoadInfo>

Since: 1.1.2


showRewardInterstitialAd(...)

showRewardInterstitialAd(options?: AdShowOptions | undefined) => Promise<AdMobRewardInterstitialItem>

Shows a loaded rewarded interstitial ad and resolves when the user earns the reward.

Param Type Description
options AdShowOptions Optional. Pass { adId } to show a specific prepared ad instead of the most recent one.

Returns: Promise<AdMobRewardInterstitialItem>

Since: 1.1.2


addListener(RewardInterstitialAdPluginEvents.FailedToLoad, ...)

addListener(eventName: RewardInterstitialAdPluginEvents.FailedToLoad, listenerFunc: (error: AdMobError) => void) => Promise<PluginListenerHandle>

Listens for rewarded interstitial ad load failures.

Param Type
eventName RewardInterstitialAdPluginEvents.FailedToLoad
listenerFunc (error: AdMobError) => void

Returns: Promise<PluginListenerHandle>


addListener(RewardInterstitialAdPluginEvents.Loaded, ...)

addListener(eventName: RewardInterstitialAdPluginEvents.Loaded, listenerFunc: (info: AdLoadInfo) => void) => Promise<PluginListenerHandle>

Listens for rewarded interstitial ad load events.

Param Type
eventName RewardInterstitialAdPluginEvents.Loaded
listenerFunc (info: AdLoadInfo) => void

Returns: Promise<PluginListenerHandle>


addListener(RewardInterstitialAdPluginEvents.Rewarded, ...)

addListener(eventName: RewardInterstitialAdPluginEvents.Rewarded, listenerFunc: (reward: AdMobRewardInterstitialItem) => void) => Promise<PluginListenerHandle>

Listens for earned reward events.

Param Type
eventName RewardInterstitialAdPluginEvents.Rewarded
listenerFunc (reward: AdMobRewardInterstitialItem) => void

Returns: Promise<PluginListenerHandle>


addListener(RewardInterstitialAdPluginEvents.Dismissed, ...)

addListener(eventName: RewardInterstitialAdPluginEvents.Dismissed, listenerFunc: () => void) => Promise<PluginListenerHandle>

Listens for rewarded interstitial ad dismissed events.

Param Type
eventName RewardInterstitialAdPluginEvents.Dismissed
listenerFunc () => void

Returns: Promise<PluginListenerHandle>


addListener(RewardInterstitialAdPluginEvents.FailedToShow, ...)

addListener(eventName: RewardInterstitialAdPluginEvents.FailedToShow, listenerFunc: (error: AdMobError) => void) => Promise<PluginListenerHandle>

Listens for rewarded interstitial ad show failures.

Param Type
eventName RewardInterstitialAdPluginEvents.FailedToShow
listenerFunc (error: AdMobError) => void

Returns: Promise<PluginListenerHandle>


addListener(RewardInterstitialAdPluginEvents.Showed, ...)

addListener(eventName: RewardInterstitialAdPluginEvents.Showed, listenerFunc: () => void) => Promise<PluginListenerHandle>

Listens for rewarded interstitial ad shown events.

Param Type
eventName RewardInterstitialAdPluginEvents.Showed
listenerFunc () => void

Returns: Promise<PluginListenerHandle>


addListener(RewardInterstitialAdPluginEvents.AdImpression, ...)

addListener(eventName: RewardInterstitialAdPluginEvents.AdImpression, listenerFunc: (data: AdMobRevenueData) => void) => Promise<PluginListenerHandle>

Listens for rewarded interstitial impression-level ad revenue events.

Param Type
eventName RewardInterstitialAdPluginEvents.AdImpression
listenerFunc (data: AdMobRevenueData) => void

Returns: Promise<PluginListenerHandle>


Interfaces

AdMobInitializationOptions

Prop Type Description Default Since
testingDevices string[] Device IDs to register as test devices when {@link AdMobInitializationOptions.initializeForTesting} is true. Requests from registered devices receive test ads and do not generate invalid traffic. 1.2.0
initializeForTesting boolean Whether to register {@link AdMobInitializationOptions.testingDevices} as test devices. false 1.2.0
tagForChildDirectedTreatment boolean For purposes of the Children's Online Privacy Protection Act (COPPA), there is a setting called tagForChildDirectedTreatment. 3.1.0
tagForUnderAgeOfConsent boolean When using this feature, a Tag For Users under the Age of Consent in Europe (TFUA) parameter will be included in all future ad requests. 3.1.0
maxAdContentRating MaxAdContentRating The maximum ad content rating applied to all ad requests. Ads with a higher rating are excluded. 3.1.0

TrackingAuthorizationStatusInterface

The current iOS App Tracking Transparency authorization status.

Prop Type Description
status 'authorized' | 'denied' | 'notDetermined' | 'restricted' The authorization status reported by App Tracking Transparency.

ApplicationMutedOptions

Prop Type Description Since
muted boolean To inform the SDK that the app volume has been muted. Note: Video ads that are ineligible to be shown with muted audio are not returned for ad requests made, when the app volume is reported as muted or set to a value of 0. This may restrict a subset of the broader video ads pool from serving. 4.1.1

ApplicationVolumeOptions

Prop Type Description Since
volume 0 | 1 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 If your app has its own volume controls (such as custom music or sound effect volumes), disclosing app volume to the Google Mobile Ads SDK allows video ads to respect app volume settings. Use a supported value from 0.0 (silent) to 1.0 (full volume). 4.1.1

AdLoadInfo

Information returned after an ad loads successfully.

Prop Type Description
adUnitId string The ad unit ID of the loaded ad.

AppOpenAdOptions

Options for loading an App Open ad.

Prop Type Description
adId string The App Open ad unit ID to load.

AdShowOptions

Options for selecting a previously loaded ad to show or inspect.

Prop Type Description Since
adId string The ad unit ID of a previously prepared ad to target. If omitted, the operation targets the most recently prepared ad. 8.0.1

PluginListenerHandle

Prop Type
remove () => Promise<void>

AdMobError

An error returned by the Google Mobile Ads SDK.

Prop Type Description
code number Gets the error's code.
message string Gets the message describing the error.

AdMobRevenueData

Impression-level ad revenue data emitted by a paid event.

Prop Type Description
adUnitId string The ad unit ID associated with the paid event.
valueMicros number The ad value in micros, where 1,000,000 micros equals one currency unit.
currencyCode string The ISO 4217 currency code for valueMicros.
precision AdValuePrecision The precision of the reported ad value.
networkName string The mediation adapter class name that served the impression, or an empty string when unavailable.
impressionId string The response identifier associated with the impression, or an empty string when unavailable.

BannerAdOptions

Options for displaying a banner ad.

This interface extends AdOptions.

Prop Type Description Default Since
adSize BannerAdSize The banner size to display. ADAPTIVE_BANNER 3.0.0
position BannerAdPosition The position where the banner is displayed. TOP_CENTER 1.1.2
adId string The ad unit ID to load. 1.1.2
isTesting boolean Whether to request a test ad. false 1.1.2
margin number The banner margin in logical display units (dp on Android and points on iOS). For BOTTOM_CENTER, this is the bottom margin. For TOP_CENTER, this is the top margin. 0 1.1.2
npa boolean Whether to request non-personalized ads. false 1.2.0
immersiveMode boolean Whether to display a full-screen ad in immersive mode on Android. 7.0.3

AdMobBannerSize

The displayed banner dimensions in logical display units (dp on Android and points on iOS). A hidden, removed, or failed banner can report both dimensions as 0.

Prop Type Description
width number The displayed banner width.
height number The displayed banner height.

AdmobConsentInfo

Prop Type Description Since
status AdmobConsentStatus The consent status of the user. 5.0.0
isConsentFormAvailable boolean If true a consent form is available and vice versa. 5.0.0
canRequestAds boolean If true an ad can be shown. 7.0.3
privacyOptionsRequirementStatus PrivacyOptionsRequirementStatus Privacy options requirement status of the user. 7.0.3

AdmobConsentRequestOptions

Prop Type Description Default Since
debugGeography AdmobConsentDebugGeography Sets the debug geography to test the consent locally. 5.0.0
testDeviceIdentifiers string[] An array of test device IDs to allow. Note: On iOS, the ID may renew if you uninstall and reinstall the app. 5.0.0
tagForUnderAgeOfConsent boolean Set to true to provide the option for the user to accept being shown personalized ads. false 5.0.0

AdOptions

Common options for requesting an ad.

Prop Type Description Default Since
adId string The ad unit ID to load. 1.1.2
isTesting boolean Whether to request a test ad. false 1.1.2
margin number The banner margin in logical display units (dp on Android and points on iOS). For BOTTOM_CENTER, this is the bottom margin. For TOP_CENTER, this is the top margin. 0 1.1.2
npa boolean Whether to request non-personalized ads. false 1.2.0
immersiveMode boolean Whether to display a full-screen ad in immersive mode on Android. 7.0.3

RewardAdOptions

Options for loading a rewarded ad.

Prop Type Description Default Since
ssv AtLeastOne<{ /** * A user identifier passed to the SSV callback. / userId: string; /* * Custom data passed to the SSV callback. */ customData: string; }> Server-side verification options for the rewarded ad. Provide at least one of userId or customData.
adId string The ad unit ID to load. 1.1.2
isTesting boolean Whether to request a test ad. false 1.1.2
margin number The banner margin in logical display units (dp on Android and points on iOS). For BOTTOM_CENTER, this is the bottom margin. For TOP_CENTER, this is the top margin. 0 1.1.2
npa boolean Whether to request non-personalized ads. false 1.2.0
immersiveMode boolean Whether to display a full-screen ad in immersive mode on Android. 7.0.3

AdMobRewardItem

The reward earned by the user after viewing a rewarded ad.

Prop Type Description
type string The reward item type configured for the ad unit.
amount number The reward amount earned by the user.

RewardInterstitialAdOptions

Options for loading a rewarded interstitial ad.

Prop Type Description Default Since
ssv AtLeastOne<{ /** * A user identifier passed to the SSV callback. / userId: string; /* * Custom data passed to the SSV callback. */ customData: string; }> Server-side verification options for the rewarded interstitial ad. Provide at least one of userId or customData.
adId string The ad unit ID to load. 1.1.2
isTesting boolean Whether to request a test ad. false 1.1.2
margin number The banner margin in logical display units (dp on Android and points on iOS). For BOTTOM_CENTER, this is the bottom margin. For TOP_CENTER, this is the top margin. 0 1.1.2
npa boolean Whether to request non-personalized ads. false 1.2.0
immersiveMode boolean Whether to display a full-screen ad in immersive mode on Android. 7.0.3

AdMobRewardInterstitialItem

The reward earned by the user after viewing a rewarded interstitial ad.

Prop Type Description
type string The reward item type configured for the ad unit.
amount number The reward amount earned by the user.

Type Aliases

AtLeastOne

{[K in keyof T]: Pick<T, K>}[keyof T]

Pick

From T, pick a set of properties whose keys are in the union K

{ [P in K]: T[P]; }

Enums

MaxAdContentRating

Members Value Description
General 'General' Content suitable for general audiences, including families.
ParentalGuidance 'ParentalGuidance' Content suitable for most audiences with parental guidance.
Teen 'Teen' Content suitable for teen and older audiences.
MatureAudience 'MatureAudience' Content suitable only for mature audiences.

AppOpenAdPluginEvents

Members Value Description
Loaded 'appOpenAdLoaded' Emits when an App Open ad has loaded.
FailedToLoad 'appOpenAdFailedToLoad' Emits when an App Open ad fails to load.
Opened 'appOpenAdOpened' Emits when an App Open ad is shown.
Closed 'appOpenAdClosed' Emits when an App Open ad is dismissed.
FailedToShow 'appOpenAdFailedToShow' Emits when a loaded App Open ad fails to show.
AdImpression 'appOpenAdImpression' Emits impression-level ad revenue data when a paid event is recorded.

AdValuePrecision

Members Value Description
Unknown 0 The ad value precision is unknown.
Estimated 1 The ad value is estimated from aggregated data.
PublisherProvided 2 The ad value was provided by the publisher.
Precise 3 The ad value is the precise value paid for this ad.

BannerAdSize

Members Value Description
BANNER 'BANNER' Mobile Marketing Association (MMA) banner ad size (320x50 density-independent pixels).
FULL_BANNER 'FULL_BANNER' Interactive Advertising Bureau (IAB) full banner ad size (468x60 density-independent pixels).
LARGE_BANNER 'LARGE_BANNER' Large banner ad size (320x100 density-independent pixels).
MEDIUM_RECTANGLE 'MEDIUM_RECTANGLE' Interactive Advertising Bureau (IAB) medium rectangle ad size (300x250 density-independent pixels).
LEADERBOARD 'LEADERBOARD' Interactive Advertising Bureau (IAB) leaderboard ad size (728x90 density-independent pixels).
ADAPTIVE_BANNER 'ADAPTIVE_BANNER' A dynamically sized banner that is full-width and auto-height.
SMART_BANNER 'SMART_BANNER' A legacy smart banner sized to the screen width. Retained for compatibility; use ADAPTIVE_BANNER for new integrations.

BannerAdPosition

Members Value Description
TOP_CENTER 'TOP_CENTER' Positions the banner at the top center of the screen.
CENTER 'CENTER' Positions the banner at the center of the screen.
BOTTOM_CENTER 'BOTTOM_CENTER' Positions the banner at the bottom center of the screen.

BannerAdPluginEvents

Members Value Description
SizeChanged "bannerAdSizeChanged" Emits when the displayed banner size changes.
Loaded "bannerAdLoaded" Emits when a banner ad has loaded.
FailedToLoad "bannerAdFailedToLoad" Emits when a banner ad fails to load.
Opened "bannerAdOpened" Emits when a banner opens an overlay after the user taps it.
Closed "bannerAdClosed" Emits when the banner overlay is closed.
AdImpression "bannerAdImpression" Emits when an impression is recorded for the banner ad.
AdPaid "bannerAdPaid" Emits impression-level ad revenue data when a paid event is recorded.

AdmobConsentStatus

Members Value Description
NOT_REQUIRED 'NOT_REQUIRED' User consent not required.
OBTAINED 'OBTAINED' User consent already obtained.
REQUIRED 'REQUIRED' User consent required but not yet obtained.
UNKNOWN 'UNKNOWN' Unknown consent status, AdsConsent.requestInfoUpdate needs to be called to update it.

PrivacyOptionsRequirementStatus

Members Value Description
NOT_REQUIRED 'NOT_REQUIRED' Privacy options entry point is not required.
REQUIRED 'REQUIRED' Privacy options entry point is required.
UNKNOWN 'UNKNOWN' Privacy options requirement status is unknown.

AdmobConsentDebugGeography

Members Value Description
DISABLED 0 Debug geography disabled.
EEA 1 Geography appears as in EEA for debug devices.
NOT_EEA 2 Geography appears as not in EEA for debug devices.
US 3 Geography appears as in regulated US state for debug devices.
OTHER 4 Geography appears as OTHER state for debug devices.

InterstitialAdPluginEvents

Members Value Description
Loaded 'interstitialAdLoaded' Emits when an interstitial ad has loaded and is ready to show.
FailedToLoad 'interstitialAdFailedToLoad' Emits when an interstitial ad fails to load.
Showed 'interstitialAdShowed' Emits when an interstitial ad is shown.
FailedToShow 'interstitialAdFailedToShow' Emits when a loaded interstitial ad fails to show.
Dismissed 'interstitialAdDismissed' Emits when an interstitial ad is dismissed.
AdImpression 'interstitialAdImpression' Emits impression-level ad revenue data when a paid event is recorded.

RewardAdPluginEvents

Members Value Description
Loaded 'onRewardedVideoAdLoaded' Emits when a rewarded ad has loaded and is ready to show.
FailedToLoad 'onRewardedVideoAdFailedToLoad' Emits when a rewarded ad fails to load.
Showed 'onRewardedVideoAdShowed' Emits when a rewarded ad is shown.
FailedToShow 'onRewardedVideoAdFailedToShow' Emits when a loaded rewarded ad fails to show.
Dismissed 'onRewardedVideoAdDismissed' Emits when a rewarded ad is dismissed. This event does not indicate whether the user earned a reward. Listen for Rewarded separately before granting the reward.
Rewarded 'onRewardedVideoAdReward' Emits when the user earns the advertised reward.
AdImpression 'onRewardedVideoAdImpression' Emits impression-level ad revenue data when a paid event is recorded.

RewardInterstitialAdPluginEvents

Members Value Description
Loaded 'onRewardedInterstitialAdLoaded' Emits when a rewarded interstitial ad has loaded and is ready to show.
FailedToLoad 'onRewardedInterstitialAdFailedToLoad' Emits when a rewarded interstitial ad fails to load.
Showed 'onRewardedInterstitialAdShowed' Emits when a rewarded interstitial ad is shown.
FailedToShow 'onRewardedInterstitialAdFailedToShow' Emits when a loaded rewarded interstitial ad fails to show.
Dismissed 'onRewardedInterstitialAdDismissed' Emits when a rewarded interstitial ad is dismissed. This event does not indicate whether the user earned a reward. Listen for Rewarded separately before granting the reward.
Rewarded 'onRewardedInterstitialAdReward' Emits when the user earns the advertised reward.
AdImpression 'onRewardedInterstitialAdImpression' Emits impression-level ad revenue data when a paid event is recorded.

Prerelease channels

An open, non-draft pull request can be published to the npm beta dist-tag after its Validation and Package Candidate workflows pass. A repository owner or maintainer must add a comment whose entire body is:

/beta

The request authorizes only the pull request head SHA that existed when the comment was added. The workflow revalidates the owner or maintainer permission and head SHA immediately before publishing. Any new commit requires CI to pass again and a fresh owner or maintainer /beta comment. Fork pull requests are supported. Pull requests that change a release-gating workflow cannot be beta-published until those workflow changes land on main.

Beta versions use <base>-beta.pr<PR number>.sha<12-character SHA>. The candidate is built in a read-only workflow without npm publishing credentials. The privileged release workflow publishes only the validated immutable package artifact with lifecycle scripts disabled. A notification failure cannot invalidate a successful npm publish.

When a pull request is merged into main, it is automatically published to beta only after the required CI and Package Candidate succeed for that exact merge commit. Direct pushes to main do not publish a candidate.

Only npm run release creates a release tag. Stable vX.Y.Z tags publish to npm latest; revision/prerelease tags publish to next. Neither beta nor next publishing changes the npm latest dist-tag.

License

Capacitor AdMob is MIT licensed.

About

Community plugin for using Google AdMob

Resources

Code of conduct

Contributing

Stars

295 stars

Watchers

16 watching

Forks

Releases

Packages

Used by

Contributors

Languages