npm i cordova-plugin-mytarget-ads --save
All methods support optional onSuccess
and onFailure
parameters
import * as MyTargetAds from 'cordova-plugin-mytarget-ads/www/mytargetads';
await MyTargetAds.init({
rewardedBlockId: 'YOUR_REWARDER_BLOCK_ID',
interstitialBlockId: 'YOUR_INTERSTITIAL_ID',
});
MyTargetAds.setUserConsent(true);
MyTargetAds.loadRewardedVideo({
onSuccess: function () {
},
onFailure: function () {
},
});
MyTargetAds.showRewardedVideo();
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(){
});
_Must be called before showInterstitial
MyTargetAds.loadInterstitial();
MyTargetAds.showInterstitial();
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(){
});