cordova-plugin-supersonicads
v0.2.2
Published
Ads support for supersonic ads to Cordova and Phonegap apps
Downloads
3
Maintainers
Readme
Supersonic Ads Cordova Plugin
Add support for Supersonic Ads to your Cordova and Phonegap based mobile apps.
How do I install it?
If you're like me and using CLI:
cordova plugin add cordova-plugin-supersonicads
or
cordova plugin add https://github.com/blakgeek/cordova-plugin-supersonicads
or
phonegap local plugin add https://github.com/blakgeek/cordova-plugin-supersonicads
How do I use it?
document.addEventListener('deviceready', function() {
var ssAds = new SupersonicAds("yo_app_key", "some_unique_userid");
// show a rewarded ad
ssAds.showRewardedAd();
// show a rewarded ad for placement RightHere
ssAds.showRewardedAd("RightHere");
// show an offerwall
ssAds.showOfferWall();
// show an interstitial
ssAds.showInterstitial();
// give em some credit
window.addEventListener("offerwallCreditReceived", function(e) {
var credit = e.credit;
// The number of credits the user has earned.
console.log(credit.amount);
// The total number of credits ever earned by the user.
console.log(credit.total):
// estimated flag is the same as totalCreditsFlag
// In some cases, we won’t be able to provide the exact
// amount of credits since the last event (specifically if the user clears
// the app’s data). In this case the ‘credits’ will be equal to the ‘totalCredits’,
// and this flag will be ‘true’.
console.log(credit.estimated);
}, false);
// reward your users
window.addEventListener("rewardedVideoRewardReceived", function(e) {
var placement = e.placement;
console.log(placement.id); // only available on android
console.log(placement.name);
console.log(placement.reward);
console.log(placement.amount);
}, false);
}, false);
Can I just see a working example?
Yep. Check out the demo project. It runs on both Android and iOS.
What other events are supported?
Interstitial
- interstitialInitialized
- interstitialInitializationFailed
- interstitialAvailabilityChanged
- interstitialShown
- interstitialShowFailed
- interstitialClicked
- interstitialClosed
Offerwall
- offerwallClosed
- offerwallCreditFailed
- offerwallCreditReceived
- offerwallShowFailed
- offerwallOpened
- offerwallInitializationFailed
- offerwallInitialized
Rewarded Video
- rewardedVideoRewardReceived
- rewardedVideoEnded
- rewardedVideoStarted
- rewardedVideoAvailabilityChanged
- rewardedVideoClosed
- rewardedVideoOpened
- rewardedVideoInitializationFailed
- rewardedVideoInitialized
- rewardedVideoFailed