[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2024-11-24 (世界標準時間)。"],[[["\u003cp\u003ePrioritize loading above-the-fold ad slots first to maximize viewability and minimize impact on initial page load.\u003c/p\u003e\n"],["\u003cp\u003eUtilize lazy loading for below-the-fold ads to optimize page performance by deferring loading until they are about to be viewed.\u003c/p\u003e\n"],["\u003cp\u003eRefresh ads dynamically using the GPT library's refresh functionality to avoid full page refreshes and control the timing of ad updates.\u003c/p\u003e\n"],["\u003cp\u003eImplement Single Request Architecture (SRA) to bundle ad requests for multiple slots when utilizing features like competitive exclusions and roadblocks, ensuring all slot configurations are completed before the first display call.\u003c/p\u003e\n"],["\u003cp\u003eOptimize ad sizing by defining multiple ad sizes for each slot to enhance fill rates and potential revenue.\u003c/p\u003e\n"]]],["Prioritize loading visible ads early by defining them in the `\u003chead\u003e` and requesting them promptly. Delay loading ads below the fold using lazy loading. Refresh ad content dynamically without full page reloads, adhering to best practices and declaring refreshes. Use page-level targeting for shared key-values and slot-level targeting for unique ones. Enable Single Request Architecture (SRA) for competitive exclusions, defining all slots and configurations before the first `display()` call. Optimize ad sizes by specifying multiple sizes per slot.\n"],null,["# Ad Best Practices\n\nAfter you've integrated the Google Publisher Tag (GPT) library into\nyour site and become familiar with our\n[general best practices](//developers.google.com/publisher-tag/guides/general-best-practices), you're ready to\nstart issuing ad requests. In the following sections, we'll cover some\nadditional best practices you should keep in mind when configuring and working\nwith ad slots, to make the most of your ad space with minimal performance\nimpact.\n\nPrioritize \"important\" ad slots\n-------------------------------\n\nNot all ad slots are created equal. For example, slots which are visible as soon\nas your page loads (above the fold) are usually more \"important\" than those\nwhich are not visible until scrolled into view (below the fold), in terms of\nviewability and monetization. With this in mind, it's important that you\ncarefully consider the relative importance of every ad slot on your page and\nprioritize loading the most important slots as quickly as possible.\n\n### Load above the fold ads early\n\nAds that will be visible as soon as the page loads should be given the highest\npriority. It's recommended that you define these slots in the `\u003chead\u003e` of your\ndocument, and request them as early in the page load process as possible. This\nhelps to ensure that these ads are loaded early (maximizing viewability) and\nthat they won't unnecessarily slow down the initial page load.\n\n### Load below the fold ads lazily\n\nFor ads that need to be scrolled into view, fetching and rendering should be\ndeferred until the slots are close to entering the viewport. This is a process\nknown as lazy loading. [Lazy loading](//developers.google.com/publisher-tag/samples/lazy-loading) separately\nprioritizes requesting and rendering creative content for slots that are the\nmost likely to be viewed. This helps optimize page load performance by\nconserving the browser's limited resources, which is especially important in\nmobile environments where bandwidth and CPU are often heavily constrained.\n\nRefresh ads without refreshing the page\n---------------------------------------\n\nThere are many scenarios in which it is optimal or even necessary to replace the\ncurrent ad content of a slot. In these cases, it is best to use the\nGPT library's\n[refresh functionality](//developers.google.com/publisher-tag/guides/control-ad-loading#refresh) to do so dynamically.\nThis avoids a full page refresh and lets you precisely control the conditions\nunder which a slot or group of slots are updated.\n\nWhen refreshing ad slots, it's important to be familiar with and adhere to\n[`refresh()` best practices](//developers.google.com/publisher-tag/guides/control-ad-loading#best_practices).\nRefreshing ads inappropriately can lead to performance issues and negatively\nimpact viewability rates.\n| **Important:** To comply with Google policy and enable your inventory to compete on Ad Exchange, you must [declare which portions of your inventory refresh](//support.google.com/admanager/answer/6286179).\n\nTarget ads effectively\n----------------------\n\nWhen configuring [key-value targeting](//developers.google.com/publisher-tag/guides/key-value-targeting), carefully\nconsider whether to use slot- or page-level targeting. For key-values shared\nbetween multiple slots, it's most effective to use page-level targeting using\n[`googletag.setConfig({ targeting: ... })`](//developers.google.com/publisher-tag/reference#googletag.config.PageSettingsConfig.targeting). Slot-level\ntargeting should only be used to register key-values which differ or are not\nincluded on all slots.\n\nNote that both slot- and page-level targeting can be used at once, as seen in\nthe [set targeting example](//developers.google.com/publisher-tag/guides/key-value-targeting#set_targeting). It is strongly recommended\nthat you configure targeting at the page-level first, then apply slot-level\noverrides only where necessary. This approach not only makes efficient use of\nthe GPT API, it also simplifies code and helps in maintaining\na clear mental model of all targeting configured on the page.\n\nUse Single Request Architecture correctly\n-----------------------------------------\n\nSingle Request Architecture (SRA) is a GPT request mode which\nbundles requests for multiple ad slots into a single ad request. This ensures\nthat competitive exclusions and roadblocks configured for your page will be\nhonored. Therefore, if your page makes use of these, it's recommended that you\nenable SRA and understand how to use it correctly.\n\nIn its default configuration, SRA will request all ad slots defined on your\npage the first time you call [`display()`](//developers.google.com/publisher-tag/reference#googletag.display) (or `refresh()`, if\n[initial load is disabled](//developers.google.com/publisher-tag/guides/control-ad-loading)). Because of this\nit's recommended that you define all of your page's ad slots in the `\u003chead\u003e` of\nthe document, before making the first call to `display()`.\n[Lazy loading](//developers.google.com/publisher-tag/samples/lazy-loading) can be used in conjunction with this\napproach to ensure slots located below the fold are\n[not loaded immediately](#below-the-fold).\n\nWhen using SRA, it's important to fully configure all ad slots (for example,\nset targeting, category exclusion, etc.) prior to making the first call to\n`display()`. Only values configured before this point will be included in the\ninitial SRA request.\n\nIncorrect --- ad slot configuration is not included in SRA request \n\n \u003chtml\u003e\n \u003chead\u003e\n \u003cmeta charset=\"utf-8\"\u003e\n \u003ctitle\u003eSingle Request Architecture Example\u003c/title\u003e\n \u003cscript src=\"https://securepubads.g.doubleclick.net/tag/js/gpt.js\" crossorigin=\"anonymous\" async\u003e\u003c/script\u003e\n \u003cscript\u003e\n window.googletag = window.googletag || {cmd: []};\n var adSlot1, adSlot2;\n\n googletag.cmd.push(function() {\n // Define ad slot 1.\n adSlot1 = googletag\n .defineSlot('/6355419/Travel/Europe/France',[728, 90], 'banner-ad-1')\n .addService(googletag.pubads());\n // Define ad slot 2.\n adSlot2 = googletag\n .defineSlot('/6355419/Travel/Europe/France',[728, 90], 'banner-ad-2')\n .addService(googletag.pubads());\n // Enable SRA and services.\n googletag.setConfig({ singleRequest: true });\n googletag.enableServices();\n });\n \u003c/script\u003e\n \u003c/head\u003e\n \u003cbody\u003e\n \u003cdiv id=\"banner-ad-1\" style=\"width: 728px; height: 90px;\"\u003e\n \u003cscript\u003e\n googletag.cmd.push(function() {\n // This call to display requests both ad slots.\n googletag.display(adSlot1);\n });\n \u003c/script\u003e\n \u003c/div\u003e\n \u003cdiv id=\"banner-ad-2\" style=\"width: 728px; height: 90px;\"\u003e\n \u003cscript\u003e\n googletag.cmd.push(function() {\n // This call to display has no effect, since both ad slots have already\n // been fetched by the previous call to display.\n // Targeting configuration for ad slot 2 is ignored.\n adSlot2.setConfig({ targeting: { test: 'privacy' } });\n googletag.display(adSlot2);\n });\n \u003c/script\u003e\n \u003c/div\u003e\n \u003c/body\u003e\n \u003c/html\u003e\n\nCorrect --- ad slot configuration is included in SRA request \n\n \u003c!doctype html\u003e\n \u003chtml\u003e\n \u003chead\u003e\n \u003cmeta charset=\"utf-8\"\u003e\n \u003ctitle\u003eSingle Request Architecture Example\u003c/title\u003e\n \u003cscript src=\"https://securepubads.g.doubleclick.net/tag/js/gpt.js\" crossorigin=\"anonymous\" async\u003e\u003c/script\u003e\n \u003cscript\u003e\n window.googletag = window.googletag || {cmd: []};\n var adSlot1, adSlot2;\n\n googletag.cmd.push(function() {\n // Define ad slot 1.\n adSlot1 = googletag\n .defineSlot('/6355419/Travel/Europe/France',[728, 90], 'banner-ad-1')\n .addService(googletag.pubads());\n // Define and configure ad slot 2.\n adSlot2 = googletag\n .defineSlot('/6355419/Travel/Europe/France',[728, 90], 'banner-ad-2')\n .addService(googletag.pubads());\n adSlot2.setConfig({ targeting: { test: 'privacy' } });\n // Enable SRA and services.\n googletag.setConfig({ singleRequest: true });\n googletag.enableServices();\n });\n \u003c/script\u003e\n \u003c/head\u003e\n \u003cbody\u003e\n \u003cdiv id=\"banner-ad-1\" style=\"width: 728px; height: 90px;\"\u003e\u003c/div\u003e\n \u003cdiv id=\"banner-ad-2\" style=\"width: 728px; height: 90px;\"\u003e\u003c/div\u003e\n \u003cscript\u003e\n googletag.cmd.push(function() {\n // This call to display requests both ad slots with all\n // configured targeting.\n googletag.display(adSlot1);\n });\n \u003c/script\u003e\n \u003c/body\u003e\n \u003c/html\u003e\n\nOptimize your ad sizing\n-----------------------\n\nWhen defining your ad slots, consider not just the maximum size ad that could\nserve, but also smaller sizes that could comfortably fit into the same space. In\ngeneral, the more sizes you specify when defining a slot, the more ads that will\nbe eligible to serve to it. This can translate to higher fill rates and\nincreased revenue."]]