并行加载 GPT 和出价
概览
此项审核旨在检查标头出价请求是否会被延迟到
Google 发布商代码 (GPT) 库加载。在大多数情况下,这些请求并不依赖于 GPT,而是可与正加载的库并行传送以加快广告加载速度。
建议
确保标头出价请求不会等待 googletag.pubadsReady()
或 googletag.cmd.push()
。
Prebid.js 示例
不正确 |
window.pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
window.googletag = window.googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function() {
googletag.pubads().disableInitialLoad();
// Incorrect: Making bid requests dependent on GPT loading.
pbjs.que.push(function() {
pbjs.requestBids({
bidsBackHandler: handleBidResponse
});
});
});
|
正确 |
window.pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
// Correct: Making bid requests independent of GPT loading.
pbjs.que.push(function() {
pbjs.requestBids({
bidsBackHandler: handleBidResponse
});
});
window.googletag = window.googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function() {
googletag.pubads().disableInitialLoad();
});
|
此项审核所支持广告交易平台和供应方平台的列表
可在以下位置找到:
我们的 GitHub 代码库。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-10-16。
[null,null,["最后更新时间 (UTC):2024-10-16。"],[[["This audit checks if header bidding requests are delayed until the Google Publisher Tag library loads, potentially slowing down ad loading."],["It's recommended to make header bidding requests independent of GPT loading to improve performance."],["You can make your header bidding requests independent of GPT by ensuring they don't wait for `googletag.pubadsReady()` or `googletag.cmd.push()`, as demonstrated in the Prebid.js example."],["A list of supported ad platforms evaluated by this audit is available on the project's GitHub repository."]]],["The audit checks if header bidding requests are unnecessarily delayed by waiting for the Google Publisher Tag (GPT) library to load. Header bidding requests should be independent of GPT to speed up ad loading. Avoid using `googletag.pubadsReady()` or `googletag.cmd.push()` to trigger bid requests. The correct approach, exemplified with Prebid.js, is to initiate `pbjs.requestBids` outside of the `googletag.cmd.push()` function, making the bid requests run in parallel to GPT loading.\n"]]