我使用的是google-dfp的lazyLoading。启用此选项后,所有广告都会延迟加载。有没有办法只对特定的广告而不是所有的广告启用它?
googletag.pubads().enableLazyLoad({
// Fetch slots within 6 viewports.
fetchMarginPercent: 500,
// Render slots within 1.04 viewports.
renderMarginPercent: 4,
// Double the above values on mobile, where viewports are smaller
// and users tend to scroll faster.
mobileScaling: 10,
});发布于 2021-11-04 09:48:39
有一种方法可以将你的adrequest分成两批:
googletag.cmd.push(function() {
// Define ad slots.
var slots = [
googletag.defineSlot('/6355419/Travel/Europe', [728, 90], 'slot-1')
.addService(googletag.pubads()),
googletag.defineSlot('/6355419/Travel/Europe', [728, 90], 'slot-2')
.addService(googletag.pubads()),
googletag.defineSlot('/6355419/Travel/Europe', [300, 250], 'slot-3')
.addService(googletag.pubads()),
googletag.defineSlot('/6355419/Travel/Europe', [300, 250], 'slot-4')
.addService(googletag.pubads()),
googletag.defineSlot('/6355419/Travel/Europe', [300, 250], 'slot-5')
.addService(googletag.pubads())
];
// Disable initial load to precisely control when ads are requested.
googletag.pubads().disableInitialLoad();
// Enable SRA and services.
googletag.pubads().enableSingleRequest();
googletag.enableServices();
// Issue first SRA request (slots 1 and 2) immediately.
googletag.pubads().refresh([slots[0], slots[1]]);
// Enable lazyLoading after 1st SRA batch
googletag.pubads().enableLazyLoad({
// Fetch slots within 6 viewports.
fetchMarginPercent: 500,
// Render slots within 1.04 viewports.
renderMarginPercent: 4,
// Double the above values on mobile, where viewports are smaller
// and users tend to scroll faster.
mobileScaling: 10,
});
// Issue second SRA request (slots 3, 4 and 5) once lazyLoading has been enabled
googletag.pubads().refresh([slots[2], slots[3], slots[4]]);
});有关SRA批处理的详细信息,请参阅here。
https://stackoverflow.com/questions/68271783
复制相似问题