Skip to main content
@capgo/capacitor-admob Commerce Open source

AdMob Capacitor plugin

Monetize your app with Google AdMob banner, interstitial, and rewarded ads

Install

bun add @capgo/capacitor-admob bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-admob
  • pnpm add @capgo/capacitor-admob
  • yarn add @capgo/capacitor-admob

Guide

How to use AdMob in Capacitor

Using @capgo/capacitor-admob

AdMob Plus Plugin interface for displaying Google AdMob ads in Capacitor apps.

Install

bun add @capgo/capacitor-admob
bunx cap sync

bunx cap sync copies the plugin's native code into your native projects. Run it again after every plugin upgrade.

Import

import { AdMob } from '@capgo/capacitor-admob';

API at a glance

Method Description
start Initialize and start the AdMob SDK.
configure Configure AdMob settings.
configRequest Configure ad request settings.
adCreate Create a new ad instance.
adIsLoaded Check if an ad is loaded and ready to be shown.
adLoad Load an ad.
adShow Show a loaded ad.
adHide Hide a currently displayed ad.
trackingAuthorizationStatus Get the current tracking authorization status (iOS only).
requestTrackingAuthorization Request tracking authorization from the user (iOS only).

Examples

start()

Initialize and start the AdMob SDK.

import { AdMob } from '@capgo/capacitor-admob';

await AdMob.start();

configure()

Configure AdMob settings.

import { AdMob } from '@capgo/capacitor-admob';

await AdMob.configure({
  appMuted: false,
  appVolume: 0.5
});

configRequest()

Configure ad request settings.

import { AdMob, MaxAdContentRating } from '@capgo/capacitor-admob';

await AdMob.configRequest({
  maxAdContentRating: MaxAdContentRating.PG,
  tagForChildDirectedTreatment: true,
  testDeviceIds: ['test-device-id']
});

adCreate()

Create a new ad instance.

import { AdMob } from '@capgo/capacitor-admob';

await AdMob.adCreate({
  adUnitId: 'ca-app-pub-3940256099942544/1033173712'
});

adIsLoaded()

Check if an ad is loaded and ready to be shown.

import { AdMob } from '@capgo/capacitor-admob';

const isLoaded = await AdMob.adIsLoaded({ id: 1 });
if (isLoaded) {
  await AdMob.adShow({ id: 1 });
}

adLoad()

Load an ad.

import { AdMob } from '@capgo/capacitor-admob';

await AdMob.adLoad({ id: 1 });

The table above lists the 10 core methods. Listener and version helpers, and the full contract of each method, are documented in the GitHub repository.

Listen to events

addListener returns a handle. Call handle.remove() when the screen unmounts.

Full reference

Keep going from Using @capgo/capacitor-admob

If you are using Using @capgo/capacitor-admob to plan native plugin work, connect it with @capgo/capacitor-admob for the implementation detail in @capgo/capacitor-admob, Getting Started for the implementation detail in Getting Started, Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, and Adding or Updating Plugins for the implementation detail in Adding or Updating Plugins.

FAQ

AdMob plugin FAQ

How do I install the AdMob plugin in a Capacitor app?

Run "bun add @capgo/capacitor-admob" (or "npm install @capgo/capacitor-admob"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-admob" in your app code.

Does @capgo/capacitor-admob work with React, Vue and Angular?

Yes. AdMob is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-admob support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-admob free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-admob/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses AdMob without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship AdMob changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo