cordova-plugin-mytarget-ads
v1.0.0
Published
MyTarget ads for cordova based development
Downloads
2
Maintainers
Readme
MyTarget Ads for Cordova apps
Table of Contents
State of Development
- [x]
- [x]
- [ ]
Install
npm i cordova-plugin-mytarget-ads --save
Usage
All methods support optional onSuccess
and onFailure
parameters
Initialization
import * as MyTargetAds from 'cordova-plugin-mytarget-ads/www/mytargetads';
await MyTargetAds.init({
rewardedBlockId: 'YOUR_REWARDER_BLOCK_ID',
interstitialBlockId: 'YOUR_INTERSTITIAL_ID',
});
Set user consent for GDPR
Call this on every app launch. More info: https://yandex.ru/dev/mobile-ads/doc/android/quick-start/gdpr-about.html
MyTargetAds.setUserConsent(true);
Rewarded Videos
Load Rewarded Video
MyTargetAds.loadRewardedVideo({
onSuccess: function () {
},
onFailure: function () {
},
});
Show Rewarded Video
MyTargetAds.showRewardedVideo();
Rewarded Video Events
Rewarded Video Loaded
window.addEventListener("rewardedVideoLoaded", function () {
MyTargetAds.showRewardedVideo();
});
Rewarded Video Rewarded
window.addEventListener("rewardedVideoRewardReceived", function(){
// some logics
});
Rewarded Video Started
window.addEventListener("rewardedVideoStarted", function(){
});
Rewarded Video Closed
window.addEventListener("rewardedVideoClosed", function(){
});
Rewarded Video Failed
window.addEventListener("rewardedVideoFailed", function(){
});
Interstitial
Load Interstitial
_Must be called before showInterstitial
MyTargetAds.loadInterstitial();
Show Interstitial
MyTargetAds.showInterstitial();
Interstitial Events
Interstitial Loaded
window.addEventListener("interstitialLoaded", function () {
MyTargetAds.showInterstitial();
});
Interstitial Shown
window.addEventListener("interstitialShown", function(){
});
Interstitial Closed
window.addEventListener("interstitialClosed", function(){
});
Interstitial Failed To Load
window.addEventListener("interstitialFailedToLoad", function(){
});