Last active
August 23, 2017 21:39
-
-
Save imelgrat/4466c757573582f6898d to your computer and use it in GitHub Desktop.
JavaScript code to configure Cordova's AdMob Plugin Pro. Full articlle at: http://imelgrat.me/phonegap/admob-effective-monetize-cordova-app/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// select the right Ad ID according to platform | |
var admobid = {}; | |
if( /(android)/i.test(navigator.userAgent) ){ // for android | |
admobid = { | |
banner: 'ca-app-pub-xxx/zzz', // or DFP format "/6253334/dfp_example_ad" | |
interstitial: 'ca-app-pub-xxx/kkk' | |
}; | |
} | |
else if(/(ipod|iphone|ipad)/i.test(navigator.userAgent)){ // for ios | |
admobid = { | |
banner: 'ca-app-pub-xxx/zzz', // or DFP format "/6253334/dfp_example_ad" | |
interstitial: 'ca-app-pub-xxx/kkk' | |
}; | |
} | |
else { // for windows phone | |
admobid = { | |
banner: 'ca-app-pub-xxx/zzz', // or DFP format "/6253334/dfp_example_ad" | |
interstitial: 'ca-app-pub-xxx/kkk' | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment