1.5 Events

Raymond Xie edited this page Jun 15, 2015 · 4 revisions

Events

  • onAdFailLoad
  • onAdLoaded
  • onAdPresent
  • onAdLeaveApp
  • onAdDismiss

All following events will come with a data param, with properties:

  • data.adNetwork, the Ad network name, like 'AdMob', 'Flurry', 'iAd', etc.
  • data.adType, 'banner' or 'interstitial'
  • data.adEvent, the event name

Tips: You can use 2 or more Ad PluginPro together, and distinguish the events by checking data.adNetwork.

'onAdFailLoad'

Triggered when failed to receive Ad.

document.addEventListener('onAdFailLoad',function(data){
    console.log( data.error + ',' + data.reason );
    if(data.adType == 'banner') AdMob.hideBanner();
    else if(data.adType == 'interstitial') interstitialIsReady = false;
});

'onAdLoaded'

Triggered when Ad received.

document.addEventListener('onAdLoaded',function(data){
    if(data.adType == 'banner') AdMob.showBanner();
    else if(data.adType == 'interstitial') interstitialIsReady = true;
});
AdMob.prepareInterstitial({
    adId: admobid.interstitial,
    autoShow: false
});

'onAdPresent'

Triggered when Ad will be showed on screen.

'onAdLeaveApp'

Triggered when user click the Ad, and will jump out of your App.

'onAdDismiss'

Triggered when dismiss the Ad and back to your App.