Skip to content
appfeel edited this page Dec 23, 2014 · 26 revisions

Set the options to start displaying ads. Although it is not required to call this method it is highly recommended. See here other ways to configure AdMob plugin.

admob.setOptions(options, success, fail);
  • options: setup options (see options).
  • success: success callback.
  • failure: failure callback.

Options

A JSON object whith the following fields:

  • publisherId: (Required) Your publisher id code from your AdMob account. You can get it from AdMob. Set it to "NONE" (or whatever non blank) if you don't want to request AdMob ads.
  • interstitialAdId: (Optional) Your interstitial id code from your AdMob account. Defaults to publisherId.
  • tappxIdiOS: (Optional) Your tappx id for iOS apps. You can get it from tappx. If Admob is configured, it is also used to backfill your lost inventory (when there are no Admob ads available).
  • tappxIdAndroid: (Optional) Your tappx id for Android apps. You can get it from tappx. If Admob is configured, it is also used to backfill your lost inventory (when there are no Admob ads available).
  • tappxShare: (Optional) If any of tappxId is present, it tells the percentage of traffic diverted to tappx. Defaults to 50% (0.5).
  • bannerAtTop: (Optional) Indicates whether to put banner ads at top when set to true or at bottom when set to false. Default false.
  • adSize: (Optional) Indicates the size of banner ads. Available values are (see Google Docs for more info):
    • admob.AD_SIZE.BANNER: 320x50. Standard Banner (Phones and Tablets).
    • admob.AD_SIZE.IAB_MRECT: 300x250. IAB Medium Rectangle (Phones and Tablets).
    • admob.AD_SIZE.IAB_BANNER: 468x60. IAB Full-Size Banner (Tablets).
    • admob.AD_SIZE.IAB_LEADERBOARD: 728x90. IAB Leaderboard (Tablets).
    • admob.AD_SIZE.SMART_BANNER: (See table) Smart Banner (Phones and Tablets).
  • overlap: (Optional) Allow banner overlap webview. Default false.
  • offsetStatusBar: (Optional) Set to true to avoid ios7 status bar overlap. Default false.
  • isTesting: (Optional) Set to true for receiving test ads (do not test with real ads as your account will be banned). Default false.
  • adExtras: (Options) A JSON object with additional {key: value} pairs (see Google Docs for more info).
  • autoShowBanner: (Optional) Auto show banners ad when available (admob.events.onAdLoaded event is called). Default true.
  • autoShowInterstitial: (Optional) Auto show interstitials ad when available (admob.events.onAdLoaded event is called). Default false.

Example (those are also the default options, except tappxId's, which are empty by default):

{
  publisherId:          "ca-app-pub-8440343014846849/3119840614",
  interstitialAdId:     "ca-app-pub-8440343014846849/4596573817",
  tappxIdiOs:           "/120940746/Pub-2702-iOS-8226",
  tappxIdAndroid:       "/120940746/Pub-2700-Android-8171",
  tappxShare:           0.5,
  adSize:               tappx.AD_SIZE.SMART_BANNER,
  bannerAtTop:          false,
  overlap:              false,
  offsetStatusBar:      false,
  isTesting:            false,
  adExtras :            {},
  autoShowBanner:       true,
  autoShowInterstitial: true
}

Other ways

You can optionally configure AdMob plugin with createBannerView(options) and requestInterstitialAd(options) methods:

admob.createBannerView({
  publisherId:          "ca-app-pub-8440343014846849/3119840614"
});

admob.requestInterstitialAd({
  publisherId:          "ca-app-pub-8440343014846849/3119840614",
  interstitialAdId:     "ca-app-pub-8440343014846849/4596573817",
  autoShowInterstitial: true
});