Im migrating from Adnuntius too GPT and are using prebid.js I need diffrent slots on each page and when im trying to define them, i only get them to work if i have diffrent sizes on each slot.Lets say that i use 970x250 on the first one and change the second one to 300x250 it will work.
I Think my issue is somewhere where i define the slots, or maybe with our adunit?
I want to be able to use the same size for all slots. site_level is our adunit name from gpt
var div_sizes_l = [[970, 250], [980, 200], [980, 240]];
var PREBID_TIMEOUT = 1000;
var FAILSAFE_TIMEOUT = 3000;
var adUnits = [
{
code: 'div-gpt-ad-Landing_Top',
mediaTypes: {
banner: {
sizes: div_sizes_l,
}
},
bids: [
{
bidder: 'rubicon',
params: {
accountId: '20562',
siteId: '2153438',
zoneId: '11258332'
}
}
]
},
//
{
code: 'div-gpt-ad-Landing_Middle',
mediaTypes: {
banner: {
sizes: div_sizes_l,
}
},
bids: [
{
bidder: 'rubicon',
params: {
accountId: '20562',
siteId: '2153438',
zoneId: '11258344'
}
},
]
},
];
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function() {
googletag.pubads().disableInitialLoad();
});
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
pbjs.que.push(function() {
pbjs.addAdUnits(adUnits);
pbjs.requestBids({
bidsBackHandler: initAdserver,
timeout: PREBID_TIMEOUT
});
});
function initAdserver() {
if (pbjs.initAdserverSet) return;
pbjs.initAdserverSet = true;
googletag.cmd.push(function() {
pbjs.que.push(function() {
pbjs.setTargetingForGPTAsync();
googletag.pubads().refresh();
});
});
}
// in case PBJS doesn't load
setTimeout(function() {
initAdserver();
}, FAILSAFE_TIMEOUT);
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function() {
googletag.defineSlot('/21855748559/site_level',
div_sizes_l,
'div-gpt-ad-Landing_Top').addService(googletag.pubads());
googletag.pubads().setTargeting('position', 'Landing_Top');
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
googletag.cmd.push(function() {
googletag.defineSlot('/21855748559/site_level',
div_sizes_l,
'div-gpt-ad-Landing_Middle').addService(googletag.pubads());
googletag.pubads().setTargeting('position', 'Landing_Middle');
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});