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
Methods
-
<static> configure(settings)
-
Configure default banner and interstitial adunits.
Parameters:
Name Type Argument Description settingsobject <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 adunitstring <optional>
banner adunit. Taken from cordova settings or configure method if not specified.
sizeCocoon.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 adunitstring <optional>
Interstitial adunit. Taken from cordova settings or configure method if not specified.
Returns:
A new 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 adunitstring <optional>
Interstitial adunit. Taken from cordova settings or configure method if not specified.
Returns:
A new rewarded video.
Example
var interstitial = Cocoon.Ad.createRewardedVideo(); interstitial.load();
-
<static> releaseBanner(banner)
-
Releases the banner given.
Parameters:
Name Type Description bannerCocoon.Ad.Banner The banner ad to release.
Example
Cocoon.Ad.releaseBanner(banner);
-
<static> releaseInterstitial(interstitial)
-
Releases the interstitial given.
Parameters:
Name Type Description interstitialCocoon.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_CENTERstring Specifies that the banner must be shown in the top of the screen and vertically centered.
BOTTOM_CENTERstring Specifies that the banner must be shown in the bottom of the screen and vertically centered.
CUSTOMstring Specifies that the uses sets a custom banner position
-
<static> BannerSize
-
The predefined possible sizes for a banner ad.
Properties:
Name Type Description SMARTstring Smart banner size according to screen size (Phones and Tablets)
BANNERstring Standard banner size (Phones and Tablets)
MEDIUM_RECTstring Medium rectangle size (Phones and Tablets)
LEADERBOARDstring Leaderboard size (Tablets)