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 settings
object <optional>
The banner optional settings.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
//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
-
<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.
Example
-
<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.
Example
-
<static> releaseBanner(banner)
-
Releases the banner given.
Parameters:
Name Type Description banner
Cocoon.Ad.Banner The banner ad to release.
Example
1
Cocoon.Ad.releaseBanner(banner);
-
<static> releaseInterstitial(interstitial)
-
Releases the interstitial given.
Parameters:
Name Type Description interstitial
Cocoon.Ad.Interstitial The interstitial to release.
Example
1
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)