IONIC+Cordova+Native
Support only for interstitial ads
StroeerAdsPlugin javascript API
stroeerAds.init(applicationName: string): Promise<void>
- initializes Yieldlove SDK, should be called as soon as possible
stroeerAds.loadInterstitial(slotName: string): Promise<InterstitialAd>
- loads ad based on slotName and saves it to loaded ads if no errors
- Returns:
- InterstitialAd
show(): Promise<void>
- will try to show ad (same behaviour as showInterstitial)
id(): string
- slotName of loaded ad
- Throws
- could throw general javascript Error
- unexpected error during loading
- failed to load ad because of "NO FILL"
- Events:
- adLoaded {adId: string}
stroeerAds.showInterstitial(slotName: string): Promise<void>
- looks for loaded ads based on slotName and shows it to user
- Throws
- could throw general javascript Error
- Could not find ad for slot [slotName]
- happens when ad is not loaded or was already shown and removed from loaded ads
- Events
- adShowed {adId: string}
- when ad is shown to user
- adImpression {adId: string}
- when ad is shown to user
- adShowFailed {adId: string, reason: string}
- when showing ad was not successfull e.g. because was already shown
- adClicked {adId: string}
- when user clicked the ad
- adDismissed {adId: string}
- when ad was closed
Current API offers two ways how to load and show interstitial ad
Load → save reference → call show()
const ad = stroeerAds.loadInterstitial("interstitial")
... //Lot of stuff happens
await ad.show() //await not necessary if we do not want to catch errors
Load → listen to adLoaded event → call showInterstitial
document.addEventListener("adLoaded", function(event) {
stroeerAds.showInterstitial(event.adId)
})
stroeerAds.loadInterstitial("interstitial")