Skip to content

maximnara/cordova-plugin-mytarget-ads

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyTarget Ads for Ionic and Cordova apps

Interstitial and Rewarded ads are available now!


Table of Contents

State of Development


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

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(){

});

Feel free to make your PRs for code structure or new functions

About

MyTarget Ads for Ionic and Cordova apps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published