1.3.2 • Published 1 year ago

cordova-plugin-startio-ads v1.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Start.io (StartApp Ads) Cordova Plugin

An UNOFFICIAL free to use Start.io Cordova plugin that allows you to display ads on your cordova/ionic app.


Platforms support:

OSIntegratedSDK versionSupported ad types
AndroidYES :white_check_mark:4.10.2Banner, Rewarded Video, Interstitial
iOSNO* :x:N/AN/A
  • Only Android is supported for the moment, I will do my best to add iOS soon.

Prerequisites

  • cordova 7 or higher
  • cordova-android 6 or higher

Installation

To add Start.io plugin use:

cordova plugin add https://github.com/itsSoufianeDev/cordova-plugin-startio-ads

To remove the plugin use:

cordova plugin remove cordova-plugin-startio-ads

Plugin Methods

  • init(appid: string, options: object, testAds: boolean): void

  • setConsent(consent: boolean): void

  • setIABUSPrivacy(IABString: string): void

  • loadBanner(): void

  • showBanner(): void

  • hideBanner(): void

  • showInterstitial(): void

  • loadRewardVideo(autoShow: boolean): void

  • showRewardVideo(): void

Usage

The plugin exports a JS variable named StartIO, Angular won't let you access this variable that's why you will need to declare it on each page you are willing to use the plugin on.

import { Component, OnInit } from '@angular/core'
/// any other imports

declare var StartIO: any

1. Initialisation

const options = { returnAd: true, splashAd: false } // use your own preferences
const appID = 123456789 // your own app id
const testAds = true // enable test ads, must be set to false on production app

StartIO.init(appID, options, testAds)

2. GDPR Consent / CCPA Compliance

The plugin allows you to pass user consent to the SDK, refer to StartIO docs for more details on GDPR and CCPA Compliane

StartIO.setConsent(true) // GDPR
StartIO.setIABUSPrivacy("1YNN") // CCPA

3. Banner Ads

To show a Banner ad you need to call loadBanner() and listen to the startio.banner.load event then call showBanner(). IMPORTANT: Do not call loadBanner() from within startio.banner.load_fail. The SDK will automatically try to reload an ad upon a failure.

document.addEventListener('startio.banner.load', () => {
  // Banner loaded succesfully, call showBanner()

  StartIO.showBanner()
});

To hide the banner

StartIO.hideBanner()

Events triggered

Event namedescription
startio.banner.loadtriggered when the banner is loaded and ready to be shown
startio.banner.load_failtriggered when the SDK fails to load a Banner
startio.banner.clickedtriggered when a Banner is clicked
startio.banner.impressiontriggered on Banner impression
startio.banner.hidetriggered when the Banner is hidden

4. Interstitial Ads

StartIO.showInterstitial()

Events triggered

Event namedescription
startio.interstitial.load_failtriggered when the SDK fails to load an Interstitial
startio.interstitial.displayedtriggered when the Interstitial is displayed
startio.interstitial.not_displayedtriggered when the Interstitial fails to be displayed
startio.interstitial.clickedtriggered when an Interstitial is clicked
startio.interstitial.closedtriggered when Interstitial is closed

5. Rewarded Videos Ads

/// Listen for rewarded video load
document.addEventListener('startio.reward_video.load', () => {
  // Rewarded video loaded succesfully, you can now call showRewardVideo()
  StartIO.showRewardVideo()
});

/// Listen for rewarded video reward
document.addEventListener('startio.reward_video.reward', () => {
  // The user watched the video, GIVE HIM A REWARD!
  // load a new video if needed
  StartIO.loadRewardVideo(autoshow)
});

/// Load the rewarded video
const autoshow = false // autoshow rewarded video when loaded
StartIO.loadRewardVideo(autoshow)

Events triggered

Event namedescription
startio.reward_video.rewardtriggered when the user watches the video and deserves a reward
startio.reward_video.loadtriggered when the rewarded video is loaded
startio.reward_video.load_failtriggered when the rewarded video loading has failed
startio.reward_video.clickedtriggered when the rewarded video is clicked
startio.reward_video.closedtriggered when the rewarded video is closed (doesn't mean the user fully watched the video)
startio.reward_video.displayedtriggered when the rewarded video is displayed
startio.reward_video.not_displayedtriggered when the rewarded video fails to be displayed

Credits

This project was cloned from @lreiner github, but since it was not updated and maintained I decided to do so, You can visit the original repository and send donations to @lreiner.

Donations

I hope this plugin has saved you a lot of time, keeping the SDKs updated and adding more functionalities takes time and effort, you can help me keep this project by donating bellow.

Support via PayPal