(function() {
ready("#showAdDiaria", function(element) {
var el = document.getElementById("showAdDiaria");
var adunit;
var userAgent = navigator.userAgent;
if (/(android)/i.test(userAgent)) {
// put android ad unit ID here
adunit = 'ca-app-pub-xxx/xxxx'
}
if (/(iPad|iPhone|iPod)/.test(userAgent) ) {
// put iOS ad unit id here
adunit = 'ca-app-pub-xx/xx'
}
if (AdMob) {
AdMob.prepareInterstitial({
adId: adunit,
isTesting: false,
autoShow: false
});
}
el.addEventListener("click", function() {
console.log('clicked show ad', AdMob);
// show the interstitial later, e.g. at end of game level
if (AdMob) AdMob.showInterstitial();
});
});
})();
当我输入脚本时,我收到未定义 Admob 变量的错误