我有一个问题,就是前期出价是在首页加载时进行出价,但未在首页加载中设置键值,因此“大”出价由于某种原因而无法赢得竞标,
我认为这与DFP广告管理系统尺寸映射有关,但我不确定,有人可以帮助我吗?
当首页加载一个广告时,它会加载一个“自家”广告或一个“动态分配”,而不是前提条件“获胜”,它还会在X秒钟内“可见”后刷新广告并执行“新”出价。因此,我只是停留在此“第一”页面加载位上,任何帮助都将是非常有用的,因为我对它视而不见已经有好几天了
<!-- Prebid Config Section START -->
var PREBID_TIMEOUT = 1500;
var gpt_config = {
prebid_timeout: 3000, //left for reference but not using right now...
default_gbp_rate: 0.77, // not being used
latest_gbp_rate: 0.77414, //RATE AS AT 30-08-2017 , not being used, using newRate from the function
dynamically_lookup_gbp_rate: true,
mobileWidthBreakpoint: 640,
tabletWidthBreakpoint: 767,
bigbox_sizes: [[300, 600], [300, 250], [160, 600], [120, 600],[250,250]],
bigbox_sizes_tablet: [[300, 250],[250,250]],
bigbox_sizes_mobile: [[300, 250],[250,250]],
leaderboard_sizes: [[970, 250],[970, 90],[728, 90],[468,60],[320, 50],[234,60]],
leaderboard_sizes_tablet: [[728, 90],[468,60],[320, 50],[234,60]],
leaderboard_sizes_mobile: [[320, 50],[234,60]],
skin_sizes: [[1, 1]]
}; //./gpt_config
var adUnits = [
//new ad unit block
{
code: 'toprightSlot',
mediaTypes: {
banner: {
sizes: [
[300, 600],
[300, 250],
[250, 250],
[160, 600],
[120, 600]
],
}
},
bids: [
{ bidder: 'aol', labelAny: ['desktop', 'tablet', 'phone'], params: { placement: '4882886', network: '4436.1', server: 'adserver.adtech.de' } }, /* 300x250 */
{ bidder: 'aol', labelAny: ['desktop'], params: { placement: '4882888', network: '4436.1', server: 'adserver.adtech.de' } }, /* 160x600 */
{ bidder: 'aol', labelAny: ['desktop'], params: { placement: '5293857', network: '4436.1', server: 'adserver.adtech.de' } }, /* 300x600 */
{ bidder: 'aol', labelAny: ['desktop'], params: { placement: '6507339', network: '4436.1', server: 'adserver.adtech.de' } }, /* 120x600 */
{ bidder: 'vertoz', labelAny: ['desktop'], params: { placementId: 'VZ-HB-P511170V2009D9'} } /*120x250*/
/* { bidder: 'springserveAlias2', params: { placementId: '12463797'} } */ /* 300x600 - 300x250 - 160x600 - 120x600 */
] //./bids
},
//new ad unit block
{
code: 'middlerightSlot',
mediaTypes: {
banner: {
sizes: [
[300, 600],
[300, 250],
[250, 250],
[160, 600],
[120, 600]
],
}
},
bids: [
{ bidder: 'aol', labelAny: ['desktop', 'tablet', 'phone'], params: { placement: '4882886', network: '4436.1', server: 'adserver.adtech.de' } }, /* 300x250 */
{ bidder: 'aol', labelAny: ['desktop'], params: { placement: '4882888', network: '4436.1', server: 'adserver.adtech.de' } }, /* 160x600 */
{ bidder: 'aol', labelAny: ['desktop'], params: { placement: '5293857', network: '4436.1', server: 'adserver.adtech.de' } }, /* 300x600 */
{ bidder: 'aol', labelAny: ['desktop'], params: { placement: '6507339', network: '4436.1', server: 'adserver.adtech.de' } }, /* 120x600 */
{ bidder: 'vertoz', labelAny: ['desktop'], params: { placementId: 'VZ-HB-P511170V2009D9'} } /*120x250*/
/* { bidder: 'springserveAlias2', params: { placementId: '12463797'} } */ /* 300x600 - 300x250 - 160x600 - 120x600 */
] //./bids
},
//new ad unit block
{
code: 'bottomrightSlot',
mediaTypes: {
banner: {
sizes: [
[300, 600],
[300, 250],
[250, 250],
[160, 600],
[120, 600]
],
}
},
bids: [
{ bidder: 'aol', labelAny: ['desktop', 'tablet', 'phone'], params: { placement: '4882886', network: '4436.1', server: 'adserver.adtech.de' } }, /* 300x250 */
{ bidder: 'aol', labelAny: ['desktop'], params: { placement: '4882888', network: '4436.1', server: 'adserver.adtech.de' } }, /* 160x600 */
{ bidder: 'aol', labelAny: ['desktop'], params: { placement: '5293857', network: '4436.1', server: 'adserver.adtech.de' } }, /* 300x600 */
{ bidder: 'vertoz', labelAny: ['desktop'], params: { placementId: 'VZ-HB-P511170V2009D9'} } /*120x250*/
/* { bidder: 'springserveAlias2', params: { placementId: '12463797'} } */ /* 300x600 - 300x250 - 160x600 - 120x600 */
] //./bids
},
//new ad unit block
{
code: 'topleaderSlot',
sizes: [
[970, 250],
[970, 90],
[728, 90],
[468, 60],
[234, 60],
[320, 50]
],
bids: [
{ bidder: 'aol', labelAny: ['desktop', 'tablet'], params: { placement: '4882887', network: '4436.1', server: 'adserver.adtech.de' } }, /* 728x90 */
{ bidder: 'aol', labelAny: ['desktop'], params: { placement: '6507337', network: '4436.1', server: 'adserver.adtech.de' } }, /* 970x250 */
{ bidder: 'aol', labelAny: ['desktop'], params: { placement: '6507338', network: '4436.1', server: 'adserver.adtech.de' } }, /* 970x90 */
{ bidder: 'aol', labelAny: ['desktop', 'tablet'], params: { placement: '6507341', network: '4436.1', server: 'adserver.adtech.de' } }, /* 468x60 */
{ bidder: 'aol', labelAny: ['desktop', 'tablet', 'phone'], params: { placement: '6507340', network: '4436.1', server: 'adserver.adtech.de' } }, /* 320x50 */
{ bidder: 'vertoz', labelAny: ['desktop', 'tablet'], params: { placementId:'VZ-HB-P786728VDF5C56'} } /*7 28x90 */
/* { bidder: 'springserveAlias2', params: { placementId: '12463800'} } */ /* 970x250 - 970x90 - 728x90 */
] //./bids
},
{
code: 'skinSlot',
sizes: [[1, 1]],
bids: [
{ bidder: 'justpremium', labelAny: ['desktop', 'tablet'], params: { zone: '50978', allow: ['wp', 'sa', 'pu', 'pd', 'pa', 'ms', 'mo', 'is', 'as', 'fa', 'fi', 'hi', 'cf'] } } /* wallpaper, video wallpaper */
] //./bids
}
]; //./adUnits
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function() {
googletag.pubads().disableInitialLoad();
});
pbjs.que.push(function() {
pbjs.aliasBidder('appnexus','sekindo'); // alias for bidder
pbjs.aliasBidder('appnexus','brealtime'); // alias for bidder
pbjs.aliasBidder('appnexus','springserveAlias2'); // alias for bidder
pbjs.aliasBidder('appnexus','districtm'); // alias for bidder
// pbjs.setPriceGranularity("dense"); // not being used, being done in adserver targeting below, this needs to be tweaked once prices seen more
pbjs.addAdUnits(adUnits);
// pbjs.enableSendAllBids();
pbjs.setConfig({
consentManagement: {
cmpApi: 'iab',
timeout: 5000,
allowAuctionWithoutConsent: true
},
debug: true,
enableSendAllBids: false, // Default will be `true` as of 1.0
bidderSequence: 'random', // Default is random
publisherDomain: 'golfwrx.com',
bidderTimeout: 4000,
pubcid: {expInterval: 525600},
currency: {
'adServerCurrency': "GBP",
'granularityMultiplier': 1,
'conversionRateFile': 'https://currency.prebid.org/latest.json',
},
sizeConfig: [{
mediaQuery: '(min-width: 769px)',
sizesSupported: [[970, 250], [970, 90], [728, 90], [468, 60], [320, 50], [234, 60], [300, 600], [300, 250], [160, 600], [120, 600], [250, 250], [1, 1]],
labels: ['desktop']
}, {
mediaQuery: '(min-width: 500px) and (max-width: 768px)',
sizesSupported: [[728, 90], [468, 60], [320, 50], [234, 60], [300, 250], [250, 250], [1, 1]],
labels: ['tablet']
}, {
mediaQuery: '(min-width: 1px) and (max-width: 1px)',
sizesSupported: [[300, 250], [250, 250], [320, 50], [234, 60]],
labels: ['phone']
}]
});
pbjs.requestBids({
bidsBackHandler: initAdserver
});
});
pbjs.bidderSettings = {
aol: { bidCpmAdjustment : function(bidCpm){ return bidCpm * 0.85; } }, // adjust the bid in real time before the auction takes place
districtmDMX: { bidCpmAdjustment : function(bidCpm){ return bidCpm * 0.90; } }, // adjust the bid in real time before the auction takes place
sekindonapn: { bidCpmAdjustment : function(bidCpm){ return bidCpm * 0.75; } }, // adjust the bid in real time before the auction takes place
brealtime: { bidCpmAdjustment : function(bidCpm){ return bidCpm * 0.80; } }, // adjust the bid in real time before the auction takes place
springserveAlias2: { bidCpmAdjustment : function(bidCpm){ return bidCpm * 0.65; } }, // adjust the bid in real time before the auction takes place
standard: {
adserverTargeting: [
{ key: "hb_bidder", val: function(bidResponse) { return bidResponse.bidderCode; } },
{ key: "hb_adid", val: function(bidResponse) { return bidResponse.adId; } },
{ key: "hb_size", val: function(bidResponse) { return bidResponse.size; } },
{ key: "hb_time", val: function(bidResponse) { return bidResponse.time; } },
{ key: "hb_nowin", val: function(bidResponse) { return 'no_win'; } },
{ key: "hb_website",val: function(bidResponse) { return 'golfwrx.com'; } },
{ key: "hb_pb", val: function(bidResponse) { var cpm = (bidResponse.cpm * (gpt_config.latest_gbp_rate || gpt_config.default_gbp_rate)) *1.2 ; //converts cpm to GBP, rounds cpm to nearest 0.10 incriment, sets 20 if above 20, sets a rev share value
if (cpm <20) { return (Math.floor(cpm * 10) / 10).toFixed(2);} else { return '20.00'; } }
}]
}
};
function initAdserver() {
if (pbjs.adserverRequestSent) return;
pbjs.adserverRequestSent = true;
googletag.cmd.push(function() {
pbjs.que.push(function() {
pbjs.setTargetingForGPTAsync();
googletag.pubads().refresh();
});
});
}
setTimeout(function() { initAdserver(); }, PREBID_TIMEOUT);
(function () {
var gads = document.createElement('script');
gads.async = true;
gads.type = 'text/javascript';
var useSSL = 'https:' == document.location.protocol;
gads.src = (useSSL ? 'https:' : 'http:') +
'//www.googletagservices.com/tag/js/gpt.js';
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(gads, node);
})();
googletag.cmd.push(function () {
(function (googletag, pbjs, config) {
var sizeMappings = {};
var slots = {};
function refreshSlot(slot) {
pbjs.que.push(function() {
pbjs.requestBids({
timeout: PREBID_TIMEOUT,
adUnitCodes: [slot.getSlotElementId()],
bidsBackHandler: function() {
pbjs.setTargetingForGPTAsync([slot.getSlotElementId()]);
googletag.pubads().refresh([slot]);
}
});
});
}
Object.keys(config.sizeMappings).forEach(function (key) {
var sizeMappingBuilder = googletag.sizeMapping();
config.sizeMappings[key].forEach(function (mapping) {
sizeMappingBuilder.addSize(mapping[0], mapping[1]);
});
var sizeMapping = sizeMappingBuilder.build();
sizeMappings[key] = sizeMapping;
console.log('created sizemapping ', key, ' ', sizeMappings[key]);
});
googletag.pubads().enableSingleRequest();
googletag.pubads().collapseEmptyDivs(true, true);
googletag.pubads().setCentering(true);
googletag.pubads().disableInitialLoad();
googletag.enableServices();
googletag.pubads().addEventListener('impressionViewable', function (event) {
var elementId = event.slot.getSlotElementId();
var slotConfig = slots[elementId];
if (slotConfig) {
var handle = setTimeout(function () {
googletag.cmd.push(function () {
refreshSlot(event.slot);
});
}, config.definitons[elementId].timeout);
console.log('handle for time ', handle, ' elementId ', elementId, ' duration ', config.definitons[elementId].timeout);
}
});
Object.keys(config.definitons).forEach(function (key) {
var def = config.definitons[key];
var slot = googletag.defineSlot(def.adUnitPath, def.size, key);
slot.setTargeting('test', 'refresh');
slot.defineSizeMapping(sizeMappings[def.sizeMapping]);
slot.addService(googletag.pubads());
googletag.display(key);
slots[key] = { slot: slot };
});
//googletag.pubads().refresh();
// googletag.pubads().refresh();
})(window.googletag, window.pbjs, {
definitons: {
topleaderSlot: {
adUnitPath: '/1001824/prebid_test2',
size: gpt_config.leaderboard_sizes,
sizeMapping: 'mappingleaderslot',
timeout: 60000,
},
toprightSlot: {
adUnitPath: '/1001824/prebid_test3',
size: gpt_config.bigbox_sizes,
sizeMapping: 'mappingbigboxslot',
timeout: 60000,
},
middlerightSlot: {
adUnitPath: '/1001824/prebid_test1',
size: gpt_config.bigbox_sizes,
sizeMapping: 'mappingbigboxslot',
timeout: 60000,
},
bottomrightSlot: {
adUnitPath: '/1001824/prebid_test4',
size: gpt_config.bigbox_sizes,
sizeMapping: 'mappingbigboxslot',
timeout: 60000,
},
skinSlot: {
adUnitPath: '/1001824/Golfwrx.com-HB/Golfwrx.com-HB-Skin',
size: gpt_config.skin_sizes,
sizeMapping: 'mappingskinslot',
timeout: 45000,
},
},
sizeMappings: {
mappingleaderslot: [
[
[1024, 768],
[
[970, 250],
[970, 90],
[728, 90],
[468, 60],
[320, 50],
[234, 60]
]
],
[
[768, 500],
[
[728, 90],
[468, 60],
[320, 50],
[234, 60]
]
],
[
[1, 1],
[
[320, 50],
[234, 60]
]
],
],
mappingskinslot: [
[
[1024, 768],
[
[1, 1]
]
],
[
[768, 500],
[
[1, 1]
]
],
[
[1, 1],
[
[1, 1]
]
],
],
mappingbigboxslot: [
[
[1024, 768],
[
[300, 600],
[300, 250],
[160, 600],
[120, 600],
[250, 250]
]
],
[
[768, 500],
[
[300, 250],
[250, 250]
]
],
[
[1, 1],
[
[300, 250],
[250, 250]
]
],
]
}
});
});