floatinghotpot / cordova-plugin-mopub

Cordova/PhoneGap plugin for MoPub Ads
17 stars 16 forks source link

use different event name for each ad network #1

Closed feeling99 closed 9 years ago

feeling99 commented 9 years ago

Hi,

It seems all your plugins (admob/mopub/mmedia) use the same event name: document.addEventListener('onBannerReceive', function(){})

this cause conflict if user try to use multiple plugins at the same time. It would be good if you can use different event name for each plugin. for example: for mopub use 'onMopubBannerReceive' for admob use 'onAdmobBannerReceive' for mmedia use 'onMmediaBannerReceive'

cheers,

floatinghotpot commented 9 years ago

Yeah, it's a problem.

I am thinking to use same event name, but with parameters, for example:

'onAdLoaded', {'adNetwork':'AdMob','adType':'banner','adEvent':'onAdLoaded'}

What do you think?

feeling99 commented 9 years ago

yeah that will do, I think.

floatinghotpot commented 9 years ago

it's fixed.

            document.addEventListener('onAdFailLoad', function(data){ 
                alert('error: ' + data.error + 
                        ', reason: ' + data.reason + 
                        ', adNetwork:' + data.adNetwork + 
                        ', adType:' + data.adType + 
                        ', adEvent:' + data.adEvent); // adType: 'banner' or 'interstitial'
            });
            document.addEventListener('onAdLoaded', function(data){});
            document.addEventListener('onAdPresent', function(data){});
            document.addEventListener('onAdLeaveApp', function(data){});
            document.addEventListener('onAdDismiss', function(data){});
feeling99 commented 9 years ago

That's great. I will try that out.