Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/admob-plus/admob-plus/llms.txt

Use this file to discover all available pages before exploring further.

The AdMob class is the main entry point for the AdMob Plus plugin. It provides methods to initialize the SDK, configure global settings, and access all ad format classes.

Properties

Ad Format Classes

The AdMob class exposes all ad format classes as readonly properties:
AppOpenAd
class
App Open Ad format class. See AppOpenAd for details.
BannerAd
class
Banner Ad format class. See BannerAd for details.
InterstitialAd
class
Interstitial Ad format class. See InterstitialAd for details.
NativeAd
class
Native Ad format class. See NativeAd for details.
RewardedAd
class
Rewarded Ad format class. See RewardedAd for details.
RewardedInterstitialAd
class
Rewarded Interstitial Ad format class. See RewardedInterstitialAd for details.
WebViewAd
class
WebView Ad format class. See WebViewAd for details.

Events

Events
enum
Enum containing all AdMob event types. See Events for details.

Methods

start()

Initializes the AdMob SDK. This method must be called before creating or loading any ads. The method is idempotent - calling it multiple times will return the same promise.
start(): Promise<{ version: string }>
version
string
The version of the AdMob SDK that was initialized.

Example

try {
  const result = await admob.start();
  console.log('AdMob SDK started, version:', result.version);
} catch (error) {
  console.error('Failed to start AdMob SDK:', error);
}

configure()

Configures global AdMob settings. This method can be called at any time to update SDK configuration.
configure(config: AdMobConfig): Promise<void>

Parameters

config
AdMobConfig
required
Configuration object for AdMob SDK settings.
config.maxAdContentRating
'G' | 'PG' | 'T' | 'MA' | ''
Maximum ad content rating for ad requests:
  • 'G' - Content suitable for general audiences, including families
  • 'PG' - Content suitable for most audiences with parental guidance
  • 'T' - Content suitable for teen and older audiences
  • 'MA' - Content suitable only for mature audiences
  • '' - Content suitability is unspecified
config.tagForChildDirectedTreatment
boolean | null
Tag requests for child-directed treatment:
  • true - Tag for child-directed treatment
  • false - Tag for non-child-directed treatment
  • null - Do not tag
Tag requests for users under the age of consent:
  • true - Tag for under age of consent
  • false - Tag for not under age of consent
  • null - Do not tag
config.testDeviceIds
string[]
Array of test device IDs to receive test ads. Use this during development to avoid policy violations.
config.appMuted
boolean
Whether the app’s audio is muted. Affects ad audio playback.
config.appVolume
number
App volume level (0.0 to 1.0). Affects ad audio playback volume.
config.publisherFirstPartyIDEnabled
boolean
Enable publisher first-party ID for improved ad targeting and measurement.
config.sameAppKey
boolean
deprecated
Deprecated. Use publisherFirstPartyIDEnabled instead.

Example

// Configure AdMob with child-directed treatment and test devices
await admob.configure({
  maxAdContentRating: 'PG',
  tagForChildDirectedTreatment: true,
  testDeviceIds: ['DEVICE_ID_1', 'DEVICE_ID_2'],
  appVolume: 0.8,
  publisherFirstPartyIDEnabled: true
});

Global Instance

A global admob instance is available throughout your application:
declare global {
  const admob: AdMob;
}

Type Definitions

interface AdMobConfig extends RequestConfig {
  appMuted?: boolean;
  appVolume?: number;
  sameAppKey?: boolean; // deprecated
  publisherFirstPartyIDEnabled?: boolean;
}

interface RequestConfig {
  maxAdContentRating?: 'G' | 'PG' | 'T' | 'MA' | '';
  tagForChildDirectedTreatment?: boolean | null;
  tagForUnderAgeOfConsent?: boolean | null;
  testDeviceIds?: string[];
}

Usage Example

import AdMob from 'admob-plus-cordova';

// Or use the global instance
// const admob = window.admob;

// Initialize the SDK
await admob.start();

// Configure global settings
await admob.configure({
  maxAdContentRating: 'PG',
  tagForChildDirectedTreatment: false,
  testDeviceIds: ['TEST_DEVICE_ID']
});

// Create and show a banner ad
const banner = new admob.BannerAd({
  adUnitId: 'ca-app-pub-xxx/yyy'
});

await banner.show();