@ironsource-plus/cordova-plugin

Support for ironSource ads in Cordova and Phonegap apps

Usage no npm install needed!

<script type="module">
  import ironsourcePlusCordovaPlugin from 'https://cdn.skypack.dev/@ironsource-plus/cordova-plugin';
</script>

README

IronSource Ads Cordova Plugin

Add support for IronSource Ads to your Cordova and Phonegap based mobile apps.

History

This is a fork of cordova-plugin-ironSource. It aims to be kept up to date as well as enable ad mediation. It is planned to be a drop-in replacement and will retain the same api of that plugin.

Currently supports ironSource 7.1.5

How do I install it?

Install using cordova:

cordova plugin add @ironsource-plus/cordova-plugin

How do I use it?

document.addEventListener('deviceready', function() {

    var isAds = new IronSourceAds("app_key", "some_unique_userid");

    // show a rewarded ad
    isAds.showRewardedAd();

    // show a rewarded ad for placement RightHere
    isAds.showRewardedAd("RightHere");

    // show an offerwall
    isAds.showOfferWall();

    // show an interstitial
    isAds.showInterstitial();

    // launch in Android Studio/Xcode mediation integration verification
    isAds.validateIntegration();

    // Check is a rewarded video is available to show
    isAds.isRewardedVideoAvailable(function () {
        alert('Yes');
    }, function () {
        alert('No');
    });

    // Check is an interstitial is available to show
    isAds.isInterstitialAdAvailable(function () {
        alert('Yes');
    }, function () {
        alert('No');
    });

    // give em some credit
    window.addEventListener("onOfferwallAdCredited", 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("onRewardedVideoAdClosed", function(e) {

        var placement = e.placement;
        console.log(placement.placementName);
        console.log(placement.rewardName);
        console.log(placement.rewardAmount);
    }, false);

}, false);

Can I just see a working example?

Yep. Check out the demo project. It runs on both Android and iOS.

What events are supported?

Interstitial

  1. onInterstitialAdClicked
  2. onInterstitialAdClosed
  3. onInterstitialAdLoadFailed
  4. onInterstitialAdOpened
  5. onInterstitialAdReady
  6. onInterstitialAdShowFailed
  7. onInterstitialAdShowSucceeded

Offerwall

  1. onOfferwallAdCredited
  2. onGetOfferwallCreditsFailed
  3. onOfferwallAvailable
  4. onOfferwallClosed
  5. onOfferwallOpened
  6. onOfferwallShowFailed

Rewarded Video

  1. onRewardedVideoAdClosed
  2. onRewardedVideoAdEnded
  3. onRewardedVideoAdOpened
  4. onRewardedVideoAdRewarded
  5. onRewardedVideoAdShowFailed
  6. onRewardedVideoAdStarted
  7. onRewardedVideoAvailabilityChanged
  8. onRewardedVideoAdClicked