Forum Moderators: martinibuster
<div id="adcode"><div id="div-gpt-ad-000000-0" style="width:160px;height:600px;" data-dfp="Skyscraper" data-cids="0000000+000000"></div></div> @media only screen and (max-device-width: 640px) {
#adcode > div {
width: 468px !important;
height: 60px !important;
}
}
//find ad slots
var dfpslots=$("body").find("div[data-dfp]");
//if we find any
if ($(dfpslots).length) {
//start of GPT
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function() {
//for each slot, set adsense channel and define slot
//NOTE don't forget to change 0000000 to your specific id
$(dfpslots).each(function(){
if ($(this).attr('data-cids')) googletag.pubads().set("adsense_channel_ids", $(this).attr('data-cids'));
googletag.defineSlot('/0000000/'+$(this).attr('data-dfp'), [$(this).width(), $(this).height()], $(this).attr('id')).addService(googletag.pubads());
});
//standart GPT
googletag.pubads().enableSingleRequest();
googletag.enableServices();
//display Ads for each slot
$(dfpslots).each(function(){
googletag.display($(this).attr('id'));
});
});
//call GPT JS
$.ajaxSetup({cache:true}); //enable cache
$.getScript("http://www.googletagservices.com/tag/js/gpt.js");
}
var dfpslots=$(".adslot:visible"); var dfpslots=$("#wrapper").find("div[data-dfp]:visible"); I'm not making the ad calls until the document is ready