Równoległe wczytywanie GPT i stawek
Omówienie
Ten audyt pozwala sprawdzić, czy żądania określania stawek przez kod w nagłówku są odraczane do momentu załadowania biblioteki tagu wydawcy Google (GPT). W większości przypadków żądania te nie są
jest uzależniona od GPT i może zostać utworzona równolegle z wczytywaniem biblioteki do
przyspieszą ładowanie reklam.
Rekomendacje
Upewnij się, że żądania określania stawek przez kod w nagłówku nie czekają na googletag.pubadsReady()
ani googletag.cmd.push()
.
Przykład Prebid.js
Źle |
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
});
});
});
|
Dobrze |
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();
});
|
Lista obsługiwanych giełd reklam i platform dostawców w ramach tego audytu
ocen można znaleźć w
repozytorium GitHub.
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2024-10-16 UTC.
[null,null,["Ostatnia aktualizacja: 2024-10-16 UTC."],[[["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"]]