Namespace: Ad

Cocoon. Ad

Cocoon.Ad class provides an easy to use Ads API that can be used with different Ad providers with built-in support for multiple banners and interstitials.

Namespaces

Banner
Interstitial

Methods

<static> configure(settings)

Configure default banner and interstitial adunits.

Parameters:
Name Type Argument Description
settings object <optional>

The banner optional settings.

Example
//Global configuration
Cocoon.Ads.configure({
    banner:"agltb3B1Yi1pbmNyDQsSBFNpdGUxxxxxxx",
    interstitial:"agltb3B1Yi1pbmNyDQsSBFNpdGUyyyyyyy"
})
//Or platform specific configuration
Cocoon.Ads.configure({
    ios: {
         banner:"agltb3B1Yi1pbmNyDQsSBFNpdGUxxxxxxx",
         bannerIpad:"agltb3B1Yi1pbmNyDQsSBFNpdGUzzzzz", //optional
         interstitial:"agltb3B1Yi1pbmNyDQsSBFNpdGUyyyyyyy",
         interstitialIpad:"agltb3B1Yi1pbmNyDQsSBFNpdGUtttttt", //optional
    },
    android: {
         banner:"agltb3B1Yi1pbmNyDQsSBFNpdGUwwwwww",
         interstitial:"agltb3B1Yi1pbmNyDQsSBFNpdGUhhhhhh"
    }
);*

<static> createBanner(adunit, size) → {Cocoon.Ad.Banner}

Creates a banner.

Parameters:
Name Type Argument Description
adunit string <optional>

banner adunit. Taken from cordova settings or configure method if not specified.

size Cocoon.Ad.BannerSize <optional>

The banner size. Default value: Smart Size

Returns:

banner A new banner ad.

Type
Cocoon.Ad.Banner
Example
var banner = Cocoon.Ad.createBanner();
banner.load(); 

<static> createInterstitial(adunit) → {Cocoon.Ad.Interstitial}

Creates an interstitial.

Parameters:
Name Type Argument Description
adunit string <optional>

Interstitial adunit. Taken from cordova settings or configure method if not specified.

Returns:

A new interstitial.

Type
Cocoon.Ad.Interstitial
Example
var interstitial = Cocoon.Ad.createInterstitial();
interstitial.load();

<static> createRewardedVideo(adunit) → {Cocoon.Ad.Interstitial}

Creates an rewarded video interstitial (only supported in some networks)

Parameters:
Name Type Argument Description
adunit string <optional>

Interstitial adunit. Taken from cordova settings or configure method if not specified.

Returns:

A new rewarded video.

Type
Cocoon.Ad.Interstitial
Example
var interstitial = Cocoon.Ad.createRewardedVideo();
interstitial.load();

<static> releaseBanner(banner)

Releases the banner given.

Parameters:
Name Type Description
banner Cocoon.Ad.Banner

The banner ad to release.

Example
Cocoon.Ad.releaseBanner(banner);

<static> releaseInterstitial(interstitial)

Releases the interstitial given.

Parameters:
Name Type Description
interstitial Cocoon.Ad.Interstitial

The interstitial to release.

Example
Cocoon.Ad.releaseInterstitial(interstitial);

Members

<static> BannerLayout

The predefined possible layouts for a banner ad.

Properties:
Name Type Description
TOP_CENTER string

Specifies that the banner must be shown in the top of the screen and vertically centered.

BOTTOM_CENTER string

Specifies that the banner must be shown in the bottom of the screen and vertically centered.

CUSTOM string

Specifies that the uses sets a custom banner position

<static> BannerSize

The predefined possible sizes for a banner ad.

Properties:
Name Type Description
SMART string

Smart banner size according to screen size (Phones and Tablets)

BANNER string

Standard banner size (Phones and Tablets)

MEDIUM_RECT string

Medium rectangle size (Phones and Tablets)

LEADERBOARD string

Leaderboard size (Tablets)

Atomic Plugins for Cordova - JavaScript Documentation by Ludei, DocStrap Copyright © 2012-2013
The contributors to the JSDoc3 and DocStrap projects.