setOptions

Miquel Martín edited this page Apr 29, 2016 · 4 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 Tappx plugin.

tappx.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):
    • tappx.AD_SIZE.BANNER: 320x50. Standard Banner (Phones and Tablets).
    • tappx.AD_SIZE.IAB_MRECT: 300x250. IAB Medium Rectangle (Phones and Tablets).
    • tappx.AD_SIZE.IAB_BANNER: 468x60. IAB Full-Size Banner (Tablets).
    • tappx.AD_SIZE.IAB_LEADERBOARD: 728x90. IAB Leaderboard (Tablets).
    • tappx.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 (tappx.events.onAdLoaded event is called). Default true.
  • autoShowInterstitial: (Optional) Auto show interstitials ad when available (tappx.events.onAdLoaded event is called). Default true.

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

{
  publisherId:          "ca-app-pub-XXXXXXXXXXXXXXXX/BBBBBBBBBB",
  interstitialAdId:     "ca-app-pub-XXXXXXXXXXXXXXXX/IIIIIIIIII",
  tappxIdiOS:           "/XXXXXXXXX/Pub-XXXX-iOS-IIII",
  tappxIdAndroid:       "/XXXXXXXXX/Pub-XXXX-Android-AAAA",
  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 Tappx plugin with createBannerView(options) and requestInterstitialAd(options) methods:

tappx.createBannerView({
  publisherId:          "ca-app-pub-XXXXXXXXXXXXXXXX/BBBBBBBBBB"
});

tappx.requestInterstitialAd({
  publisherId:          "ca-app-pub-XXXXXXXXXXXXXXXX/BBBBBBBBBB",
  interstitialAdId:     "ca-app-pub-XXXXXXXXXXXXXXXX/IIIIIIIIII",
  autoShowInterstitial: true
});