CINXE.COM

GPT Reference  |  Google Publisher Tag  |  Google for Developers

<!doctype html> <html lang="en" dir="ltr"> <head> <meta name="google-signin-client-id" content="721724668570-nbkv1cfusk7kk4eni4pjvepaus73b13t.apps.googleusercontent.com"> <meta name="google-signin-scope" content="profile email https://www.googleapis.com/auth/developerprofiles https://www.googleapis.com/auth/developerprofiles.award"> <meta property="og:site_name" content="Google for Developers"> <meta property="og:type" content="website"><meta name="theme-color" content="#1e8e3e"><meta charset="utf-8"> <meta content="IE=Edge" http-equiv="X-UA-Compatible"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="manifest" href="/_pwa/developers/manifest.json" crossorigin="use-credentials"> <link rel="preconnect" href="//www.gstatic.com" crossorigin> <link rel="preconnect" href="//fonts.gstatic.com" crossorigin> <link rel="preconnect" href="//fonts.googleapis.com" crossorigin> <link rel="preconnect" href="//apis.google.com" crossorigin> <link rel="preconnect" href="//www.google-analytics.com" crossorigin><link rel="stylesheet" href="//fonts.googleapis.com/css?family=Google+Sans:400,500|Roboto:400,400italic,500,500italic,700,700italic|Roboto+Mono:400,500,700&display=swap"> <link rel="stylesheet" href="//fonts.googleapis.com/css2?family=Material+Icons&family=Material+Symbols+Outlined&display=block"><link rel="stylesheet" href="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/developers/css/app.css"> <link rel="shortcut icon" href="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/developers/images/favicon-new.png"> <link rel="apple-touch-icon" href="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/developers/images/touchicon-180-new.png"><link rel="canonical" href="https://developers.google.com/publisher-tag/reference"><link rel="search" type="application/opensearchdescription+xml" title="Google for Developers" href="https://developers.google.com/s/opensearch.xml"> <link rel="alternate" hreflang="en" href="https://developers.google.com/publisher-tag/reference" /><link rel="alternate" hreflang="x-default" href="https://developers.google.com/publisher-tag/reference" /><link rel="alternate" hreflang="ar" href="https://developers.google.com/publisher-tag/reference?hl=ar" /><link rel="alternate" hreflang="bn" href="https://developers.google.com/publisher-tag/reference?hl=bn" /><link rel="alternate" hreflang="zh-Hans" href="https://developers.google.com/publisher-tag/reference?hl=zh-cn" /><link rel="alternate" hreflang="zh-Hant" href="https://developers.google.com/publisher-tag/reference?hl=zh-tw" /><link rel="alternate" hreflang="fa" href="https://developers.google.com/publisher-tag/reference?hl=fa" /><link rel="alternate" hreflang="fr" href="https://developers.google.com/publisher-tag/reference?hl=fr" /><link rel="alternate" hreflang="de" href="https://developers.google.com/publisher-tag/reference?hl=de" /><link rel="alternate" hreflang="he" href="https://developers.google.com/publisher-tag/reference?hl=he" /><link rel="alternate" hreflang="hi" href="https://developers.google.com/publisher-tag/reference?hl=hi" /><link rel="alternate" hreflang="id" href="https://developers.google.com/publisher-tag/reference?hl=id" /><link rel="alternate" hreflang="it" href="https://developers.google.com/publisher-tag/reference?hl=it" /><link rel="alternate" hreflang="ja" href="https://developers.google.com/publisher-tag/reference?hl=ja" /><link rel="alternate" hreflang="ko" href="https://developers.google.com/publisher-tag/reference?hl=ko" /><link rel="alternate" hreflang="pl" href="https://developers.google.com/publisher-tag/reference?hl=pl" /><link rel="alternate" hreflang="pt-BR" href="https://developers.google.com/publisher-tag/reference?hl=pt-br" /><link rel="alternate" hreflang="ru" href="https://developers.google.com/publisher-tag/reference?hl=ru" /><link rel="alternate" hreflang="es-419" href="https://developers.google.com/publisher-tag/reference?hl=es-419" /><link rel="alternate" hreflang="th" href="https://developers.google.com/publisher-tag/reference?hl=th" /><link rel="alternate" hreflang="tr" href="https://developers.google.com/publisher-tag/reference?hl=tr" /><link rel="alternate" hreflang="vi" href="https://developers.google.com/publisher-tag/reference?hl=vi" /><title>GPT Reference &nbsp;|&nbsp; Google Publisher Tag &nbsp;|&nbsp; Google for Developers</title> <meta property="og:title" content="GPT Reference &nbsp;|&nbsp; Google Publisher Tag &nbsp;|&nbsp; Google for Developers"><meta name="description" content="Documentation for googletag"> <meta property="og:description" content="Documentation for googletag"><meta property="og:url" content="https://developers.google.com/publisher-tag/reference"><meta property="og:image" content="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/developers/images/opengraph/google-green.png"> <meta property="og:image:width" content="1200"> <meta property="og:image:height" content="675"><meta property="og:locale" content="en"><meta name="twitter:card" content="summary_large_image"><script type="application/ld+json"> { "@context": "https://schema.org", "@type": "Article", "headline": "GPT Reference" } </script><script type="application/ld+json"> { "@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{ "@type": "ListItem", "position": 1, "name": "Google Publisher Tag", "item": "https://developers.google.com/publisher-tag/guides/get-started" },{ "@type": "ListItem", "position": 2, "name": "GPT Reference", "item": "https://developers.google.com/publisher-tag/reference" }] } </script> <meta name="viewport" content="width=device-width, initial-scale=1"/> <link rel="stylesheet" href="/extras.css"></head> <body class="" template="page" theme="google-green" type="article" layout="docs" concierge='closed' display-toc pending> <devsite-progress type="indeterminate" id="app-progress"></devsite-progress> <section class="devsite-wrapper"> <devsite-cookie-notification-bar></devsite-cookie-notification-bar><devsite-header role="banner"> <div class="devsite-header--inner nocontent"> <div class="devsite-top-logo-row-wrapper-wrapper"> <div class="devsite-top-logo-row-wrapper"> <div class="devsite-top-logo-row"> <button type="button" id="devsite-hamburger-menu" class="devsite-header-icon-button button-flat material-icons gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Navigation menu button" visually-hidden aria-label="Open menu"> </button> <div class="devsite-product-name-wrapper"> <span class="devsite-product-name"> <ul class="devsite-breadcrumb-list" > <li class="devsite-breadcrumb-item devsite-has-google-wordmark"> <a href="https://developers.google.com/publisher-tag/guides/get-started" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Upper Header" data-value="1" track-type="globalNav" track-name="breadcrumb" track-metadata-position="1" track-metadata-eventdetail="Google Publisher Tag" > <svg class="devsite-google-wordmark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 148 48"> <title>Google</title> <path class="devsite-google-wordmark-svg-path" d="M19.58,37.65c-9.87,0-18.17-8.04-18.17-17.91c0-9.87,8.3-17.91,18.17-17.91c5.46,0,9.35,2.14,12.27,4.94l-3.45,3.45c-2.1-1.97-4.93-3.49-8.82-3.49c-7.21,0-12.84,5.81-12.84,13.02c0,7.21,5.64,13.02,12.84,13.02c4.67,0,7.34-1.88,9.04-3.58c1.4-1.4,2.32-3.41,2.66-6.16H19.58v-4.89h16.47c0.18,0.87,0.26,1.92,0.26,3.06c0,3.67-1.01,8.21-4.24,11.44C28.93,35.9,24.91,37.65,19.58,37.65z M61.78,26.12c0,6.64-5.1,11.53-11.36,11.53s-11.36-4.89-11.36-11.53c0-6.68,5.1-11.53,11.36-11.53S61.78,19.43,61.78,26.12z M56.8,26.12c0-4.15-2.96-6.99-6.39-6.99c-3.43,0-6.39,2.84-6.39,6.99c0,4.11,2.96,6.99,6.39,6.99C53.84,33.11,56.8,30.22,56.8,26.12z M87.25,26.12c0,6.64-5.1,11.53-11.36,11.53c-6.26,0-11.36-4.89-11.36-11.53c0-6.68,5.1-11.53,11.36-11.53C82.15,14.59,87.25,19.43,87.25,26.12zM82.28,26.12c0-4.15-2.96-6.99-6.39-6.99c-3.43,0-6.39,2.84-6.39,6.99c0,4.11,2.96,6.99,6.39,6.99C79.32,33.11,82.28,30.22,82.28,26.12z M112.09,15.29v20.7c0,8.52-5.02,12.01-10.96,12.01c-5.59,0-8.95-3.76-10.22-6.81l4.41-1.83c0.79,1.88,2.71,4.1,5.81,4.1c3.8,0,6.16-2.36,6.16-6.77v-1.66h-0.18c-1.14,1.4-3.32,2.62-6.07,2.62c-5.76,0-11.05-5.02-11.05-11.49c0-6.51,5.28-11.57,11.05-11.57c2.75,0,4.93,1.22,6.07,2.58h0.18v-1.88H112.09z M107.64,26.16c0-4.06-2.71-7.03-6.16-7.03c-3.49,0-6.42,2.97-6.42,7.03c0,4.02,2.93,6.94,6.42,6.94C104.93,33.11,107.64,30.18,107.64,26.16z M120.97,3.06v33.89h-5.07V3.06H120.97z M140.89,29.92l3.93,2.62c-1.27,1.88-4.32,5.11-9.61,5.11c-6.55,0-11.28-5.07-11.28-11.53c0-6.86,4.77-11.53,10.71-11.53c5.98,0,8.91,4.76,9.87,7.34l0.52,1.31l-15.42,6.38c1.18,2.31,3.01,3.49,5.59,3.49C137.79,33.11,139.58,31.84,140.89,29.92zM128.79,25.77l10.31-4.28c-0.57-1.44-2.27-2.45-4.28-2.45C132.24,19.04,128.66,21.31,128.79,25.77z"/> </svg>Publisher Tag </a> </li> </ul> </span> </div> <div class="devsite-top-logo-row-middle"> <div class="devsite-header-upper-tabs"> </div> <devsite-search enable-signin enable-search enable-suggestions enable-query-completion project-name="Google Publisher Tag" tenant-name="Google for Developers" project-scope="/publisher-tag/guides/get-started" url-scoped="https://developers.google.com/s/results/publisher-tag/guides/get-started" > <form class="devsite-search-form" action="https://developers.google.com/s/results" method="GET"> <div class="devsite-search-container"> <button type="button" search-open class="devsite-search-button devsite-header-icon-button button-flat material-icons" aria-label="Open search"></button> <div class="devsite-searchbox"> <input aria-activedescendant="" aria-autocomplete="list" aria-label="Search" aria-expanded="false" aria-haspopup="listbox" autocomplete="off" class="devsite-search-field devsite-search-query" name="q" placeholder="Search" role="combobox" type="text" value="" > <div class="devsite-search-image material-icons" aria-hidden="true"> </div> <div class="devsite-search-shortcut-icon-container" aria-hidden="true"> <kbd class="devsite-search-shortcut-icon">/</kbd> </div> </div> </div> </form> <button type="button" search-close class="devsite-search-button devsite-header-icon-button button-flat material-icons" aria-label="Close search"></button> </devsite-search> </div> <devsite-language-selector> <ul role="presentation"> <li role="presentation"> <a role="menuitem" lang="en" >English</a> </li> <li role="presentation"> <a role="menuitem" lang="de" >Deutsch</a> </li> <li role="presentation"> <a role="menuitem" lang="es" >Español</a> </li> <li role="presentation"> <a role="menuitem" lang="es_419" >Español – América Latina</a> </li> <li role="presentation"> <a role="menuitem" lang="fr" >Français</a> </li> <li role="presentation"> <a role="menuitem" lang="id" >Indonesia</a> </li> <li role="presentation"> <a role="menuitem" lang="it" >Italiano</a> </li> <li role="presentation"> <a role="menuitem" lang="pl" >Polski</a> </li> <li role="presentation"> <a role="menuitem" lang="pt_br" >Português – Brasil</a> </li> <li role="presentation"> <a role="menuitem" lang="vi" >Tiếng Việt</a> </li> <li role="presentation"> <a role="menuitem" lang="tr" >Türkçe</a> </li> <li role="presentation"> <a role="menuitem" lang="ru" >Русский</a> </li> <li role="presentation"> <a role="menuitem" lang="he" >עברית</a> </li> <li role="presentation"> <a role="menuitem" lang="ar" >العربيّة</a> </li> <li role="presentation"> <a role="menuitem" lang="fa" >فارسی</a> </li> <li role="presentation"> <a role="menuitem" lang="hi" >हिंदी</a> </li> <li role="presentation"> <a role="menuitem" lang="bn" >বাংলা</a> </li> <li role="presentation"> <a role="menuitem" lang="th" >ภาษาไทย</a> </li> <li role="presentation"> <a role="menuitem" lang="zh_cn" >中文 – 简体</a> </li> <li role="presentation"> <a role="menuitem" lang="zh_tw" >中文 – 繁體</a> </li> <li role="presentation"> <a role="menuitem" lang="ja" >日本語</a> </li> <li role="presentation"> <a role="menuitem" lang="ko" >한국어</a> </li> </ul> </devsite-language-selector> <devsite-user enable-profiles fp-auth id="devsite-user"> <span class="button devsite-top-button" aria-hidden="true" visually-hidden>Sign in</span> </devsite-user> </div> </div> </div> <div class="devsite-collapsible-section "> <div class="devsite-header-background"> <div class="devsite-doc-set-nav-row"> <devsite-tabs class="lower-tabs"> <nav class="devsite-tabs-wrapper" aria-label="Lower tabs"> <tab > <a href="https://developers.google.com/publisher-tag/guides/get-started" track-metadata-eventdetail="https://developers.google.com/publisher-tag/guides/get-started" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - guides" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Guides" track-name="guides" > Guides </a> </tab> <tab class="devsite-active"> <a href="https://developers.google.com/publisher-tag/reference" track-metadata-eventdetail="https://developers.google.com/publisher-tag/reference" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - reference" track-metadata-module="primary nav" aria-label="Reference, selected" data-category="Site-Wide Custom Events" data-label="Tab: Reference" track-name="reference" > Reference </a> </tab> <tab > <a href="https://developers.google.com/publisher-tag/samples" track-metadata-eventdetail="https://developers.google.com/publisher-tag/samples" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - samples" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Samples" track-name="samples" > Samples </a> </tab> <tab > <a href="https://developers.google.com/publisher-tag/sample-builder" track-metadata-eventdetail="https://developers.google.com/publisher-tag/sample-builder" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - sample builder" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Sample builder" track-name="sample builder" > Sample builder </a> </tab> <tab > <a href="https://developers.google.com/publisher-tag/support/feedback-questions" track-metadata-eventdetail="https://developers.google.com/publisher-tag/support/feedback-questions" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - support" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Support" track-name="support" > Support </a> </tab> </nav> </devsite-tabs> </div> </div> </div> </div> </devsite-header> <devsite-book-nav scrollbars > <div class="devsite-book-nav-filter" > <span class="filter-list-icon material-icons" aria-hidden="true"></span> <input type="text" placeholder="Filter" aria-label="Type to filter" role="searchbox"> <span class="filter-clear-button hidden" data-title="Clear filter" aria-label="Clear filter" role="button" tabindex="0"></span> </div> <nav class="devsite-book-nav devsite-nav nocontent" aria-label="Side menu"> <div class="devsite-mobile-header"> <button type="button" id="devsite-close-nav" class="devsite-header-icon-button button-flat material-icons gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Close navigation" aria-label="Close navigation"> </button> <div class="devsite-product-name-wrapper"> <span class="devsite-product-name"> <ul class="devsite-breadcrumb-list" > <li class="devsite-breadcrumb-item devsite-has-google-wordmark"> <a href="https://developers.google.com/publisher-tag/guides/get-started" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Upper Header" data-value="1" track-type="globalNav" track-name="breadcrumb" track-metadata-position="1" track-metadata-eventdetail="Google Publisher Tag" > <svg class="devsite-google-wordmark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 148 48"> <title>Google</title> <path class="devsite-google-wordmark-svg-path" d="M19.58,37.65c-9.87,0-18.17-8.04-18.17-17.91c0-9.87,8.3-17.91,18.17-17.91c5.46,0,9.35,2.14,12.27,4.94l-3.45,3.45c-2.1-1.97-4.93-3.49-8.82-3.49c-7.21,0-12.84,5.81-12.84,13.02c0,7.21,5.64,13.02,12.84,13.02c4.67,0,7.34-1.88,9.04-3.58c1.4-1.4,2.32-3.41,2.66-6.16H19.58v-4.89h16.47c0.18,0.87,0.26,1.92,0.26,3.06c0,3.67-1.01,8.21-4.24,11.44C28.93,35.9,24.91,37.65,19.58,37.65z M61.78,26.12c0,6.64-5.1,11.53-11.36,11.53s-11.36-4.89-11.36-11.53c0-6.68,5.1-11.53,11.36-11.53S61.78,19.43,61.78,26.12z M56.8,26.12c0-4.15-2.96-6.99-6.39-6.99c-3.43,0-6.39,2.84-6.39,6.99c0,4.11,2.96,6.99,6.39,6.99C53.84,33.11,56.8,30.22,56.8,26.12z M87.25,26.12c0,6.64-5.1,11.53-11.36,11.53c-6.26,0-11.36-4.89-11.36-11.53c0-6.68,5.1-11.53,11.36-11.53C82.15,14.59,87.25,19.43,87.25,26.12zM82.28,26.12c0-4.15-2.96-6.99-6.39-6.99c-3.43,0-6.39,2.84-6.39,6.99c0,4.11,2.96,6.99,6.39,6.99C79.32,33.11,82.28,30.22,82.28,26.12z M112.09,15.29v20.7c0,8.52-5.02,12.01-10.96,12.01c-5.59,0-8.95-3.76-10.22-6.81l4.41-1.83c0.79,1.88,2.71,4.1,5.81,4.1c3.8,0,6.16-2.36,6.16-6.77v-1.66h-0.18c-1.14,1.4-3.32,2.62-6.07,2.62c-5.76,0-11.05-5.02-11.05-11.49c0-6.51,5.28-11.57,11.05-11.57c2.75,0,4.93,1.22,6.07,2.58h0.18v-1.88H112.09z M107.64,26.16c0-4.06-2.71-7.03-6.16-7.03c-3.49,0-6.42,2.97-6.42,7.03c0,4.02,2.93,6.94,6.42,6.94C104.93,33.11,107.64,30.18,107.64,26.16z M120.97,3.06v33.89h-5.07V3.06H120.97z M140.89,29.92l3.93,2.62c-1.27,1.88-4.32,5.11-9.61,5.11c-6.55,0-11.28-5.07-11.28-11.53c0-6.86,4.77-11.53,10.71-11.53c5.98,0,8.91,4.76,9.87,7.34l0.52,1.31l-15.42,6.38c1.18,2.31,3.01,3.49,5.59,3.49C137.79,33.11,139.58,31.84,140.89,29.92zM128.79,25.77l10.31-4.28c-0.57-1.44-2.27-2.45-4.28-2.45C132.24,19.04,128.66,21.31,128.79,25.77z"/> </svg>Publisher Tag </a> </li> </ul> </span> </div> </div> <div class="devsite-book-nav-wrapper"> <div class="devsite-mobile-nav-top"> <ul class="devsite-nav-list"> <li class="devsite-nav-item"> <a href="/publisher-tag/guides/get-started" class="devsite-nav-title gc-analytics-event devsite-nav-has-children " data-category="Site-Wide Custom Events" data-label="Tab: Guides" track-name="guides" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Guides" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Guides </span> <span class="devsite-nav-icon material-icons" data-icon="forward" > </span> </a> </li> <li class="devsite-nav-item"> <a href="/publisher-tag/reference" class="devsite-nav-title gc-analytics-event devsite-nav-has-children devsite-nav-active" data-category="Site-Wide Custom Events" data-label="Tab: Reference" track-name="reference" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Reference" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Reference </span> <span class="devsite-nav-icon material-icons" data-icon="forward" > </span> </a> </li> <li class="devsite-nav-item"> <a href="/publisher-tag/samples" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Samples" track-name="samples" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Samples" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Samples </span> </a> </li> <li class="devsite-nav-item"> <a href="/publisher-tag/sample-builder" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Sample builder" track-name="sample builder" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Sample builder" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Sample builder </span> </a> </li> <li class="devsite-nav-item"> <a href="/publisher-tag/support/feedback-questions" class="devsite-nav-title gc-analytics-event devsite-nav-has-children " data-category="Site-Wide Custom Events" data-label="Tab: Support" track-name="support" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Support" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Support </span> <span class="devsite-nav-icon material-icons" data-icon="forward" > </span> </a> </li> </ul> </div> <div class="devsite-mobile-nav-bottom"> <ul class="devsite-nav-list" menu="_book"> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>GPT</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/publisher-tag/reference" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /publisher-tag/reference" track-type="bookNav" track-name="click" track-metadata-eventdetail="/publisher-tag/reference" ><span class="devsite-nav-text" tooltip>GPT reference</span></a></li><li class="devsite-nav-item"><a href="/publisher-tag/release-notes" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /publisher-tag/release-notes" track-type="bookNav" track-name="click" track-metadata-eventdetail="/publisher-tag/release-notes" ><span class="devsite-nav-text" tooltip>GPT release notes</span></a></li><li class="devsite-nav-item"><a href="/publisher-tag/versions" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /publisher-tag/versions" track-type="bookNav" track-name="click" track-metadata-eventdetail="/publisher-tag/versions" ><span class="devsite-nav-text" tooltip>GPT version history</span></a></li><li class="devsite-nav-item"><a href="/publisher-tag/adsense_attributes" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /publisher-tag/adsense_attributes" track-type="bookNav" track-name="click" track-metadata-eventdetail="/publisher-tag/adsense_attributes" ><span class="devsite-nav-text" tooltip>AdSense attributes in GPT</span></a></li></ul></div></li> </ul> </div> </div> </nav> </devsite-book-nav> <section id="gc-wrapper"> <main role="main" class="devsite-main-content" has-book-nav > <devsite-content> <article class="devsite-article"> <div class="devsite-article-meta nocontent" role="navigation"> <ul class="devsite-breadcrumb-list" aria-label="Breadcrumb"> <li class="devsite-breadcrumb-item "> <a href="https://developers.google.com/" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="1" track-type="globalNav" track-name="breadcrumb" track-metadata-position="1" track-metadata-eventdetail="" > Home </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://developers.google.com/products" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="2" track-type="globalNav" track-name="breadcrumb" track-metadata-position="2" track-metadata-eventdetail="" > Products </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://developers.google.com/publisher-tag/guides/get-started" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="3" track-type="globalNav" track-name="breadcrumb" track-metadata-position="3" track-metadata-eventdetail="Google Publisher Tag" > Google Publisher Tag </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://developers.google.com/publisher-tag/reference" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="4" track-type="globalNav" track-name="breadcrumb" track-metadata-position="4" track-metadata-eventdetail="" > Reference </a> </li> </ul> <devsite-thumb-rating position="header"> </devsite-thumb-rating> </div> <devsite-feedback position="header" project-name="Google Publisher Tag" product-id="102150" bucket="" context="" version="t-devsite-webserver-20241114-r00-rc02.464922260396498922" data-label="Send Feedback Button" track-type="feedback" track-name="sendFeedbackLink" track-metadata-position="header" class="nocontent" project-feedback-url="https://support.google.com/admanager" project-icon="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/developers/images/touchicon-180-new.png" > <button> Send feedback </button> </devsite-feedback> <h1 class="devsite-page-title" tabindex="-1"> GPT Reference </h1> <devsite-feature-tooltip ack-key="AckCollectionsBookmarkTooltipDismiss" analytics-category="Site-Wide Custom Events" analytics-action-show="Callout Profile displayed" analytics-action-close="Callout Profile dismissed" analytics-label="Create Collection Callout" class="devsite-page-bookmark-tooltip nocontent" dismiss-button="true" id="devsite-collections-dropdown" dismiss-button-text="Dismiss" close-button-text="Got it"> <devsite-bookmark></devsite-bookmark> <span slot="popout-heading"> Stay organized with collections </span> <span slot="popout-contents"> Save and categorize content based on your preferences. </span> </devsite-feature-tooltip> <div class="devsite-page-title-meta"><devsite-view-release-notes></devsite-view-release-notes></div> <devsite-toc class="devsite-nav" depth="2" devsite-toc-embedded > </devsite-toc> <div class="devsite-article-body clearfix "> <section> <p> This reference uses TypeScript notation to describe types. The following table provides a brief explanation by example. </p> <table class="responsive fixed"> <colgroup> <col width="33%"> <col> </colgroup> <tr> <th colspan="2">Type expression</th> </tr> <tr> <td><code translate="no" dir="ltr">string</code></td> <td>The primitive string type.</td> </tr> <tr> <td><code translate="no" dir="ltr">string[]</code></td> <td>An array type, where values may only be strings.</td> </tr> <tr> <td><code translate="no" dir="ltr">number | string</code></td> <td>A union type, where the value may be either a number or a string.</td> </tr> <tr> <td><code translate="no" dir="ltr">Array&lt;number | string&gt;</code></td> <td>An array type, where values are a complex (union) type.</td> </tr> <tr> <td><code translate="no" dir="ltr">[number, string]</code></td> <td>A tuple type, where the value is a two-element array that must contain a number and a string in that order.</td> </tr> <tr> <td><code translate="no" dir="ltr"><a href="#googletag.Slot">Slot</a></code></td> <td>An object type, where the value is an instance of <code translate="no" dir="ltr">googletag.Slot</code>.</td> </tr> <tr> <td><code translate="no" dir="ltr">() => void</code></td> <td>A function type with no defined arguments and no return value.</td> </tr> </table> <p> To learn more about supported types and type expressions, refer to the <a class="external" href="https://www.typescriptlang.org/docs/handbook/intro.html"> TypeScript Handbook </a>. </p> <h4 id="type-annotations" data-text="Type annotations" tabindex="-1">Type annotations</h4> <p> A colon after a variable, parameter name, property name, or function signature denotes a type annotation. Type annotations describe the types the element to the left of the colon can accept or return. The following table shows examples of type annotations you may see in this reference. </p> <table class="responsive fixed"> <colgroup> <col width="33%"> <col> </colgroup> <tr> <th colspan="2">Type annotation</th> </tr> <tr> <td><code translate="no" dir="ltr">param: string</code></td> <td> Indicates that <code translate="no" dir="ltr">param</code> accepts or returns a string value. This syntax is used for variables, parameters, properties, and return types. </td> </tr> <tr> <td><code translate="no" dir="ltr">param?: number | string</code></td> <td> Indicates that <code translate="no" dir="ltr">param</code> is optional, but accepts either a number or a string when specified. This syntax is used for parameters and properties. </td> </tr> <tr> <td><code translate="no" dir="ltr">...params: Array&lt;() => void&gt;</code></td> <td> Indicates that <code translate="no" dir="ltr">params</code> is a <a class="external" href="https://www.typescriptlang.org/docs/handbook/2/functions.html#rest-parameters"> rest parameter </a> that accepts functions. Rest parameters accept an unbounded number of values of the specified type. </td> </tr> </table> </section> <hr/><section><h2 id="googletag" data-text="googletag" tabindex="-1">googletag</h2><div>The global namespace the Google Publisher Tag uses for its API.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Namespaces</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config"><span>config<wbr/></span><span></span></a></code></td><td><div>Main configuration interface for page-level settings.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.enums"><span>enums<wbr/></span><span></span></a></code></td><td><div>This is the namespace that GPT uses for enum types.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events"><span>events<wbr/></span><span></span></a></code></td><td><div>This is the namespace that GPT uses for Events.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.secureSignals"><span>secure<wbr/>Signals<wbr/></span><span></span></a></code></td><td><div>This is the namespace that GPT uses for managing secure signals.</div></td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Interfaces</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.CommandArray"><span>Command<wbr/>Array<wbr/></span><span></span></a></code></td><td><div>The command array accepts a sequence of functions and invokes them in order.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.CompanionAdsService"><span>Companion<wbr/>Ads<wbr/>Service<wbr/></span><span></span></a></code></td><td><div>Companion Ads service.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PrivacySettingsConfig"><span>Privacy<wbr/>Settings<wbr/>Config<wbr/></span><span></span></a></code></td><td><div>Configuration object for privacy settings.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService"><span>Pub<wbr/>Ads<wbr/>Service<wbr/></span><span></span></a></code></td><td><div>Publisher Ads service.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.ResponseInformation"><span>Response<wbr/>Information<wbr/></span><span></span></a></code></td><td><div>An object representing a single ad response.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.RewardedPayload"><span>Rewarded<wbr/>Payload<wbr/></span><span></span></a></code></td><td><div>An object representing the reward associated with a <a href="https://support.google.com/admanager/answer/9116812">rewarded ad</a>.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.SafeFrameConfig"><span>Safe<wbr/>Frame<wbr/>Config<wbr/></span><span></span></a></code></td><td><div>Configuration object for <a href="https://support.google.com/admanager/answer/6023110">SafeFrame</a> containers.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Service"><span>Service<wbr/></span><span></span></a></code></td><td><div>Base service class that contains methods common for all services.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.SizeMappingBuilder"><span>Size<wbr/>Mapping<wbr/>Builder<wbr/></span><span></span></a></code></td><td><div>Builder for size mapping specification objects.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot"><span>Slot<wbr/></span><span></span></a></code></td><td><div>Slot is an object representing a single ad slot on a page.</div></td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Type Aliases</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.GeneralSize"><span>General<wbr/>Size<wbr/></span><span></span></a></code></td><td><div>A valid size configuration for a slot, which can be one or multiple sizes.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.MultiSize"><span>Multi<wbr/>Size<wbr/></span><span></span></a></code></td><td><div>A list of single valid sizes.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.NamedSize"><span>Named<wbr/>Size<wbr/></span><span></span></a></code></td><td><div>Named sizes that a slot can have.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.SingleSize"><span>Single<wbr/>Size<wbr/></span><span></span></a></code></td><td><div>A single valid size for a slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.SingleSizeArray"><span>Single<wbr/>Size<wbr/>Array<wbr/></span><span></span></a></code></td><td><div>Array of two numbers representing [width, height].</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.SizeMapping"><span>Size<wbr/>Mapping<wbr/></span><span></span></a></code></td><td><div>A mapping of viewport size to ad sizes.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.SizeMappingArray"><span>Size<wbr/>Mapping<wbr/>Array<wbr/></span><span></span></a></code></td><td><div>A list of size mappings.</div></td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Variables</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.apiReady"><span>api<wbr/>Ready<wbr/></span><span></span></a></code></td><td><div>Flag indicating that the GPT API is loaded and ready to be called.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.cmd"><span>cmd<wbr/></span><span></span></a></code></td><td><div>Reference to the global command queue for asynchronous execution of GPT-related calls.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.pubadsReady"><span>pubads<wbr/>Ready<wbr/></span><span></span></a></code></td><td><div>Flag indicating that <a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a> is enabled, loaded and fully operational.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.secureSignalProviders"><span>secure<wbr/>Signal<wbr/>Providers<wbr/></span><span></span></a></code></td><td><div>Reference to the secure signal providers array.</div></td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Functions</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.companionAds"><span>companion<wbr/>Ads<wbr/></span><span></span></a></code></td><td><div>Returns a reference to the <a href="/publisher-tag/reference#googletag.CompanionAdsService">CompanionAdsService</a>.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.defineOutOfPageSlot"><span>define<wbr/>Out<wbr/>Of<wbr/>Page<wbr/>Slot<wbr/></span><span></span></a></code></td><td><div>Constructs an out-of-page ad slot with the given ad unit path.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.defineSlot"><span>define<wbr/>Slot<wbr/></span><span></span></a></code></td><td><div>Constructs an ad slot with a given ad unit path and size and associates it with the ID of a div element on the page that will contain the ad.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.destroySlots"><span>destroy<wbr/>Slots<wbr/></span><span></span></a></code></td><td><div>Destroys the given slots, removing all related objects and references of those slots from GPT.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.disablePublisherConsole"><span>disable<wbr/>Publisher<wbr/>Console<wbr/></span><span></span></a></code></td><td><div>Disables the Google Publisher Console.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.display"><span>display<wbr/></span><span></span></a></code></td><td><div>Instructs slot services to render the slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.enableServices"><span>enable<wbr/>Services<wbr/></span><span></span></a></code></td><td><div>Enables all GPT services that have been defined for ad slots on the page.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.getVersion"><span>get<wbr/>Version<wbr/></span><span></span></a></code></td><td><div>Returns the current version of GPT.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.openConsole"><span>open<wbr/>Console<wbr/></span><span></span></a></code></td><td><div>Opens the Google Publisher Console.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.pubads"><span>pubads<wbr/></span><span></span></a></code></td><td><div>Returns a reference to the <a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a>.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.setAdIframeTitle"><span>set<wbr/>Ad<wbr/>Iframe<wbr/>Title<wbr/></span><span></span></a></code></td><td><div>Sets the title for all ad container iframes created by <a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a>, from this point onwards.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.setConfig"><span>set<wbr/>Config<wbr/></span><span></span></a></code></td><td><div>Sets general configuration options for the page.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.sizeMapping"><span>size<wbr/>Mapping<wbr/></span><span></span></a></code></td><td><div>Creates a new <a href="/publisher-tag/reference#googletag.SizeMappingBuilder">SizeMappingBuilder</a>.</div></td></tr></table></section><section></section><section><h3 class="hide-from-toc" id="googletag_Type Aliases" data-text="Type Aliases" tabindex="-1">Type Aliases</h3><section><hr/><h4 id="googletag.GeneralSize" data-text="GeneralSize" tabindex="-1"><a id="googletag_GeneralSize"></a><span>GeneralSize</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>GeneralSize</span><span>:</span> <a href="/publisher-tag/reference#googletag.SingleSize">SingleSize</a><span> | </span><a href="/publisher-tag/reference#googletag.MultiSize">MultiSize</a></code></div><p>A valid size configuration for a slot, which can be one or multiple sizes.</p></ul></section><section><hr/><h4 id="googletag.MultiSize" data-text="MultiSize" tabindex="-1"><a id="googletag_MultiSize"></a><span>MultiSize</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>MultiSize</span><span>:</span> <a href="/publisher-tag/reference#googletag.SingleSize">SingleSize</a><span>[]</span></code></div><p>A list of single valid sizes.</p></ul></section><section><hr/><h4 id="googletag.NamedSize" data-text="NamedSize" tabindex="-1"><a id="googletag_NamedSize"></a><span>NamedSize</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>NamedSize</span><span>:</span> <span>&quot;fluid&quot;</span><span> | </span><span>[</span><span>&quot;fluid&quot;</span><span>]</span></code></div><p>Named sizes that a slot can have. In most cases size is a fixed-size rectangle but there are some cases when we need other kinds of size specifications. Only the following are valid named sizes:<ul> <li><strong>fluid</strong>: the ad container takes 100% width of parent div and then resizes its height to fit creative content. Similar to how regular block elements on a page behave. Used for native ads (see <a href="https://support.google.com/admanager/answer/6366845">related article</a>). Note that both <code translate="no" dir="ltr">fluid</code> and <code translate="no" dir="ltr">[&#39;fluid&#39;]</code> are acceptable forms to declare a slot size as fluid.</li> </ul></p></ul></section><section><hr/><h4 id="googletag.SingleSize" data-text="SingleSize" tabindex="-1"><a id="googletag_SingleSize"></a><span>SingleSize</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>SingleSize</span><span>:</span> <a href="/publisher-tag/reference#googletag.SingleSizeArray">SingleSizeArray</a><span> | </span><a href="/publisher-tag/reference#googletag.NamedSize">NamedSize</a></code></div><p>A single valid size for a slot.</p></ul></section><section><hr/><h4 id="googletag.SingleSizeArray" data-text="SingleSizeArray" tabindex="-1"><a id="googletag_SingleSizeArray"></a><span>SingleSizeArray</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>SingleSizeArray</span><span>:</span> <span>[</span><span>number</span><span>, </span><span>number</span><span>]</span></code></div><p>Array of two numbers representing [width, height].</p></ul></section><section><hr/><h4 id="googletag.SizeMapping" data-text="SizeMapping" tabindex="-1"><a id="googletag_SizeMapping"></a><span>SizeMapping</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>SizeMapping</span><span>:</span> <span>[</span><a href="/publisher-tag/reference#googletag.SingleSizeArray">SingleSizeArray</a><span>, </span><a href="/publisher-tag/reference#googletag.GeneralSize">GeneralSize</a><span>]</span></code></div><p>A mapping of viewport size to ad sizes. Used for responsive ads.</p></ul></section><section><hr/><h4 id="googletag.SizeMappingArray" data-text="SizeMappingArray" tabindex="-1"><a id="googletag_SizeMappingArray"></a><span>SizeMappingArray</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>SizeMappingArray</span><span>:</span> <a href="/publisher-tag/reference#googletag.SizeMapping">SizeMapping</a><span>[]</span></code></div><p>A list of size mappings.</p></ul></section></section><section><h3 class="hide-from-toc" id="googletag_Variables" data-text="Variables" tabindex="-1">Variables</h3><section><hr/><h4 id="googletag.apiReady" data-text="Const apiReady" tabindex="-1"><a id="googletag_apiReady"></a><code translate="no" dir="ltr">Const</code> <span>apiReady</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>apiReady</span><span>:</span> <span>boolean</span><span> | </span><span>undefined</span></code></div><p>Flag indicating that the GPT API is loaded and ready to be called. This property will be simply <code translate="no" dir="ltr">undefined</code> until the API is ready.<br><br>Note that the recommended way of handling async is to use <a href="/publisher-tag/reference#googletag.cmd">googletag.cmd</a> to queue callbacks for when GPT is ready. These callbacks do not have to check googletag.apiReady as they are guaranteed to execute once the API is set up.</p></ul></section><section><hr/><h4 id="googletag.cmd" data-text="Const cmd" tabindex="-1"><a id="googletag_cmd"></a><code translate="no" dir="ltr">Const</code> <span>cmd</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>cmd</span><span>:</span> <span>(</span><span>(</span><span>this</span><span>: </span><span>typeof </span><span>globalThis</span><span>)</span><span> =&gt; </span><span>void</span><span>)</span><span>[]</span><span> | </span><a href="/publisher-tag/reference#googletag.CommandArray">CommandArray</a></code></div><p>Reference to the global command queue for asynchronous execution of GPT-related calls.<br><br>The <code translate="no" dir="ltr">googletag.cmd</code> variable is initialized to an empty JavaScript array by the GPT tag syntax on the page, and <code translate="no" dir="ltr">cmd.push</code> is the standard <code translate="no" dir="ltr">Array.push</code> method that adds an element to the end of the array. When the GPT JavaScript is loaded, it looks through the array and executes all the functions in order. The script then replaces <code translate="no" dir="ltr">cmd</code> with a <a href="/publisher-tag/reference#googletag.CommandArray">CommandArray</a> object whose push method is defined to execute the function argument passed to it. This mechanism allows GPT to reduce perceived latency by fetching the JavaScript asynchronously while allowing the browser to continue rendering the page.</p><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.cmd.push(() =&gt; { googletag.defineSlot(&quot;/1234567/sports&quot;, [160, 600]).addService(googletag.pubads()); }); </pre></section><section><h3 id="javascript-legacy" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.cmd.push(function () { googletag.defineSlot(&quot;/1234567/sports&quot;, [160, 600]).addService(googletag.pubads()); }); </pre></section><section><h3 id="typescript" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.cmd.push(() =&gt; { googletag.defineSlot(&quot;/1234567/sports&quot;, [160, 600])!.addService(googletag.pubads()); }); </pre></section></devsite-selector></dd></dl></ul></section><section><hr/><h4 id="googletag.pubadsReady" data-text="Const pubadsReady" tabindex="-1"><a id="googletag_pubadsReady"></a><code translate="no" dir="ltr">Const</code> <span>pubadsReady</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>pubadsReady</span><span>:</span> <span>boolean</span><span> | </span><span>undefined</span></code></div><p>Flag indicating that <a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a> is enabled, loaded and fully operational. This property will be simply <code translate="no" dir="ltr">undefined</code> until <a href="/publisher-tag/reference#googletag.enableServices">enableServices</a> is called and <a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a> is loaded and initialized.</p></ul></section><section><hr/><h4 id="googletag.secureSignalProviders" data-text="secureSignalProviders" tabindex="-1"><a id="googletag_secureSignalProviders"></a><span>secureSignalProviders</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>secureSignalProviders</span><span>:</span> <a href="/publisher-tag/reference#googletag.secureSignals.SecureSignalProvider">SecureSignalProvider</a><span>[]</span><span> | </span><a href="/publisher-tag/reference#googletag.secureSignals.SecureSignalProvidersArray">SecureSignalProvidersArray</a><span> | </span><span>undefined</span></code></div><p>Reference to the secure signal providers array.<br><br>The secure signal providers array accepts a sequence of signal-generating functions and invokes them in order. It is intended to replace a standard array that is used to enqueue signal-generating functions to be invoked once GPT is loaded.</p><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_1" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">window.googletag = window.googletag || { cmd: [] }; googletag.secureSignalProviders = googletag.secureSignalProviders || []; googletag.secureSignalProviders.push({ id: &quot;collector123&quot;, collectorFunction: () =&gt; { return Promise.resolve(&quot;signal&quot;); }, }); </pre></section><section><h3 id="javascript-legacy_1" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">window.googletag = window.googletag || { cmd: [] }; googletag.secureSignalProviders = googletag.secureSignalProviders || []; googletag.secureSignalProviders.push({ id: &quot;collector123&quot;, collectorFunction: function () { return Promise.resolve(&quot;signal&quot;); }, }); </pre></section><section><h3 id="typescript_1" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">window.googletag = window.googletag || { cmd: [] }; googletag.secureSignalProviders = googletag.secureSignalProviders || []; googletag.secureSignalProviders.push({ id: &quot;collector123&quot;, collectorFunction: () =&gt; { return Promise.resolve(&quot;signal&quot;); }, }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://support.google.com/admanager/answer/10488752">Share secure signals with bidders</a></li></ul></dd></dl></ul></section></section><section><h3 class="hide-from-toc" id="googletag_Functions" data-text="Functions" tabindex="-1">Functions</h3><section><hr/><h4 id="googletag.companionAds" data-text="companionAds" tabindex="-1"><a id="googletag_companionAds"></a><span>companionAds</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>companionAds</span><span>(</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.CompanionAdsService">CompanionAdsService</a></code><p>Returns a reference to the <a href="/publisher-tag/reference#googletag.CompanionAdsService">CompanionAdsService</a>.<table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.CompanionAdsService">CompanionAdsService</a></code></td><td>The Companion Ads service.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.defineOutOfPageSlot" data-text="defineOutOfPageSlot" tabindex="-1"><a id="googletag_defineOutOfPageSlot"></a><span>defineOutOfPageSlot</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>defineOutOfPageSlot</span><span>(</span><span>adUnitPath</span><span>: </span><span>string</span>, <span>div</span><span>?: </span><span>string</span><span> | </span><a href="/publisher-tag/reference#googletag.enums.OutOfPageFormat">OutOfPageFormat</a><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a><span> | </span><span>null</span></code><p>Constructs an out-of-page ad slot with the given ad unit path.<br><br>For custom out-of-page ads, <code translate="no" dir="ltr">div</code> is the ID of the div element that will contain the ad. See the article on <a href="https://support.google.com/admanager/answer/6088046">out-of-page creatives</a> for more details.<br><br>For GPT managed out-of-page ads, <code translate="no" dir="ltr">div</code> is a supported <a href="/publisher-tag/reference#googletag.enums.OutOfPageFormat">OutOfPageFormat</a>.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_2" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Define a custom out-of-page ad slot. googletag.defineOutOfPageSlot(&quot;/1234567/sports&quot;, &quot;div-1&quot;); // Define a GPT managed web interstitial ad slot. googletag.defineOutOfPageSlot(&quot;/1234567/sports&quot;, googletag.enums.OutOfPageFormat.INTERSTITIAL); </pre></section><section><h3 id="javascript-legacy_2" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// Define a custom out-of-page ad slot. googletag.defineOutOfPageSlot(&quot;/1234567/sports&quot;, &quot;div-1&quot;); // Define a GPT managed web interstitial ad slot. googletag.defineOutOfPageSlot(&quot;/1234567/sports&quot;, googletag.enums.OutOfPageFormat.INTERSTITIAL); </pre></section><section><h3 id="typescript_2" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Define a custom out-of-page ad slot. googletag.defineOutOfPageSlot(&quot;/1234567/sports&quot;, &quot;div-1&quot;); // Define a GPT managed web interstitial ad slot. googletag.defineOutOfPageSlot(&quot;/1234567/sports&quot;, googletag.enums.OutOfPageFormat.INTERSTITIAL); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul> <li><a href="https://developers.google.com/publisher-tag/samples/display-rewarded-ad">Display a rewarded ad</a></li> <li><a href="https://developers.google.com/publisher-tag/samples/display-web-interstitial-ad">Display a web interstitial ad</a></li> <li><a href="https://developers.google.com/publisher-tag/samples/display-anchor-ad">Display an anchor ad</a></li> <li><a href="https://developers.google.com/publisher-tag/samples/display-out-of-page-ad">Display an out-of-page ad</a></li> </ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>adUnitPath</span>: <span>string</span></code></td><td>Full <a href="https://developers.google.com/publisher-tag/guides/get-started#ad-unit-path">ad unit path</a> with the network code and ad unit code.</td></tr><tr><td><code translate="no" dir="ltr"><code translate="no" dir="ltr">Optional</code> <span>div</span>: <span>string</span><span> | </span><a href="/publisher-tag/reference#googletag.enums.OutOfPageFormat">OutOfPageFormat</a></code></td><td>ID of the div that will contain this ad unit or OutOfPageFormat.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot">Slot</a><span> | </span><span>null</span></code></td><td>The newly created slot, or <code translate="no" dir="ltr">null</code> if a slot cannot be created.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.defineSlot" data-text="defineSlot" tabindex="-1"><a id="googletag_defineSlot"></a><span>defineSlot</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>defineSlot</span><span>(</span><span>adUnitPath</span><span>: </span><span>string</span>, <span>size</span><span>: </span><a href="/publisher-tag/reference#googletag.GeneralSize">GeneralSize</a>, <span>div</span><span>?: </span><span>string</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a><span> | </span><span>null</span></code><p>Constructs an ad slot with a given ad unit path and size and associates it with the ID of a div element on the page that will contain the ad.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_3" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.defineSlot(&quot;/1234567/sports&quot;, [728, 90], &quot;div-1&quot;); </pre></section><section><h3 id="javascript-legacy_3" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.defineSlot(&quot;/1234567/sports&quot;, [728, 90], &quot;div-1&quot;); </pre></section><section><h3 id="typescript_3" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.defineSlot(&quot;/1234567/sports&quot;, [728, 90], &quot;div-1&quot;); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/guides/get-started">Get Started with Google Publisher Tags</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>adUnitPath</span>: <span>string</span></code></td><td>Full <a href="https://developers.google.com/publisher-tag/guides/get-started#ad-unit-path">ad unit path</a> with the network code and unit code.</td></tr><tr><td><code translate="no" dir="ltr"><span>size</span>: <a href="/publisher-tag/reference#googletag.GeneralSize">GeneralSize</a></code></td><td>Width and height of the added slot. This is the size that is used in the ad request if no responsive size mapping is provided or the size of the viewport is smaller than the smallest size provided in the mapping.</td></tr><tr><td><code translate="no" dir="ltr"><code translate="no" dir="ltr">Optional</code> <span>div</span>: <span>string</span></code></td><td>ID of the div that will contain this ad unit.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot">Slot</a><span> | </span><span>null</span></code></td><td>The newly created slot, or <code translate="no" dir="ltr">null</code> if a slot cannot be created.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.destroySlots" data-text="destroySlots" tabindex="-1"><a id="googletag_destroySlots"></a><span>destroySlots</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>destroySlots</span><span>(</span><span>slots</span><span>?: </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a><span>[]</span><span>)</span><span>: </span><span>boolean</span></code><p>Destroys the given slots, removing all related objects and references of those slots from GPT. This API does not support passback slots and companion slots.<br><br>Calling this API on a slot clears the ad and removes the slot object from the internal state maintained by GPT. Calling any more functions on the slot object will result in undefined behavior. Note the browser may still not free the memory associated with that slot if a reference to it is maintained by the publisher page. Calling this API makes the div associated with that slot available for reuse.<br><br>In particular, destroying a slot removes the ad from GPT&#39;s <a href="https://support.google.com/admanager/answer/183281">long-lived pageview</a>, so future requests will not be influenced by roadblocks or competitive exclusions involving this ad. Failure to call this function before removing a slot&#39;s div from the page will result in undefined behavior.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_4" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// The calls to construct an ad and display contents. const slot1 = googletag.defineSlot(&quot;/1234567/sports&quot;, [728, 90], &quot;div-1&quot;); googletag.display(&quot;div-1&quot;); const slot2 = googletag.defineSlot(&quot;/1234567/news&quot;, [160, 600], &quot;div-2&quot;); googletag.display(&quot;div-2&quot;); // This call to destroy only slot1. googletag.destroySlots([slot1]); // This call to destroy both slot1 and slot2. googletag.destroySlots([slot1, slot2]); // This call to destroy all slots. googletag.destroySlots(); </pre></section><section><h3 id="javascript-legacy_4" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// The calls to construct an ad and display contents. var slot1 = googletag.defineSlot(&quot;/1234567/sports&quot;, [728, 90], &quot;div-1&quot;); googletag.display(&quot;div-1&quot;); var slot2 = googletag.defineSlot(&quot;/1234567/news&quot;, [160, 600], &quot;div-2&quot;); googletag.display(&quot;div-2&quot;); // This call to destroy only slot1. googletag.destroySlots([slot1]); // This call to destroy both slot1 and slot2. googletag.destroySlots([slot1, slot2]); // This call to destroy all slots. googletag.destroySlots(); </pre></section><section><h3 id="typescript_4" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// The calls to construct an ad and display contents. const slot1 = googletag.defineSlot(&quot;/1234567/sports&quot;, [728, 90], &quot;div-1&quot;)!; googletag.display(&quot;div-1&quot;); const slot2 = googletag.defineSlot(&quot;/1234567/news&quot;, [160, 600], &quot;div-2&quot;)!; googletag.display(&quot;div-2&quot;); // This call to destroy only slot1. googletag.destroySlots([slot1]); // This call to destroy both slot1 and slot2. googletag.destroySlots([slot1, slot2]); // This call to destroy all slots. googletag.destroySlots(); </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><code translate="no" dir="ltr">Optional</code> <span>slots</span>: <a href="/publisher-tag/reference#googletag.Slot">Slot</a><span>[]</span></code></td><td>The array of slots to destroy. Array is optional; all slots will be destroyed if it is unspecified.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>boolean</span></code></td><td><code translate="no" dir="ltr">true</code> if slots have been destroyed, <code translate="no" dir="ltr">false</code> otherwise.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.disablePublisherConsole" data-text="disablePublisherConsole" tabindex="-1"><a id="googletag_disablePublisherConsole"></a><span>disablePublisherConsole</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>disablePublisherConsole</span><span>(</span><span>)</span><span>: </span><span>void</span></code><p>Disables the Google Publisher Console.<dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/guides/publisher-console">Google Publisher Console</a></li></ul></dd></dl></p></ul></section><section><hr/><h4 id="googletag.display" data-text="display" tabindex="-1"><a id="googletag_display"></a><span>display</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>display</span><span>(</span><span>divOrSlot</span><span>: </span><span>string</span><span> | </span><span>Element</span><span> | </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a><span>)</span><span>: </span><span>void</span></code><p>Instructs slot services to render the slot. Each ad slot should only be displayed once per page. All slots must be defined and have a service associated with them before being displayed. The display call must not happen until the element is present in the DOM. The usual way to achieve that is to place it within a script block within the div element named in the method call.<br><br>If single request architecture (SRA) is being used, all unfetched ad slots at the time this method is called will be fetched at once. To force an ad slot not to display, the entire div must be removed.<dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul> <li><a href="https://developers.google.com/publisher-tag/guides/get-started">Get Started with Google Publisher Tags</a></li> <li><a href="https://developers.google.com/publisher-tag/samples/display-test-ad">Display a test ad</a></li> <li><a href="https://developers.google.com/publisher-tag/guides/control-ad-loading">Control ad loading and refresh</a></li> </ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>divOrSlot</span>: <span>string</span><span> | </span><span>Element</span><span> | </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code></td><td>Either the ID of the div element containing the ad slot or the div element, or the slot object. If a div element is provided, it must have an &#39;id&#39; attribute which matches the ID passed into <a href="/publisher-tag/reference#googletag.defineSlot">defineSlot</a>.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.enableServices" data-text="enableServices" tabindex="-1"><a id="googletag_enableServices"></a><span>enableServices</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>enableServices</span><span>(</span><span>)</span><span>: </span><span>void</span></code><p>Enables all GPT services that have been defined for ad slots on the page.</p></ul></section><section><hr/><h4 id="googletag.getVersion" data-text="getVersion" tabindex="-1"><a id="googletag_getVersion"></a><span>getVersion</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>getVersion</span><span>(</span><span>)</span><span>: </span><span>string</span></code><p>Returns the current version of GPT.<dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/versions">GPT version history</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>string</span></code></td><td>The currently executing GPT version string.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.openConsole" data-text="openConsole" tabindex="-1"><a id="googletag_openConsole"></a><span>openConsole</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>openConsole</span><span>(</span><span>div</span><span>?: </span><span>string</span><span>)</span><span>: </span><span>void</span></code><p>Opens the Google Publisher Console.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_5" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Calling with div ID. googletag.openConsole(&quot;div-1&quot;); // Calling without div ID. googletag.openConsole(); </pre></section><section><h3 id="javascript-legacy_5" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// Calling with div ID. googletag.openConsole(&quot;div-1&quot;); // Calling without div ID. googletag.openConsole(); </pre></section><section><h3 id="typescript_5" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Calling with div ID. googletag.openConsole(&quot;div-1&quot;); // Calling without div ID. googletag.openConsole(); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/guides/publisher-console">Google Publisher Console</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><code translate="no" dir="ltr">Optional</code> <span>div</span>: <span>string</span></code></td><td>An ad slot div ID. This value is optional. When provided, the Publisher Console will attempt to open with details of the specified ad slot in view.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.pubads" data-text="pubads" tabindex="-1"><a id="googletag_pubads"></a><span>pubads</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>pubads</span><span>(</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code><p>Returns a reference to the <a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a>.<table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code></td><td>The Publisher Ads service.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.setAdIframeTitle" data-text="setAdIframeTitle" tabindex="-1"><a id="googletag_setAdIframeTitle"></a><span>setAdIframeTitle</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>setAdIframeTitle</span><span>(</span><span>title</span><span>: </span><span>string</span><span>)</span><span>: </span><span>void</span></code><p>Sets the title for all ad container iframes created by <a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a>, from this point onwards.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_6" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.setAdIframeTitle(&quot;title&quot;); </pre></section><section><h3 id="javascript-legacy_6" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.setAdIframeTitle(&quot;title&quot;); </pre></section><section><h3 id="typescript_6" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.setAdIframeTitle(&quot;title&quot;); </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>title</span>: <span>string</span></code></td><td>The new title for all ad container iframes.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.setConfig" data-text="setConfig" tabindex="-1"><a id="googletag_setConfig"></a><span>setConfig</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>setConfig</span><span>(</span><span>config</span><span>: </span><a href="/publisher-tag/reference#googletag.config.PageSettingsConfig">PageSettingsConfig</a><span>)</span><span>: </span><span>void</span></code><p>Sets general configuration options for the page.<table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>config</span>: <a href="/publisher-tag/reference#googletag.config.PageSettingsConfig">PageSettingsConfig</a></code></td><td></td></tr></table></p></ul></section><section><hr/><h4 id="googletag.sizeMapping" data-text="sizeMapping" tabindex="-1"><a id="googletag_sizeMapping"></a><span>sizeMapping</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>sizeMapping</span><span>(</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.SizeMappingBuilder">SizeMappingBuilder</a></code><p>Creates a new <a href="/publisher-tag/reference#googletag.SizeMappingBuilder">SizeMappingBuilder</a>.<dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/guides/ad-sizes#responsive_ads">Ad sizes: Responsive ads</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.SizeMappingBuilder">SizeMappingBuilder</a></code></td><td>A new builder.</td></tr></table></p></ul></section></section><hr/><section><a id="googletag_CommandArray"></a><h2 id="googletag.CommandArray" data-text="googletag.CommandArray" tabindex="-1">googletag.CommandArray</h2><div>The command array accepts a sequence of functions and invokes them in order. It is intended to replace a standard array that is used to enqueue functions to be invoked once GPT is loaded.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Methods</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.CommandArray.push"><span>push<wbr/></span><span></span></a></code></td><td><div>Executes the sequence of functions specified in the arguments in order.</div></td></tr></table></section><section></section><section><h3 class="hide-from-toc" id="googletag.CommandArray_Methods" data-text="Methods" tabindex="-1">Methods</h3><section><hr/><h4 id="googletag.CommandArray.push" data-text="push" tabindex="-1"><a id="googletag.CommandArray_push"></a><span>push</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>push</span><span>(</span><span>...</span><span>f</span><span>: </span><span>(</span><span>(</span><span>this</span><span>: </span><span>typeof </span><span>globalThis</span><span>)</span><span> =&gt; </span><span>void</span><span>)</span><span>[]</span><span>)</span><span>: </span><span>number</span></code><p>Executes the sequence of functions specified in the arguments in order.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_7" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.cmd.push(() =&gt; { googletag.defineSlot(&quot;/1234567/sports&quot;, [160, 600]).addService(googletag.pubads()); }); </pre></section><section><h3 id="javascript-legacy_7" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.cmd.push(function () { googletag.defineSlot(&quot;/1234567/sports&quot;, [160, 600]).addService(googletag.pubads()); }); </pre></section><section><h3 id="typescript_7" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.cmd.push(() =&gt; { googletag.defineSlot(&quot;/1234567/sports&quot;, [160, 600])!.addService(googletag.pubads()); }); </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><code translate="no" dir="ltr">Rest</code> <span>...</span><span>f</span>: <span>(</span><span>(</span><span>this</span><span>: </span><span>typeof </span><span>globalThis</span><span>)</span><span> =&gt; </span><span>void</span><span>)</span><span>[]</span></code></td><td>A JavaScript function to be executed. The runtime binding will always be <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/globalThis"><code translate="no" dir="ltr">globalThis</code></a>. Consider passing an arrow function to retain the <code translate="no" dir="ltr">this</code> value of the enclosing lexical context.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>number</span></code></td><td>The number of commands processed so far. This is compatible with <code translate="no" dir="ltr">Array.push</code>&#39;s return value (the current length of the array).</td></tr></table></p></ul></section></section></section><hr/><section><a id="googletag_CompanionAdsService"></a><h2 id="googletag.CompanionAdsService" data-text="googletag.CompanionAdsService" tabindex="-1">googletag.CompanionAdsService</h2><div style="padding-left: 20px; margin: -20px 0 16px 0;"><span class="material-icons" aria-hidden="true" translate="no">subdirectory_arrow_right</span>Extends <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Service">Service</a></code></div><div>Companion Ads service. This service is used by video ads to show companion ads.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Methods</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Service.addEventListener"><span>add<wbr/>Event<wbr/>Listener<wbr/></span><span></span></a></code></td><td><div>Registers a listener that allows you to set up and call a JavaScript function when a specific GPT event happens on the page.<h6 class="no-link" id="inherited-from-service.addeventlistener" data-text="Inherited from Service.addEventListener" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Service.addEventListener">Service.addEventListener</a></code></h6></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Service.getSlots"><span>get<wbr/>Slots<wbr/></span><span></span></a></code></td><td><div>Get the list of slots associated with this service.<h6 class="no-link" id="inherited-from-service.getslots" data-text="Inherited from Service.getSlots" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Service.getSlots">Service.getSlots</a></code></h6></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Service.removeEventListener"><span>remove<wbr/>Event<wbr/>Listener<wbr/></span><span></span></a></code></td><td><div>Removes a previously registered listener.<h6 class="no-link" id="inherited-from-service.removeeventlistener" data-text="Inherited from Service.removeEventListener" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Service.removeEventListener">Service.removeEventListener</a></code></h6></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.CompanionAdsService.setRefreshUnfilledSlots"><span>set<wbr/>Refresh<wbr/>Unfilled<wbr/>Slots<wbr/></span><span></span></a></code></td><td><div>Sets whether companion slots that have not been filled will be automatically backfilled.</div></td></tr></table></section><section><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://support.google.com/admanager/answer/1191131">Companion ads for video and audio</a></li></ul></dd></dl></section><section><h3 class="hide-from-toc" id="googletag.CompanionAdsService_Methods" data-text="Methods" tabindex="-1">Methods</h3><section><hr/><h4 id="googletag.CompanionAdsService.setRefreshUnfilledSlots" data-text="setRefreshUnfilledSlots" tabindex="-1"><a id="googletag.CompanionAdsService_setRefreshUnfilledSlots"></a><span>setRefreshUnfilledSlots</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>setRefreshUnfilledSlots</span><span>(</span><span>value</span><span>: </span><span>boolean</span><span>)</span><span>: </span><span>void</span></code><p>Sets whether companion slots that have not been filled will be automatically backfilled.<br><br>This method can be called multiple times during the page&#39;s lifetime to turn backfill on and off. Only slots that are also registered with the <a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a> will be backfilled. Due to policy restrictions, this method is not designed to fill empty companion slots when an Ad Exchange video is served.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_8" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.companionAds().setRefreshUnfilledSlots(true); </pre></section><section><h3 id="javascript-legacy_8" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.companionAds().setRefreshUnfilledSlots(true); </pre></section><section><h3 id="typescript_8" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.companionAds().setRefreshUnfilledSlots(true); </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>value</span>: <span>boolean</span></code></td><td><code translate="no" dir="ltr">true</code> to automatically backfill unfilled slots, <code translate="no" dir="ltr">false</code> to leave them unchanged.</td></tr></table></p></ul></section></section></section><hr/><section><a id="googletag_PrivacySettingsConfig"></a><h2 id="googletag.PrivacySettingsConfig" data-text="googletag.PrivacySettingsConfig" tabindex="-1">googletag.PrivacySettingsConfig</h2><div>Configuration object for privacy settings.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PrivacySettingsConfig.childDirectedTreatment"><span>child<wbr/>Directed<wbr/>Treatment<wbr/></span><span>?</span></a></code></td><td><div>Indicates whether the page should be <a href="https://support.google.com/admanager/answer/3671211">treated as child-directed</a>.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PrivacySettingsConfig.limitedAds"><span>limited<wbr/>Ads<wbr/></span><span>?</span></a></code></td><td><div>Enables serving to run in <a href="https://support.google.com/admanager/answer/9882911">limited ads</a> mode to aid in publisher regulatory compliance needs.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PrivacySettingsConfig.nonPersonalizedAds"><span>non<wbr/>Personalized<wbr/>Ads<wbr/></span><span>?</span></a></code></td><td><div>Enables serving to run in <a href="https://support.google.com/admanager/answer/9005435">non-personalized ads</a> mode to aid in publisher regulatory compliance needs.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PrivacySettingsConfig.restrictDataProcessing"><span>restrict<wbr/>Data<wbr/>Processing<wbr/></span><span>?</span></a></code></td><td><div>Enables serving to run in <a href="https://support.google.com/admanager/answer/9598414">restricted processing mode</a> to aid in publisher regulatory compliance needs.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PrivacySettingsConfig.trafficSource"><span>traffic<wbr/>Source<wbr/></span><span>?</span></a></code></td><td><div>Indicates whether requests represent purchased or organic traffic.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PrivacySettingsConfig.underAgeOfConsent"><span>under<wbr/>Age<wbr/>Of<wbr/>Consent<wbr/></span><span>?</span></a></code></td><td><div>Indicates whether to mark ad requests as coming from users <a href="https://support.google.com/admanager/answer/9004919">under the age of consent</a>.</div></td></tr></table></section><section><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/samples/configure-privacy">Configure privacy settings</a></li></ul></dd></dl></section><section><h3 class="hide-from-toc" id="googletag.PrivacySettingsConfig_Properties" data-text="Properties" tabindex="-1">Properties</h3><section><hr/><h4 id="googletag.PrivacySettingsConfig.childDirectedTreatment" data-text="Optional childDirectedTreatment" tabindex="-1"><a id="googletag.PrivacySettingsConfig_childDirectedTreatment"></a><code translate="no" dir="ltr">Optional</code> <span>childDirectedTreatment</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>childDirectedTreatment</span><span>?:</span> <span>null</span><span> | </span><span>boolean</span></code></div><p>Indicates whether the page should be <a href="https://support.google.com/admanager/answer/3671211">treated as child-directed</a>. Set to <code translate="no" dir="ltr">null</code> to clear the configuration.</p></ul></section><section><hr/><h4 id="googletag.PrivacySettingsConfig.limitedAds" data-text="Optional limitedAds" tabindex="-1"><a id="googletag.PrivacySettingsConfig_limitedAds"></a><code translate="no" dir="ltr">Optional</code> <span>limitedAds</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>limitedAds</span><span>?:</span> <span>boolean</span></code></div><p>Enables serving to run in <a href="https://support.google.com/admanager/answer/9882911">limited ads</a> mode to aid in publisher regulatory compliance needs.<br><br>You can instruct GPT to request limited ads in two ways:<ul> <li>Automatically, by using a signal from an <a href="https://iabeurope.eu/tcf-2-0/">IAB TCF v2.0</a> consent management platform.</li> <li>Manually, by setting the value of this field to <code translate="no" dir="ltr">true</code>.</li> </ul> Manually configuring limited ads is only possible when GPT is loaded from the <a href="https://developers.google.com/publisher-tag/guides/general-best-practices#load_from_an_official_source">limited ads URL</a>. Attempting to modify this setting when GPT has been loaded from the standard URL will generate a <a href="http://developers.google.com/publisher-tag/guides/publisher-console-messages#147">Publisher Console warning</a>.<br><br>Note that it is not necessary to manually enable limited ads when a CMP is in use.</p><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_9" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Manually enable limited ads serving. // GPT must be loaded from the limited ads URL to configure this setting. googletag.pubads().setPrivacySettings({ limitedAds: true, }); </pre></section><section><h3 id="javascript-legacy_9" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// Manually enable limited ads serving. // GPT must be loaded from the limited ads URL to configure this setting. googletag.pubads().setPrivacySettings({ limitedAds: true, }); </pre></section><section><h3 id="typescript_9" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Manually enable limited ads serving. // GPT must be loaded from the limited ads URL to configure this setting. googletag.pubads().setPrivacySettings({ limitedAds: true, }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/samples/display-limited-ad">Display a limited ad</a></li></ul></dd></dl></ul></section><section><hr/><h4 id="googletag.PrivacySettingsConfig.nonPersonalizedAds" data-text="Optional nonPersonalizedAds" tabindex="-1"><a id="googletag.PrivacySettingsConfig_nonPersonalizedAds"></a><code translate="no" dir="ltr">Optional</code> <span>nonPersonalizedAds</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>nonPersonalizedAds</span><span>?:</span> <span>boolean</span></code></div><p>Enables serving to run in <a href="https://support.google.com/admanager/answer/9005435">non-personalized ads</a> mode to aid in publisher regulatory compliance needs.</p></ul></section><section><hr/><h4 id="googletag.PrivacySettingsConfig.restrictDataProcessing" data-text="Optional restrictDataProcessing" tabindex="-1"><a id="googletag.PrivacySettingsConfig_restrictDataProcessing"></a><code translate="no" dir="ltr">Optional</code> <span>restrictDataProcessing</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>restrictDataProcessing</span><span>?:</span> <span>boolean</span></code></div><p>Enables serving to run in <a href="https://support.google.com/admanager/answer/9598414">restricted processing mode</a> to aid in publisher regulatory compliance needs.</p></ul></section><section><hr/><h4 id="googletag.PrivacySettingsConfig.trafficSource" data-text="Optional trafficSource" tabindex="-1"><a id="googletag.PrivacySettingsConfig_trafficSource"></a><code translate="no" dir="ltr">Optional</code> <span>trafficSource</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>trafficSource</span><span>?:</span> <a href="/publisher-tag/reference#googletag.enums.TrafficSource">TrafficSource</a></code></div><p>Indicates whether requests represent purchased or organic traffic. This value populates the <a href="https://support.google.com/admanager/answer/11233407">Traffic source</a> dimension in Ad Manager reporting. If not set, traffic source defaults to <code translate="no" dir="ltr">undefined</code> in reporting.</p><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_10" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Indicate requests represent organic traffic. googletag.pubads().setPrivacySettings({ trafficSource: googletag.enums.TrafficSource.ORGANIC, }); // Indicate requests represent purchased traffic. googletag.pubads().setPrivacySettings({ trafficSource: googletag.enums.TrafficSource.PURCHASED, }); </pre></section><section><h3 id="javascript-legacy_10" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// Indicate requests represent organic traffic. googletag.pubads().setPrivacySettings({ trafficSource: googletag.enums.TrafficSource.ORGANIC, }); // Indicate requests represent purchased traffic. googletag.pubads().setPrivacySettings({ trafficSource: googletag.enums.TrafficSource.PURCHASED, }); </pre></section><section><h3 id="typescript_10" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Indicate requests represent organic traffic. googletag.pubads().setPrivacySettings({ trafficSource: googletag.enums.TrafficSource.ORGANIC, }); // Indicate requests represent purchased traffic. googletag.pubads().setPrivacySettings({ trafficSource: googletag.enums.TrafficSource.PURCHASED, }); </pre></section></devsite-selector></dd></dl></ul></section><section><hr/><h4 id="googletag.PrivacySettingsConfig.underAgeOfConsent" data-text="Optional underAgeOfConsent" tabindex="-1"><a id="googletag.PrivacySettingsConfig_underAgeOfConsent"></a><code translate="no" dir="ltr">Optional</code> <span>underAgeOfConsent</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>underAgeOfConsent</span><span>?:</span> <span>null</span><span> | </span><span>boolean</span></code></div><p>Indicates whether to mark ad requests as coming from users <a href="https://support.google.com/admanager/answer/9004919">under the age of consent</a>. Set to <code translate="no" dir="ltr">null</code> to clear the configuration.</p></ul></section></section></section><hr/><section><a id="googletag_PubAdsService"></a><h2 id="googletag.PubAdsService" data-text="googletag.PubAdsService" tabindex="-1">googletag.PubAdsService</h2><div style="padding-left: 20px; margin: -20px 0 16px 0;"><span class="material-icons" aria-hidden="true" translate="no">subdirectory_arrow_right</span>Extends <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Service">Service</a></code></div><div>Publisher Ads service. This service is used to fetch and show ads from your Google Ad Manager account.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Methods</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Service.addEventListener"><span>add<wbr/>Event<wbr/>Listener<wbr/></span><span></span></a></code></td><td><div>Registers a listener that allows you to set up and call a JavaScript function when a specific GPT event happens on the page.<h6 class="no-link" id="inherited-from-service.addeventlistener_1" data-text="Inherited from Service.addEventListener" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Service.addEventListener">Service.addEventListener</a></code></h6></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.clear"><span>clear<wbr/></span><span></span></a></code></td><td><div>Removes the ads from the given slots and replaces them with blank content.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.clearCategoryExclusions"><span>clear<wbr/>Category<wbr/>Exclusions<wbr/></span><span></span></a></code></td><td><div>Clears all page-level ad category exclusion labels.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.clearTargeting"><span>clear<wbr/>Targeting<wbr/></span><span></span></a></code></td><td><div>Clears custom targeting parameters for a specific key or for all keys.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.collapseEmptyDivs"><span>collapse<wbr/>Empty<wbr/>Divs<wbr/></span><span></span></a></code></td><td><div>Enables collapsing of slot divs so that they don&#39;t take up any space on the page when there is no ad content to display.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.disableInitialLoad"><span>disable<wbr/>Initial<wbr/>Load<wbr/></span><span></span></a></code></td><td><div>Disables requests for ads on page load, but allows ads to be requested with a <a href="/publisher-tag/reference#googletag.PubAdsService.refresh">PubAdsService.refresh</a> call.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.display"><span>display<wbr/></span><span></span></a></code></td><td><div>Constructs and displays an ad slot with the given ad unit path and size.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.enableLazyLoad"><span>enable<wbr/>Lazy<wbr/>Load<wbr/></span><span></span></a></code></td><td><div>Enables lazy loading in GPT as defined by the config object.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.enableSingleRequest"><span>enable<wbr/>Single<wbr/>Request<wbr/></span><span></span></a></code></td><td><div>Enables single request mode for fetching multiple ads at the same time.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.enableVideoAds"><span>enable<wbr/>Video<wbr/>Ads<wbr/></span><span></span></a></code></td><td><div>Signals to GPT that video ads will be present on the page.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.get"><span>get<wbr/></span><span></span></a></code></td><td><div>Returns the value for the AdSense attribute associated with the given key.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.getAttributeKeys"><span>get<wbr/>Attribute<wbr/>Keys<wbr/></span><span></span></a></code></td><td><div>Returns the attribute keys that have been set on this service.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Service.getSlots"><span>get<wbr/>Slots<wbr/></span><span></span></a></code></td><td><div>Get the list of slots associated with this service.<h6 class="no-link" id="inherited-from-service.getslots_1" data-text="Inherited from Service.getSlots" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Service.getSlots">Service.getSlots</a></code></h6></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.getTargeting"><span>get<wbr/>Targeting<wbr/></span><span></span></a></code></td><td><div>Returns a specific custom service-level targeting parameter that has been set.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.getTargetingKeys"><span>get<wbr/>Targeting<wbr/>Keys<wbr/></span><span></span></a></code></td><td><div>Returns the list of all custom service-level targeting keys that have been set.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.isInitialLoadDisabled"><span>is<wbr/>Initial<wbr/>Load<wbr/>Disabled<wbr/></span><span></span></a></code></td><td><div>Returns whether or not initial requests for ads was successfully disabled by a previous <a href="/publisher-tag/reference#googletag.PubAdsService.disableInitialLoad">PubAdsService.disableInitialLoad</a> call.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.refresh"><span>refresh<wbr/></span><span></span></a></code></td><td><div>Fetches and displays new ads for specific or all slots on the page.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Service.removeEventListener"><span>remove<wbr/>Event<wbr/>Listener<wbr/></span><span></span></a></code></td><td><div>Removes a previously registered listener.<h6 class="no-link" id="inherited-from-service.removeeventlistener_1" data-text="Inherited from Service.removeEventListener" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Service.removeEventListener">Service.removeEventListener</a></code></h6></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.set"><span>set<wbr/></span><span></span></a></code></td><td><div>Sets values for AdSense attributes that apply to all ad slots under the Publisher Ads service.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.setCategoryExclusion"><span>set<wbr/>Category<wbr/>Exclusion<wbr/></span><span></span></a></code></td><td><div>Sets a page-level ad category exclusion for the given label name.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.setCentering"><span>set<wbr/>Centering<wbr/></span><span></span></a></code></td><td><div>Enables and disables horizontal centering of ads.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.setForceSafeFrame"><span>set<wbr/>Force<wbr/>Safe<wbr/>Frame<wbr/></span><span></span></a></code></td><td><div>Configures whether all ads on the page should be forced to be rendered using a SafeFrame container.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.setLocation"><span>set<wbr/>Location<wbr/></span><span></span></a></code></td><td><div>Passes location information from websites so you can geo-target line items to specific locations.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.setPrivacySettings"><span>set<wbr/>Privacy<wbr/>Settings<wbr/></span><span></span></a></code></td><td><div>Allows configuration of all privacy settings from a single API using a config object.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.setPublisherProvidedId"><span>set<wbr/>Publisher<wbr/>Provided<wbr/>Id<wbr/></span><span></span></a></code></td><td><div>Sets the value for the publisher-provided ID.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.setSafeFrameConfig"><span>set<wbr/>Safe<wbr/>Frame<wbr/>Config<wbr/></span><span></span></a></code></td><td><div>Sets the page-level preferences for SafeFrame configuration.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.setTargeting"><span>set<wbr/>Targeting<wbr/></span><span></span></a></code></td><td><div>Sets custom targeting parameters for a given key that apply to all Publisher Ads service ad slots.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.setVideoContent"><span>set<wbr/>Video<wbr/>Content<wbr/></span><span></span></a></code></td><td><div>Sets the video content information to be sent along with the ad requests for targeting and content exclusion purposes.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService.updateCorrelator"><span>update<wbr/>Correlator<wbr/></span><span></span></a></code></td><td><div>Changes the correlator that is sent with ad requests, effectively starting a new page view.</div></td></tr></table></section><section></section><section><h3 class="hide-from-toc" id="googletag.PubAdsService_Methods" data-text="Methods" tabindex="-1">Methods</h3><section><hr/><h4 id="googletag.PubAdsService.clear" data-text="clear" tabindex="-1"><a id="googletag.PubAdsService_clear"></a><span>clear</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>clear</span><span>(</span><span>slots</span><span>?: </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a><span>[]</span><span>)</span><span>: </span><span>boolean</span></code><p>Removes the ads from the given slots and replaces them with blank content. The slots will be marked as unfetched.<br><br>In particular, clearing a slot removes the ad from GPT&#39;s <a href="https://support.google.com/admanager/answer/183281">long-lived pageview</a>, so future requests will not be influenced by roadblocks or competitive exclusions involving this ad.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_11" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot1 = googletag.defineSlot(&quot;/1234567/sports&quot;, [728, 90], &quot;div-1&quot;); googletag.display(&quot;div-1&quot;); const slot2 = googletag.defineSlot(&quot;/1234567/news&quot;, [160, 600], &quot;div-2&quot;); googletag.display(&quot;div-2&quot;); // This call to clear only slot1. googletag.pubads().clear([slot1]); // This call to clear both slot1 and slot2. googletag.pubads().clear([slot1, slot2]); // This call to clear all slots. googletag.pubads().clear(); </pre></section><section><h3 id="javascript-legacy_11" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">var slot1 = googletag.defineSlot(&quot;/1234567/sports&quot;, [728, 90], &quot;div-1&quot;); googletag.display(&quot;div-1&quot;); var slot2 = googletag.defineSlot(&quot;/1234567/news&quot;, [160, 600], &quot;div-2&quot;); googletag.display(&quot;div-2&quot;); // This call to clear only slot1. googletag.pubads().clear([slot1]); // This call to clear both slot1 and slot2. googletag.pubads().clear([slot1, slot2]); // This call to clear all slots. googletag.pubads().clear(); </pre></section><section><h3 id="typescript_11" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot1 = googletag.defineSlot(&quot;/1234567/sports&quot;, [728, 90], &quot;div-1&quot;)!; googletag.display(&quot;div-1&quot;); const slot2 = googletag.defineSlot(&quot;/1234567/news&quot;, [160, 600], &quot;div-2&quot;)!; googletag.display(&quot;div-2&quot;); // This call to clear only slot1. googletag.pubads().clear([slot1]); // This call to clear both slot1 and slot2. googletag.pubads().clear([slot1, slot2]); // This call to clear all slots. googletag.pubads().clear(); </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><code translate="no" dir="ltr">Optional</code> <span>slots</span>: <a href="/publisher-tag/reference#googletag.Slot">Slot</a><span>[]</span></code></td><td>The array of slots to clear. Array is optional; all slots will be cleared if it is unspecified.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>boolean</span></code></td><td>Returns <code translate="no" dir="ltr">true</code> if slots have been cleared, <code translate="no" dir="ltr">false</code> otherwise.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.clearCategoryExclusions" data-text="clearCategoryExclusions" tabindex="-1"><a id="googletag.PubAdsService_clearCategoryExclusions"></a><span>clearCategoryExclusions</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>clearCategoryExclusions</span><span>(</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code><p>Clears all page-level ad category exclusion labels. This is useful if you want to refresh the slot.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_12" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Set category exclusion to exclude ads with &#39;AirlineAd&#39; labels. googletag.pubads().setCategoryExclusion(&quot;AirlineAd&quot;); // Make ad requests. No ad with &#39;AirlineAd&#39; label will be returned. // Clear category exclusions so all ads can be returned. googletag.pubads().clearCategoryExclusions(); // Make ad requests. Any ad can be returned. </pre></section><section><h3 id="javascript-legacy_12" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// Set category exclusion to exclude ads with &#39;AirlineAd&#39; labels. googletag.pubads().setCategoryExclusion(&quot;AirlineAd&quot;); // Make ad requests. No ad with &#39;AirlineAd&#39; label will be returned. // Clear category exclusions so all ads can be returned. googletag.pubads().clearCategoryExclusions(); // Make ad requests. Any ad can be returned. </pre></section><section><h3 id="typescript_12" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Set category exclusion to exclude ads with &#39;AirlineAd&#39; labels. googletag.pubads().setCategoryExclusion(&quot;AirlineAd&quot;); // Make ad requests. No ad with &#39;AirlineAd&#39; label will be returned. // Clear category exclusions so all ads can be returned. googletag.pubads().clearCategoryExclusions(); // Make ad requests. Any ad can be returned. </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://support.google.com/admanager/answer/3238504">Custom labels to block ads</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code></td><td>The service object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.clearTargeting" data-text="clearTargeting" tabindex="-1"><a id="googletag.PubAdsService_clearTargeting"></a><span>clearTargeting</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>clearTargeting</span><span>(</span><span>key</span><span>?: </span><span>string</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code><p>Clears custom targeting parameters for a specific key or for all keys.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_13" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setTargeting(&quot;interests&quot;, &quot;sports&quot;); googletag.pubads().setTargeting(&quot;colors&quot;, &quot;blue&quot;); googletag.pubads().setTargeting(&quot;fruits&quot;, &quot;apple&quot;); googletag.pubads().clearTargeting(&quot;interests&quot;); // Targeting &#39;colors&#39; and &#39;fruits&#39; are still present, while &#39;interests&#39; // was cleared. googletag.pubads().clearTargeting(); // All targeting has been cleared. </pre></section><section><h3 id="javascript-legacy_13" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setTargeting(&quot;interests&quot;, &quot;sports&quot;); googletag.pubads().setTargeting(&quot;colors&quot;, &quot;blue&quot;); googletag.pubads().setTargeting(&quot;fruits&quot;, &quot;apple&quot;); googletag.pubads().clearTargeting(&quot;interests&quot;); // Targeting &#39;colors&#39; and &#39;fruits&#39; are still present, while &#39;interests&#39; // was cleared. googletag.pubads().clearTargeting(); // All targeting has been cleared. </pre></section><section><h3 id="typescript_13" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setTargeting(&quot;interests&quot;, &quot;sports&quot;); googletag.pubads().setTargeting(&quot;colors&quot;, &quot;blue&quot;); googletag.pubads().setTargeting(&quot;fruits&quot;, &quot;apple&quot;); googletag.pubads().clearTargeting(&quot;interests&quot;); // Targeting &#39;colors&#39; and &#39;fruits&#39; are still present, while &#39;interests&#39; // was cleared. googletag.pubads().clearTargeting(); // All targeting has been cleared. </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/guides/key-value-targeting">Key-value targeting</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><code translate="no" dir="ltr">Optional</code> <span>key</span>: <span>string</span></code></td><td>Targeting parameter key. The key is optional; all targeting parameters will be cleared if it is unspecified.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code></td><td>The service object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.collapseEmptyDivs" data-text="collapseEmptyDivs" tabindex="-1"><a id="googletag.PubAdsService_collapseEmptyDivs"></a><span>collapseEmptyDivs</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>collapseEmptyDivs</span><span>(</span><span>collapseBeforeAdFetch</span><span>?: </span><span>boolean</span><span>)</span><span>: </span><span>boolean</span></code><p>Enables collapsing of slot divs so that they don&#39;t take up any space on the page when there is no ad content to display. This mode must be set before the service is enabled.<dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul> <li><a href="https://developers.google.com/publisher-tag/samples/collapse-empty-ad-slots">Collapse empty ad slots</a></li> <li><a href="https://developers.google.com/publisher-tag/guides/minimize-layout-shift">Minimize layout shift</a></li> </ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><code translate="no" dir="ltr">Optional</code> <span>collapseBeforeAdFetch</span>: <span>boolean</span></code></td><td>Whether to collapse the slots even before the ads are fetched. This parameter is optional; if not provided, <code translate="no" dir="ltr">false</code> will be used as the default value.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>boolean</span></code></td><td>Returns <code translate="no" dir="ltr">true</code> if div collapse mode was enabled and <code translate="no" dir="ltr">false</code> if it is impossible to enable collapse mode because the method was called after the service was enabled.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.disableInitialLoad" data-text="disableInitialLoad" tabindex="-1"><a id="googletag.PubAdsService_disableInitialLoad"></a><span>disableInitialLoad</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>disableInitialLoad</span><span>(</span><span>)</span><span>: </span><span>void</span></code><p>Disables requests for ads on page load, but allows ads to be requested with a <a href="/publisher-tag/reference#googletag.PubAdsService.refresh">PubAdsService.refresh</a> call. This should be set prior to enabling the service. Async mode must be used; otherwise it will be impossible to request ads using <code translate="no" dir="ltr">refresh</code>.<dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul> <li><a href="https://developers.google.com/publisher-tag/guides/control-ad-loading">Control ad loading and refresh</a></li> <li><a href="https://developers.google.com/publisher-tag/samples/control-sra-batching">Control SRA batching</a></li> </ul></dd></dl></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.display" data-text="display" tabindex="-1"><a id="googletag.PubAdsService_display"></a><span>display</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>display</span><span>(</span><span>adUnitPath</span><span>: </span><span>string</span>, <span>size</span><span>: </span><a href="/publisher-tag/reference#googletag.GeneralSize">GeneralSize</a>, <span>div</span><span>?: </span><span>string</span><span> | </span><span>Element</span>, <span>clickUrl</span><span>?: </span><span>string</span><span>)</span><span>: </span><span>void</span></code><p>Constructs and displays an ad slot with the given ad unit path and size. This method does not work with single request mode.<br><br><strong>Note:</strong> When this method is called, a snapshot of the slot and page state is created to ensure consistency when sending the ad request and rendering the response. Any changes that are made to the slot or page state after this method is called (including targeting, privacy settings, force SafeFrame, etc.) will only apply to subsequent <code translate="no" dir="ltr">display()</code> or <code translate="no" dir="ltr">refresh()</code> requests.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_14" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().display(&quot;/1234567/sports&quot;, [728, 90], &quot;div-1&quot;); </pre></section><section><h3 id="javascript-legacy_14" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().display(&quot;/1234567/sports&quot;, [728, 90], &quot;div-1&quot;); </pre></section><section><h3 id="typescript_14" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().display(&quot;/1234567/sports&quot;, [728, 90], &quot;div-1&quot;); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul> <li><a href="https://developers.google.com/publisher-tag/samples/display-test-ad">Display a test ad</a></li> <li><a href="https://developers.google.com/publisher-tag/guides/control-ad-loading">Control ad loading and refresh</a></li> </ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>adUnitPath</span>: <span>string</span></code></td><td>The <a href="https://developers.google.com/publisher-tag/guides/get-started#ad-unit-path">ad unit path</a> of slot to be rendered.</td></tr><tr><td><code translate="no" dir="ltr"><span>size</span>: <a href="/publisher-tag/reference#googletag.GeneralSize">GeneralSize</a></code></td><td>Width and height of the slot.</td></tr><tr><td><code translate="no" dir="ltr"><code translate="no" dir="ltr">Optional</code> <span>div</span>: <span>string</span><span> | </span><span>Element</span></code></td><td>Either the ID of the div containing the slot or the div element itself.</td></tr><tr><td><code translate="no" dir="ltr"><code translate="no" dir="ltr">Optional</code> <span>clickUrl</span>: <span>string</span></code></td><td>The click URL to use on this slot.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.enableLazyLoad" data-text="enableLazyLoad" tabindex="-1"><a id="googletag.PubAdsService_enableLazyLoad"></a><span>enableLazyLoad</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>enableLazyLoad</span><span>(</span><span>config</span><span>?: </span><span>{ </span><br/><span>  </span><span>fetchMarginPercent</span><span>?: </span><span>number</span><span>; </span><br/><span>  </span><span>mobileScaling</span><span>?: </span><span>number</span><span>; </span><br/><span>  </span><span>renderMarginPercent</span><span>?: </span><span>number</span><span>; </span><br/><span>}</span><span>)</span><span>: </span><span>void</span></code><p>Enables lazy loading in GPT as defined by the config object. For more detailed examples, see the <a href="https://developers.google.com/publisher-tag/samples/lazy-loading">Lazy loading</a> sample.<br><br><strong>Note:</strong> Lazy fetching in SRA only works if all slots are outside the fetching margin.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_15" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().enableLazyLoad({ // Fetch slots within 5 viewports. fetchMarginPercent: 500, // Render slots within 2 viewports. renderMarginPercent: 200, // Double the above values on mobile. mobileScaling: 2.0, }); </pre></section><section><h3 id="javascript-legacy_15" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().enableLazyLoad({ // Fetch slots within 5 viewports. fetchMarginPercent: 500, // Render slots within 2 viewports. renderMarginPercent: 200, // Double the above values on mobile. mobileScaling: 2.0, }); </pre></section><section><h3 id="typescript_15" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().enableLazyLoad({ // Fetch slots within 5 viewports. fetchMarginPercent: 500, // Render slots within 2 viewports. renderMarginPercent: 200, // Double the above values on mobile. mobileScaling: 2.0, }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul> <li><a href="https://developers.google.com/publisher-tag/guides/ad-best-practices#prioritize_important_ad_slots">Ads best practices: Prioritize &quot;important&quot; ad slots</a></li> <li><a href="https://developers.google.com/publisher-tag/samples/lazy-loading">Lazy loading</a></li> </ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><code translate="no" dir="ltr">Optional</code> <span>config</span>: <span>{ </span><br/><span>  </span><span>fetchMarginPercent</span><span>?: </span><span>number</span><span>; </span><br/><span>  </span><span>mobileScaling</span><span>?: </span><span>number</span><span>; </span><br/><span>  </span><span>renderMarginPercent</span><span>?: </span><span>number</span><span>; </span><br/><span>}</span></code></td><td>Configuration object allows customization of lazy behavior. Any omitted configurations will use a default set by Google that will be tuned over time. To disable a particular setting, such as a fetching margin, set the value to <code translate="no" dir="ltr">-1</code>.<ul> <li><code translate="no" dir="ltr">fetchMarginPercent</code><br><br> The minimum distance from the current viewport a slot must be before we fetch the ad as a percentage of viewport size. A value of 0 means &quot;when the slot enters the viewport&quot;, 100 means &quot;when the ad is 1 viewport away&quot;, and so on.</li> <li><code translate="no" dir="ltr">renderMarginPercent</code><br><br> The minimum distance from the current viewport a slot must be before we render an ad. This allows for prefetching the ad, but waiting to render and download other subresources. The value works just like <code translate="no" dir="ltr">fetchMarginPercent</code> as a percentage of viewport.</li> <li><code translate="no" dir="ltr">mobileScaling</code><br><br> A multiplier applied to margins on mobile devices. This allows varying margins on mobile vs. desktop. For example, a value of 2.0 will multiply all margins by 2 on mobile devices, increasing the minimum distance a slot can be before fetching and rendering.</li> </ul></td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.enableSingleRequest" data-text="enableSingleRequest" tabindex="-1"><a id="googletag.PubAdsService_enableSingleRequest"></a><span>enableSingleRequest</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>enableSingleRequest</span><span>(</span><span>)</span><span>: </span><span>boolean</span></code><p>Enables single request mode for fetching multiple ads at the same time. This requires all Publisher Ads slots to be defined and added to the PubAdsService prior to enabling the service. Single request mode must be set before the service is enabled.<dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul> <li><a href="https://developers.google.com/publisher-tag/guides/ad-best-practices#use_single_request_architecture_correctly">Ads best practices: Use Single Request Architecture correctly</a></li> <li><a href="https://developers.google.com/publisher-tag/samples/control-sra-batching">Control SRA batching</a></li> </ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>boolean</span></code></td><td>Returns <code translate="no" dir="ltr">true</code> if single request mode was enabled and <code translate="no" dir="ltr">false</code> if it is impossible to enable single request mode because the method was called after the service was enabled.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.enableVideoAds" data-text="enableVideoAds" tabindex="-1"><a id="googletag.PubAdsService_enableVideoAds"></a><span>enableVideoAds</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>enableVideoAds</span><span>(</span><span>)</span><span>: </span><span>void</span></code><p>Signals to GPT that video ads will be present on the page. This enables competitive exclusion constraints on display and video ads. If the video content is known, call <a href="/publisher-tag/reference#googletag.PubAdsService.setVideoContent">PubAdsService.setVideoContent</a> in order to be able to use content exclusion for display ads.</p></ul></section><section><hr/><h4 id="googletag.PubAdsService.get" data-text="get" tabindex="-1"><a id="googletag.PubAdsService_get"></a><span>get</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>get</span><span>(</span><span>key</span><span>: </span><span>string</span><span>)</span><span>: </span><span>null</span><span> | </span><span>string</span></code><p>Returns the value for the AdSense attribute associated with the given key.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_16" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().set(&quot;adsense_background_color&quot;, &quot;#FFFFFF&quot;); googletag.pubads().get(&quot;adsense_background_color&quot;); // Returns &#39;#FFFFFF&#39;. </pre></section><section><h3 id="javascript-legacy_16" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().set(&quot;adsense_background_color&quot;, &quot;#FFFFFF&quot;); googletag.pubads().get(&quot;adsense_background_color&quot;); // Returns &#39;#FFFFFF&#39;. </pre></section><section><h3 id="typescript_16" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().set(&quot;adsense_background_color&quot;, &quot;#FFFFFF&quot;); googletag.pubads().get(&quot;adsense_background_color&quot;); // Returns &#39;#FFFFFF&#39;. </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/adsense_attributes">AdSense Attributes</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>key</span>: <span>string</span></code></td><td>Name of the attribute to look for.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>null</span><span> | </span><span>string</span></code></td><td>Current value for the attribute key, or <code translate="no" dir="ltr">null</code> if the key is not present.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.getAttributeKeys" data-text="getAttributeKeys" tabindex="-1"><a id="googletag.PubAdsService_getAttributeKeys"></a><span>getAttributeKeys</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>getAttributeKeys</span><span>(</span><span>)</span><span>: </span><span>string</span><span>[]</span></code><p>Returns the attribute keys that have been set on this service.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_17" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().set(&quot;adsense_background_color&quot;, &quot;#FFFFFF&quot;); googletag.pubads().set(&quot;adsense_border_color&quot;, &quot;#AABBCC&quot;); googletag.pubads().getAttributeKeys(); // Returns [&#39;adsense_background_color&#39;, &#39;adsense_border_color&#39;]. </pre></section><section><h3 id="javascript-legacy_17" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().set(&quot;adsense_background_color&quot;, &quot;#FFFFFF&quot;); googletag.pubads().set(&quot;adsense_border_color&quot;, &quot;#AABBCC&quot;); googletag.pubads().getAttributeKeys(); // Returns [&#39;adsense_background_color&#39;, &#39;adsense_border_color&#39;]. </pre></section><section><h3 id="typescript_17" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().set(&quot;adsense_background_color&quot;, &quot;#FFFFFF&quot;); googletag.pubads().set(&quot;adsense_border_color&quot;, &quot;#AABBCC&quot;); googletag.pubads().getAttributeKeys(); // Returns [&#39;adsense_background_color&#39;, &#39;adsense_border_color&#39;]. </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>string</span><span>[]</span></code></td><td>Array of attribute keys set on this service. Ordering is undefined.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.getTargeting" data-text="getTargeting" tabindex="-1"><a id="googletag.PubAdsService_getTargeting"></a><span>getTargeting</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>getTargeting</span><span>(</span><span>key</span><span>: </span><span>string</span><span>)</span><span>: </span><span>string</span><span>[]</span></code><p>Returns a specific custom service-level targeting parameter that has been set.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_18" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setTargeting(&quot;interests&quot;, &quot;sports&quot;); googletag.pubads().getTargeting(&quot;interests&quot;); // Returns [&#39;sports&#39;]. googletag.pubads().getTargeting(&quot;age&quot;); // Returns [] (empty array). </pre></section><section><h3 id="javascript-legacy_18" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setTargeting(&quot;interests&quot;, &quot;sports&quot;); googletag.pubads().getTargeting(&quot;interests&quot;); // Returns [&#39;sports&#39;]. googletag.pubads().getTargeting(&quot;age&quot;); // Returns [] (empty array). </pre></section><section><h3 id="typescript_18" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setTargeting(&quot;interests&quot;, &quot;sports&quot;); googletag.pubads().getTargeting(&quot;interests&quot;); // Returns [&#39;sports&#39;]. googletag.pubads().getTargeting(&quot;age&quot;); // Returns [] (empty array). </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>key</span>: <span>string</span></code></td><td>The targeting key to look for.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>string</span><span>[]</span></code></td><td>The values associated with this key, or an empty array if there is no such key.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.getTargetingKeys" data-text="getTargetingKeys" tabindex="-1"><a id="googletag.PubAdsService_getTargetingKeys"></a><span>getTargetingKeys</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>getTargetingKeys</span><span>(</span><span>)</span><span>: </span><span>string</span><span>[]</span></code><p>Returns the list of all custom service-level targeting keys that have been set.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_19" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setTargeting(&quot;interests&quot;, &quot;sports&quot;); googletag.pubads().setTargeting(&quot;colors&quot;, &quot;blue&quot;); googletag.pubads().getTargetingKeys(); // Returns [&#39;interests&#39;, &#39;colors&#39;]. </pre></section><section><h3 id="javascript-legacy_19" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setTargeting(&quot;interests&quot;, &quot;sports&quot;); googletag.pubads().setTargeting(&quot;colors&quot;, &quot;blue&quot;); googletag.pubads().getTargetingKeys(); // Returns [&#39;interests&#39;, &#39;colors&#39;]. </pre></section><section><h3 id="typescript_19" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setTargeting(&quot;interests&quot;, &quot;sports&quot;); googletag.pubads().setTargeting(&quot;colors&quot;, &quot;blue&quot;); googletag.pubads().getTargetingKeys(); // Returns [&#39;interests&#39;, &#39;colors&#39;]. </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>string</span><span>[]</span></code></td><td>Array of targeting keys. Ordering is undefined.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.isInitialLoadDisabled" data-text="isInitialLoadDisabled" tabindex="-1"><a id="googletag.PubAdsService_isInitialLoadDisabled"></a><span>isInitialLoadDisabled</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>isInitialLoadDisabled</span><span>(</span><span>)</span><span>: </span><span>boolean</span></code><p>Returns whether or not initial requests for ads was successfully disabled by a previous <a href="/publisher-tag/reference#googletag.PubAdsService.disableInitialLoad">PubAdsService.disableInitialLoad</a> call.<table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>boolean</span></code></td><td>Returns <code translate="no" dir="ltr">true</code> if a previous call to <a href="/publisher-tag/reference#googletag.PubAdsService.disableInitialLoad">PubAdsService.disableInitialLoad</a> was successful, <code translate="no" dir="ltr">false</code> otherwise.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.refresh" data-text="refresh" tabindex="-1"><a id="googletag.PubAdsService_refresh"></a><span>refresh</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>refresh</span><span>(</span><span>slots</span><span>?: </span><span>null</span><span> | </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a><span>[]</span>, <span>options</span><span>?: </span><span>{ </span><br/><span>  </span><span>changeCorrelator</span><span>: </span><span>boolean</span><span>; </span><br/><span>}</span><span>)</span><span>: </span><span>void</span></code><p>Fetches and displays new ads for specific or all slots on the page. Works only in asynchronous rendering mode.<br><br>For proper behavior across all browsers, calling <code translate="no" dir="ltr">refresh</code> must be preceded by a call to <code translate="no" dir="ltr">display</code> the ad slot. If the call to <code translate="no" dir="ltr">display</code> is omitted, refresh may behave unexpectedly. If desired, the <a href="/publisher-tag/reference#googletag.PubAdsService.disableInitialLoad">PubAdsService.disableInitialLoad</a> method can be used to stop <code translate="no" dir="ltr">display</code> from fetching an ad.<br><br>Refreshing a slot removes the old ad from GPT&#39;s <a href="https://support.google.com/admanager/answer/183281">long-lived pageview</a>, so future requests will not be influenced by roadblocks or competitive exclusions involving that ad.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_20" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot1 = googletag.defineSlot(&quot;/1234567/sports&quot;, [728, 90], &quot;div-1&quot;); googletag.display(&quot;div-1&quot;); const slot2 = googletag.defineSlot(&quot;/1234567/news&quot;, [160, 600], &quot;div-2&quot;); googletag.display(&quot;div-2&quot;); // This call to refresh fetches a new ad for slot1 only. googletag.pubads().refresh([slot1]); // This call to refresh fetches a new ad for both slot1 and slot2. googletag.pubads().refresh([slot1, slot2]); // This call to refresh fetches a new ad for each slot. googletag.pubads().refresh(); // This call to refresh fetches a new ad for slot1, without changing // the correlator. googletag.pubads().refresh([slot1], { changeCorrelator: false }); // This call to refresh fetches a new ad for each slot, without // changing the correlator. googletag.pubads().refresh(null, { changeCorrelator: false }); </pre></section><section><h3 id="javascript-legacy_20" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">var slot1 = googletag.defineSlot(&quot;/1234567/sports&quot;, [728, 90], &quot;div-1&quot;); googletag.display(&quot;div-1&quot;); var slot2 = googletag.defineSlot(&quot;/1234567/news&quot;, [160, 600], &quot;div-2&quot;); googletag.display(&quot;div-2&quot;); // This call to refresh fetches a new ad for slot1 only. googletag.pubads().refresh([slot1]); // This call to refresh fetches a new ad for both slot1 and slot2. googletag.pubads().refresh([slot1, slot2]); // This call to refresh fetches a new ad for each slot. googletag.pubads().refresh(); // This call to refresh fetches a new ad for slot1, without changing // the correlator. googletag.pubads().refresh([slot1], { changeCorrelator: false }); // This call to refresh fetches a new ad for each slot, without // changing the correlator. googletag.pubads().refresh(null, { changeCorrelator: false }); </pre></section><section><h3 id="typescript_20" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot1 = googletag.defineSlot(&quot;/1234567/sports&quot;, [728, 90], &quot;div-1&quot;)!; googletag.display(&quot;div-1&quot;); const slot2 = googletag.defineSlot(&quot;/1234567/news&quot;, [160, 600], &quot;div-2&quot;)!; googletag.display(&quot;div-2&quot;); // This call to refresh fetches a new ad for slot1 only. googletag.pubads().refresh([slot1]); // This call to refresh fetches a new ad for both slot1 and slot2. googletag.pubads().refresh([slot1, slot2]); // This call to refresh fetches a new ad for each slot. googletag.pubads().refresh(); // This call to refresh fetches a new ad for slot1, without changing // the correlator. googletag.pubads().refresh([slot1], { changeCorrelator: false }); // This call to refresh fetches a new ad for each slot, without // changing the correlator. googletag.pubads().refresh(null, { changeCorrelator: false }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul> <li><a href="https://developers.google.com/publisher-tag/guides/control-ad-loading">Control ad loading and refresh</a></li> <li><a href="https://developers.google.com/publisher-tag/samples/refresh">Refresh ad slots</a></li> </ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><code translate="no" dir="ltr">Optional</code> <span>slots</span>: <span>null</span><span> | </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a><span>[]</span></code></td><td>The slots to refresh. Array is optional; all slots will be refreshed if it is unspecified.</td></tr><tr><td><code translate="no" dir="ltr"><code translate="no" dir="ltr">Optional</code> <span>options</span>: <span>{ </span><br/><span>  </span><span>changeCorrelator</span><span>: </span><span>boolean</span><span>; </span><br/><span>}</span></code></td><td>Configuration options associated with this refresh call.<ul> <li><code translate="no" dir="ltr">changeCorrelator</code><br><br> Specifies whether or not a new correlator is to be generated for fetching ads. Our ad servers maintain this correlator value briefly (currently for 30 seconds, but subject to change), such that requests with the same correlator received close together will be considered a single page view. By default a new correlator is generated for every refresh.<br><br> <strong>Note:</strong> this option has no effect on GPT&#39;s <a href="https://support.google.com/admanager/answer/183281">long-lived pageview</a>, which automatically reflects the ads currently on the page and has no expiration time.</li> </ul></td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.set" data-text="set" tabindex="-1"><a id="googletag.PubAdsService_set"></a><span>set</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>set</span><span>(</span><span>key</span><span>: </span><span>string</span>, <span>value</span><span>: </span><span>string</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code><p>Sets values for AdSense attributes that apply to all ad slots under the Publisher Ads service.<br><br>Calling this more than once for the same key will override previously set values for that key. All values must be set before calling <code translate="no" dir="ltr">display</code> or <code translate="no" dir="ltr">refresh</code>.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_21" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().set(&quot;adsense_background_color&quot;, &quot;#FFFFFF&quot;); </pre></section><section><h3 id="javascript-legacy_21" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().set(&quot;adsense_background_color&quot;, &quot;#FFFFFF&quot;); </pre></section><section><h3 id="typescript_21" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().set(&quot;adsense_background_color&quot;, &quot;#FFFFFF&quot;); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/adsense_attributes">AdSense Attributes</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>key</span>: <span>string</span></code></td><td>The name of the attribute.</td></tr><tr><td><code translate="no" dir="ltr"><span>value</span>: <span>string</span></code></td><td>Attribute value.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code></td><td>The service object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.setCategoryExclusion" data-text="setCategoryExclusion" tabindex="-1"><a id="googletag.PubAdsService_setCategoryExclusion"></a><span>setCategoryExclusion</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>setCategoryExclusion</span><span>(</span><span>categoryExclusion</span><span>: </span><span>string</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code><p>Sets a page-level ad category exclusion for the given label name.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_22" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Label = AirlineAd. googletag.pubads().setCategoryExclusion(&quot;AirlineAd&quot;); </pre></section><section><h3 id="javascript-legacy_22" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// Label = AirlineAd. googletag.pubads().setCategoryExclusion(&quot;AirlineAd&quot;); </pre></section><section><h3 id="typescript_22" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Label = AirlineAd. googletag.pubads().setCategoryExclusion(&quot;AirlineAd&quot;); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://support.google.com/admanager/answer/3238504">Custom labels to block ads</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>categoryExclusion</span>: <span>string</span></code></td><td>The ad category exclusion label to add.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code></td><td>The service object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.setCentering" data-text="setCentering" tabindex="-1"><a id="googletag.PubAdsService_setCentering"></a><span>setCentering</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>setCentering</span><span>(</span><span>centerAds</span><span>: </span><span>boolean</span><span>)</span><span>: </span><span>void</span></code><p>Enables and disables horizontal centering of ads. Centering is disabled by default. In legacy gpt_mobile.js, centering is enabled by default.<br><br>This method should be invoked before calling <code translate="no" dir="ltr">display</code> or <code translate="no" dir="ltr">refresh</code> because only ads that are requested after calling this method will be centered.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_23" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Make ads centered. googletag.pubads().setCentering(true); </pre></section><section><h3 id="javascript-legacy_23" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// Make ads centered. googletag.pubads().setCentering(true); </pre></section><section><h3 id="typescript_23" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Make ads centered. googletag.pubads().setCentering(true); </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>centerAds</span>: <span>boolean</span></code></td><td><code translate="no" dir="ltr">true</code> to center ads, <code translate="no" dir="ltr">false</code> to left-align them.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.setForceSafeFrame" data-text="setForceSafeFrame" tabindex="-1"><a id="googletag.PubAdsService_setForceSafeFrame"></a><span>setForceSafeFrame</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>setForceSafeFrame</span><span>(</span><span>forceSafeFrame</span><span>: </span><span>boolean</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code><p>Configures whether all ads on the page should be forced to be rendered using a SafeFrame container.<br><br>Please keep the following things in mind while using this API:<ul> <li>This setting will only take effect for <strong>subsequent</strong> ad requests made for the respective slots.</li> <li>The slot level setting, if specified, will always override the page level setting.</li> <li>If set to <code translate="no" dir="ltr">true</code> (at slot-level or page level), the ad will always be rendered using a SafeFrame container independent of the choice made in the Google Ad Manager UI.</li> <li>However, if set to <code translate="no" dir="ltr">false</code> or left unspecified, the ad will be rendered using a SafeFrame container depending on the type of creative and the selection made in the Google Ad Manager UI.</li> <li>This API should be used with caution as it could impact the behaviour of creatives that attempt to break out of their iFrames or rely on them being rendered directly in a publishers page.</li> </ul><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_24" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setForceSafeFrame(true); // The following slot will be opted-out of the page-level force // SafeFrame instruction. googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div-1&quot;) .setForceSafeFrame(false) .addService(googletag.pubads()); // The following slot will have SafeFrame forced. googletag.defineSlot(&quot;/1234567/news&quot;, [160, 600], &quot;div-2&quot;).addService(googletag.pubads()); googletag.display(&quot;div-1&quot;); googletag.display(&quot;div-2&quot;); </pre></section><section><h3 id="javascript-legacy_24" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setForceSafeFrame(true); // The following slot will be opted-out of the page-level force // SafeFrame instruction. googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div-1&quot;) .setForceSafeFrame(false) .addService(googletag.pubads()); // The following slot will have SafeFrame forced. googletag.defineSlot(&quot;/1234567/news&quot;, [160, 600], &quot;div-2&quot;).addService(googletag.pubads()); googletag.display(&quot;div-1&quot;); googletag.display(&quot;div-2&quot;); </pre></section><section><h3 id="typescript_24" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setForceSafeFrame(true); // The following slot will be opted-out of the page-level force // SafeFrame instruction. googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div-1&quot;)! .setForceSafeFrame(false) .addService(googletag.pubads()); // The following slot will have SafeFrame forced. googletag.defineSlot(&quot;/1234567/news&quot;, [160, 600], &quot;div-2&quot;)!.addService(googletag.pubads()); googletag.display(&quot;div-1&quot;); googletag.display(&quot;div-2&quot;); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://support.google.com/admanager/answer/6023110">Render creatives using SafeFrame</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>forceSafeFrame</span>: <span>boolean</span></code></td><td><code translate="no" dir="ltr">true</code> to force all ads on the page to be rendered in SafeFrames and <code translate="no" dir="ltr">false</code> to change the previous setting to false. Setting this to <code translate="no" dir="ltr">false</code> when unspecified earlier, won&#39;t change anything.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code></td><td>The service object on which the function was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.setLocation" data-text="setLocation" tabindex="-1"><a id="googletag.PubAdsService_setLocation"></a><span>setLocation</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>setLocation</span><span>(</span><span>address</span><span>: </span><span>string</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code><p>Passes location information from websites so you can geo-target line items to specific locations.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_25" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Postal code: googletag.pubads().setLocation(&quot;10001,US&quot;); </pre></section><section><h3 id="javascript-legacy_25" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// Postal code: googletag.pubads().setLocation(&quot;10001,US&quot;); </pre></section><section><h3 id="typescript_25" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Postal code: googletag.pubads().setLocation(&quot;10001,US&quot;); </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>address</span>: <span>string</span></code></td><td>Freeform address.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code></td><td>The service object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.setPrivacySettings" data-text="setPrivacySettings" tabindex="-1"><a id="googletag.PubAdsService_setPrivacySettings"></a><span>setPrivacySettings</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>setPrivacySettings</span><span>(</span><span>privacySettings</span><span>: </span><a href="/publisher-tag/reference#googletag.PrivacySettingsConfig">PrivacySettingsConfig</a><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code><p>Allows configuration of all privacy settings from a single API using a config object.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_26" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setPrivacySettings({ restrictDataProcessing: true, }); // Set multiple privacy settings at the same time. googletag.pubads().setPrivacySettings({ childDirectedTreatment: true, underAgeOfConsent: true, }); // Clear the configuration for childDirectedTreatment. googletag.pubads().setPrivacySettings({ childDirectedTreatment: null, }); </pre></section><section><h3 id="javascript-legacy_26" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setPrivacySettings({ restrictDataProcessing: true, }); // Set multiple privacy settings at the same time. googletag.pubads().setPrivacySettings({ childDirectedTreatment: true, underAgeOfConsent: true, }); // Clear the configuration for childDirectedTreatment. googletag.pubads().setPrivacySettings({ childDirectedTreatment: null, }); </pre></section><section><h3 id="typescript_26" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setPrivacySettings({ restrictDataProcessing: true, }); // Set multiple privacy settings at the same time. googletag.pubads().setPrivacySettings({ childDirectedTreatment: true, underAgeOfConsent: true, }); // Clear the configuration for childDirectedTreatment. googletag.pubads().setPrivacySettings({ childDirectedTreatment: null, }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul> <li><a href="https://developers.google.com/publisher-tag/samples/configure-privacy">Configure privacy settings</a></li> <li><a href="https://developers.google.com/publisher-tag/samples/display-limited-ad">Display a limited ad</a></li> </ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>privacySettings</span>: <a href="/publisher-tag/reference#googletag.PrivacySettingsConfig">PrivacySettingsConfig</a></code></td><td>Object containing privacy settings config.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code></td><td>The service object on which the function was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.setPublisherProvidedId" data-text="setPublisherProvidedId" tabindex="-1"><a id="googletag.PubAdsService_setPublisherProvidedId"></a><span>setPublisherProvidedId</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>setPublisherProvidedId</span><span>(</span><span>ppid</span><span>: </span><span>string</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code><p>Sets the value for the publisher-provided ID.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_27" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setPublisherProvidedId(&quot;12JD92JD8078S8J29SDOAKC0EF230337&quot;); </pre></section><section><h3 id="javascript-legacy_27" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setPublisherProvidedId(&quot;12JD92JD8078S8J29SDOAKC0EF230337&quot;); </pre></section><section><h3 id="typescript_27" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setPublisherProvidedId(&quot;12JD92JD8078S8J29SDOAKC0EF230337&quot;); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://support.google.com/admanager/answer/2880055">About publisher provided identifiers</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>ppid</span>: <span>string</span></code></td><td>An alphanumeric ID provided by the publisher. Must be between 32 and 150 characters.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code></td><td>The service object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.setSafeFrameConfig" data-text="setSafeFrameConfig" tabindex="-1"><a id="googletag.PubAdsService_setSafeFrameConfig"></a><span>setSafeFrameConfig</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>setSafeFrameConfig</span><span>(</span><span>config</span><span>: </span><a href="/publisher-tag/reference#googletag.SafeFrameConfig">SafeFrameConfig</a><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code><p>Sets the page-level preferences for SafeFrame configuration. Any unrecognized keys in the config object will be ignored. The entire config will be ignored if an invalid value is passed for a recognized key.<br><br>These page-level preferences will be overridden by slot-level preferences, if specified.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_28" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setForceSafeFrame(true); const pageConfig = { allowOverlayExpansion: true, allowPushExpansion: true, sandbox: true, }; const slotConfig = { allowOverlayExpansion: false }; googletag.pubads().setSafeFrameConfig(pageConfig); // The following slot will not allow for expansion by overlay. googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div-1&quot;) .setSafeFrameConfig(slotConfig) .addService(googletag.pubads()); // The following slot will inherit the page level settings, and hence // would allow for expansion by overlay. googletag.defineSlot(&quot;/1234567/news&quot;, [160, 600], &quot;div-2&quot;).addService(googletag.pubads()); googletag.display(&quot;div-1&quot;); googletag.display(&quot;div-2&quot;); </pre></section><section><h3 id="javascript-legacy_28" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setForceSafeFrame(true); var pageConfig = { allowOverlayExpansion: true, allowPushExpansion: true, sandbox: true, }; var slotConfig = { allowOverlayExpansion: false }; googletag.pubads().setSafeFrameConfig(pageConfig); // The following slot will not allow for expansion by overlay. googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div-1&quot;) .setSafeFrameConfig(slotConfig) .addService(googletag.pubads()); // The following slot will inherit the page level settings, and hence // would allow for expansion by overlay. googletag.defineSlot(&quot;/1234567/news&quot;, [160, 600], &quot;div-2&quot;).addService(googletag.pubads()); googletag.display(&quot;div-1&quot;); googletag.display(&quot;div-2&quot;); </pre></section><section><h3 id="typescript_28" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setForceSafeFrame(true); const pageConfig = { allowOverlayExpansion: true, allowPushExpansion: true, sandbox: true, }; const slotConfig = { allowOverlayExpansion: false }; googletag.pubads().setSafeFrameConfig(pageConfig); // The following slot will not allow for expansion by overlay. googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div-1&quot;)! .setSafeFrameConfig(slotConfig) .addService(googletag.pubads()); // The following slot will inherit the page level settings, and hence // would allow for expansion by overlay. googletag.defineSlot(&quot;/1234567/news&quot;, [160, 600], &quot;div-2&quot;)!.addService(googletag.pubads()); googletag.display(&quot;div-1&quot;); googletag.display(&quot;div-2&quot;); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://support.google.com/admanager/answer/6023110">Render creatives using SafeFrame</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>config</span>: <a href="/publisher-tag/reference#googletag.SafeFrameConfig">SafeFrameConfig</a></code></td><td>The configuration object.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code></td><td>The service object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.setTargeting" data-text="setTargeting" tabindex="-1"><a id="googletag.PubAdsService_setTargeting"></a><span>setTargeting</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>setTargeting</span><span>(</span><span>key</span><span>: </span><span>string</span>, <span>value</span><span>: </span><span>string</span><span> | </span><span>string</span><span>[]</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code><p>Sets custom targeting parameters for a given key that apply to all Publisher Ads service ad slots. Calling this multiple times for the same key will overwrite old values. These keys are defined in your Google Ad Manager account.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_29" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Example with a single value for a key. googletag.pubads().setTargeting(&quot;interests&quot;, &quot;sports&quot;); // Example with multiple values for a key inside in an array. googletag.pubads().setTargeting(&quot;interests&quot;, [&quot;sports&quot;, &quot;music&quot;]); </pre></section><section><h3 id="javascript-legacy_29" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// Example with a single value for a key. googletag.pubads().setTargeting(&quot;interests&quot;, &quot;sports&quot;); // Example with multiple values for a key inside in an array. googletag.pubads().setTargeting(&quot;interests&quot;, [&quot;sports&quot;, &quot;music&quot;]); </pre></section><section><h3 id="typescript_29" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Example with a single value for a key. googletag.pubads().setTargeting(&quot;interests&quot;, &quot;sports&quot;); // Example with multiple values for a key inside in an array. googletag.pubads().setTargeting(&quot;interests&quot;, [&quot;sports&quot;, &quot;music&quot;]); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/guides/key-value-targeting">Key-value targeting</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>key</span>: <span>string</span></code></td><td>Targeting parameter key.</td></tr><tr><td><code translate="no" dir="ltr"><span>value</span>: <span>string</span><span> | </span><span>string</span><span>[]</span></code></td><td>Targeting parameter value or array of values.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code></td><td>The service object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.setVideoContent" data-text="setVideoContent" tabindex="-1"><a id="googletag.PubAdsService_setVideoContent"></a><span>setVideoContent</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>setVideoContent</span><span>(</span><span>videoContentId</span><span>: </span><span>string</span>, <span>videoCmsId</span><span>: </span><span>string</span><span>)</span><span>: </span><span>void</span></code><p>Sets the video content information to be sent along with the ad requests for targeting and content exclusion purposes. Video ads will be automatically enabled when this method is called. For <code translate="no" dir="ltr">videoContentId</code> and <code translate="no" dir="ltr">videoCmsId</code>, use the values that are provided to the Google Ad Manager content ingestion service.<dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://support.google.com/admanager/answer/1068325">VAST ad tag URL parameters</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>videoContentId</span>: <span>string</span></code></td><td>The video content ID.</td></tr><tr><td><code translate="no" dir="ltr"><span>videoCmsId</span>: <span>string</span></code></td><td>The video CMS ID.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.PubAdsService.updateCorrelator" data-text="updateCorrelator" tabindex="-1"><a id="googletag.PubAdsService_updateCorrelator"></a><span>updateCorrelator</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>updateCorrelator</span><span>(</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code><p>Changes the correlator that is sent with ad requests, effectively starting a new page view. The correlator is the same for all the ad requests coming from one page view, and unique across page views. Only applies to async mode.<br><br><strong>Note:</strong> this has no effect on GPT&#39;s <a href="https://support.google.com/admanager/answer/183281">long-lived pageview</a>, which automatically reflects the ads actually on the page and has no expiration time.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_30" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Assume that the correlator is currently 12345. All ad requests made // by this page will currently use that value. // Replace the current correlator with a new correlator. googletag.pubads().updateCorrelator(); // The correlator will now be a new randomly selected value, different // from 12345. All subsequent ad requests made by this page will use // the new value. </pre></section><section><h3 id="javascript-legacy_30" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// Assume that the correlator is currently 12345. All ad requests made // by this page will currently use that value. // Replace the current correlator with a new correlator. googletag.pubads().updateCorrelator(); // The correlator will now be a new randomly selected value, different // from 12345. All subsequent ad requests made by this page will use // the new value. </pre></section><section><h3 id="typescript_30" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Assume that the correlator is currently 12345. All ad requests made // by this page will currently use that value. // Replace the current correlator with a new correlator. googletag.pubads().updateCorrelator(); // The correlator will now be a new randomly selected value, different // from 12345. All subsequent ad requests made by this page will use // the new value. </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a></code></td><td>The service object on which the function was called.</td></tr></table></p></ul></section></section></section><hr/><section><a id="googletag_ResponseInformation"></a><h2 id="googletag.ResponseInformation" data-text="googletag.ResponseInformation" tabindex="-1">googletag.ResponseInformation</h2><div>An object representing a single ad response.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.ResponseInformation.advertiserId"><span>advertiser<wbr/>Id<wbr/></span><span></span></a></code></td><td><div>The ID of the advertiser.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.ResponseInformation.campaignId"><span>campaign<wbr/>Id<wbr/></span><span></span></a></code></td><td><div>The ID of the campaign.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.ResponseInformation.creativeId"><span>creative<wbr/>Id<wbr/></span><span></span></a></code></td><td><div>The ID of the creative.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.ResponseInformation.creativeTemplateId"><span>creative<wbr/>Template<wbr/>Id<wbr/></span><span></span></a></code></td><td><div>The template ID of the ad.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.ResponseInformation.lineItemId"><span>line<wbr/>Item<wbr/>Id<wbr/></span><span></span></a></code></td><td><div>The ID of the line item.</div></td></tr></table></section><section><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="/publisher-tag/reference#googletag.Slot.getResponseInformation">Slot.getResponseInformation</a></li></ul></dd></dl></section><section><h3 class="hide-from-toc" id="googletag.ResponseInformation_Properties" data-text="Properties" tabindex="-1">Properties</h3><section><hr/><h4 id="googletag.ResponseInformation.advertiserId" data-text="advertiserId" tabindex="-1"><a id="googletag.ResponseInformation_advertiserId"></a><span>advertiserId</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>advertiserId</span><span>:</span> <span>null</span><span> | </span><span>number</span></code></div><p>The ID of the advertiser.</p></ul></section><section><hr/><h4 id="googletag.ResponseInformation.campaignId" data-text="campaignId" tabindex="-1"><a id="googletag.ResponseInformation_campaignId"></a><span>campaignId</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>campaignId</span><span>:</span> <span>null</span><span> | </span><span>number</span></code></div><p>The ID of the campaign.</p></ul></section><section><hr/><h4 id="googletag.ResponseInformation.creativeId" data-text="creativeId" tabindex="-1"><a id="googletag.ResponseInformation_creativeId"></a><span>creativeId</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>creativeId</span><span>:</span> <span>null</span><span> | </span><span>number</span></code></div><p>The ID of the creative.</p></ul></section><section><hr/><h4 id="googletag.ResponseInformation.creativeTemplateId" data-text="creativeTemplateId" tabindex="-1"><a id="googletag.ResponseInformation_creativeTemplateId"></a><span>creativeTemplateId</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>creativeTemplateId</span><span>:</span> <span>null</span><span> | </span><span>number</span></code></div><p>The template ID of the ad.</p></ul></section><section><hr/><h4 id="googletag.ResponseInformation.lineItemId" data-text="lineItemId" tabindex="-1"><a id="googletag.ResponseInformation_lineItemId"></a><span>lineItemId</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>lineItemId</span><span>:</span> <span>null</span><span> | </span><span>number</span></code></div><p>The ID of the line item.</p></ul></section></section></section><hr/><section><a id="googletag_RewardedPayload"></a><h2 id="googletag.RewardedPayload" data-text="googletag.RewardedPayload" tabindex="-1">googletag.RewardedPayload</h2><div>An object representing the reward associated with a <a href="https://support.google.com/admanager/answer/9116812">rewarded ad</a></div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.RewardedPayload.amount"><span>amount<wbr/></span><span></span></a></code></td><td><div>The number of items included in the reward.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.RewardedPayload.type"><span>type<wbr/></span><span></span></a></code></td><td><div>The type of item included in the reward (for example, &quot;coin&quot;).</div></td></tr></table></section><section><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/samples/display-rewarded-ad">Display a rewarded ad</a></li></ul></dd></dl></section><section><h3 class="hide-from-toc" id="googletag.RewardedPayload_Properties" data-text="Properties" tabindex="-1">Properties</h3><section><hr/><h4 id="googletag.RewardedPayload.amount" data-text="amount" tabindex="-1"><a id="googletag.RewardedPayload_amount"></a><span>amount</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>amount</span><span>:</span> <span>number</span></code></div><p>The number of items included in the reward.</p></ul></section><section><hr/><h4 id="googletag.RewardedPayload.type" data-text="type" tabindex="-1"><a id="googletag.RewardedPayload_type"></a><span>type</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>type</span><span>:</span> <span>string</span></code></div><p>The type of item included in the reward (for example, &quot;coin&quot;).</p></ul></section></section></section><hr/><section><a id="googletag_SafeFrameConfig"></a><h2 id="googletag.SafeFrameConfig" data-text="googletag.SafeFrameConfig" tabindex="-1">googletag.SafeFrameConfig</h2><div>Configuration object for <a href="https://support.google.com/admanager/answer/6023110">SafeFrame</a> containers.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.SafeFrameConfig.allowOverlayExpansion"><span>allow<wbr/>Overlay<wbr/>Expansion<wbr/></span><span>?</span></a></code></td><td><div>Whether SafeFrame should allow ad content to expand by overlaying page content.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.SafeFrameConfig.allowPushExpansion"><span>allow<wbr/>Push<wbr/>Expansion<wbr/></span><span>?</span></a></code></td><td><div>Whether SafeFrame should allow ad content to expand by pushing page content.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.SafeFrameConfig.sandbox"><span>sandbox<wbr/></span><span>?</span></a></code></td><td><div>Whether SafeFrame should use the HTML5 sandbox attribute to prevent top level navigation without user interaction.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.SafeFrameConfig.useUniqueDomain"><span>use<wbr/>Unique<wbr/>Domain<wbr/></span><span>?</span></a></code></td><td><div><b>Deprecated. </b>Whether SafeFrame should use randomized subdomains for Reservation creatives.</div></td></tr></table></section><section><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="/publisher-tag/reference#googletag.PubAdsService.setSafeFrameConfig">PubAdsService.setSafeFrameConfig</a></li></ul></dd></dl></section><section><h3 class="hide-from-toc" id="googletag.SafeFrameConfig_Properties" data-text="Properties" tabindex="-1">Properties</h3><section><hr/><h4 id="googletag.SafeFrameConfig.allowOverlayExpansion" data-text="Optional allowOverlayExpansion" tabindex="-1"><a id="googletag.SafeFrameConfig_allowOverlayExpansion"></a><code translate="no" dir="ltr">Optional</code> <span>allowOverlayExpansion</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>allowOverlayExpansion</span><span>?:</span> <span>boolean</span></code></div><p>Whether SafeFrame should allow ad content to expand by overlaying page content.</p></ul></section><section><hr/><h4 id="googletag.SafeFrameConfig.allowPushExpansion" data-text="Optional allowPushExpansion" tabindex="-1"><a id="googletag.SafeFrameConfig_allowPushExpansion"></a><code translate="no" dir="ltr">Optional</code> <span>allowPushExpansion</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>allowPushExpansion</span><span>?:</span> <span>boolean</span></code></div><p>Whether SafeFrame should allow ad content to expand by pushing page content.</p></ul></section><section><hr/><h4 id="googletag.SafeFrameConfig.sandbox" data-text="Optional sandbox" tabindex="-1"><a id="googletag.SafeFrameConfig_sandbox"></a><code translate="no" dir="ltr">Optional</code> <span>sandbox</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>sandbox</span><span>?:</span> <span>boolean</span></code></div><p>Whether SafeFrame should use the HTML5 sandbox attribute to prevent top level navigation without user interaction. The only valid value is <code translate="no" dir="ltr">true</code> (cannot be forced to <code translate="no" dir="ltr">false</code>). Note that the sandbox attribute disables plugins (e.g. Flash).</p></ul></section><section><hr/><h4 id="googletag.SafeFrameConfig.useUniqueDomain" data-text="Optional useUniqueDomain" tabindex="-1"><a id="googletag.SafeFrameConfig_useUniqueDomain"></a><code translate="no" dir="ltr">Optional</code> <span>useUniqueDomain</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>useUniqueDomain</span><span>?:</span> <span>null</span><span> | </span><span>boolean</span></code></div><p>Whether SafeFrame should use randomized subdomains for Reservation creatives. Pass in <code translate="no" dir="ltr">null</code> to clear the stored value.<br><br>Note: this feature is enabled by default.</p><aside class="warning"><b>Deprecated:</b> It is no longer possible to disable this feature. Setting <code translate="no" dir="ltr">useUniqueDomain</code> has no effect.</aside><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://support.google.com/admanager/answer/9999596">Render creatives using SafeFrame</a></li></ul></dd></dl></ul></section></section></section><hr/><section><a id="googletag_Service"></a><h2 id="googletag.Service" data-text="googletag.Service" tabindex="-1">googletag.Service</h2><div>Base service class that contains methods common for all services.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Methods</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Service.addEventListener"><span>add<wbr/>Event<wbr/>Listener<wbr/></span><span></span></a></code></td><td><div>Registers a listener that allows you to set up and call a JavaScript function when a specific GPT event happens on the page.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Service.getSlots"><span>get<wbr/>Slots<wbr/></span><span></span></a></code></td><td><div>Get the list of slots associated with this service.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Service.removeEventListener"><span>remove<wbr/>Event<wbr/>Listener<wbr/></span><span></span></a></code></td><td><div>Removes a previously registered listener.</div></td></tr></table></section><section></section><section><h3 class="hide-from-toc" id="googletag.Service_Methods" data-text="Methods" tabindex="-1">Methods</h3><section><hr/><h4 id="googletag.Service.addEventListener" data-text="addEventListener" tabindex="-1"><a id="googletag.Service_addEventListener"></a><span>addEventListener</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>addEventListener</span><span>&lt;</span><span>K</span><span> extends </span><span>keyof </span><a href="/publisher-tag/reference#googletag.events.EventTypeMap">EventTypeMap</a><span>&gt;</span><span>(</span><span>eventType</span><span>: </span><a href="/publisher-tag/reference#googletag.CompanionAdsService.addEventListener.addEventListener.K">K</a>, <span>listener</span><span>: </span><span>(</span><span>(</span><span>arg</span><span>: </span><a href="/publisher-tag/reference#googletag.events.EventTypeMap">EventTypeMap</a><span>[</span><a href="/publisher-tag/reference#googletag.CompanionAdsService.addEventListener.addEventListener.K">K</a><span>]</span><span>)</span><span> =&gt; </span><span>void</span><span>)</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.Service">Service</a></code><p>Registers a listener that allows you to set up and call a JavaScript function when a specific GPT event happens on the page. The following events are supported:<ul> <li><a href="/publisher-tag/reference#googletag.events.GameManualInterstitialSlotClosedEvent">events.GameManualInterstitialSlotClosedEvent</a></li> <li><a href="/publisher-tag/reference#googletag.events.GameManualInterstitialSlotReadyEvent">events.GameManualInterstitialSlotReadyEvent</a></li> <li><a href="/publisher-tag/reference#googletag.events.ImpressionViewableEvent">events.ImpressionViewableEvent</a></li> <li><a href="/publisher-tag/reference#googletag.events.RewardedSlotClosedEvent">events.RewardedSlotClosedEvent</a></li> <li><a href="/publisher-tag/reference#googletag.events.RewardedSlotGrantedEvent">events.RewardedSlotGrantedEvent</a></li> <li><a href="/publisher-tag/reference#googletag.events.RewardedSlotReadyEvent">events.RewardedSlotReadyEvent</a></li> <li><a href="/publisher-tag/reference#googletag.events.SlotOnloadEvent">events.SlotOnloadEvent</a></li> <li><a href="/publisher-tag/reference#googletag.events.SlotRenderEndedEvent">events.SlotRenderEndedEvent</a></li> <li><a href="/publisher-tag/reference#googletag.events.SlotRequestedEvent">events.SlotRequestedEvent</a></li> <li><a href="/publisher-tag/reference#googletag.events.SlotResponseReceived">events.SlotResponseReceived</a></li> <li><a href="/publisher-tag/reference#googletag.events.SlotVisibilityChangedEvent">events.SlotVisibilityChangedEvent</a></li> </ul> An object of the appropriate event type is passed to the listener when it is called.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_31" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// 1. Adding an event listener for the PubAdsService. googletag.pubads().addEventListener(&quot;slotOnload&quot;, (event) =&gt; { console.log(&quot;Slot has been loaded:&quot;); console.log(event); }); // 2. Adding an event listener with slot specific logic. // Listeners operate at service level, which means that you cannot add // a listener for an event for a specific slot only. You can, however, // programmatically filter a listener to respond only to a certain ad // slot, using this pattern: const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;slotOnload&quot;, (event) =&gt; { if (event.slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="javascript-legacy_31" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// 1. Adding an event listener for the PubAdsService. googletag.pubads().addEventListener(&quot;slotOnload&quot;, function (event) { console.log(&quot;Slot has been loaded:&quot;); console.log(event); }); // 2. Adding an event listener with slot specific logic. // Listeners operate at service level, which means that you cannot add // a listener for an event for a specific slot only. You can, however, // programmatically filter a listener to respond only to a certain ad // slot, using this pattern: var targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;slotOnload&quot;, function (event) { if (event.slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="typescript_31" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// 1. Adding an event listener for the PubAdsService. googletag.pubads().addEventListener(&quot;slotOnload&quot;, (event) =&gt; { console.log(&quot;Slot has been loaded:&quot;); console.log(event); }); // 2. Adding an event listener with slot specific logic. // Listeners operate at service level, which means that you cannot add // a listener for an event for a specific slot only. You can, however, // programmatically filter a listener to respond only to a certain ad // slot, using this pattern: const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;slotOnload&quot;, (event) =&gt; { if (event.slot === targetSlot) { // Slot specific logic. } }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/samples/ad-event-listeners">Ad event listeners</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>eventType</span>: <a href="/publisher-tag/reference#googletag.CompanionAdsService.addEventListener.addEventListener.K">K</a></code></td><td>A string representing the type of event generated by GPT. Event types are case sensitive.</td></tr><tr><td><code translate="no" dir="ltr"><span>listener</span>: <span>(</span><span>(</span><span>arg</span><span>: </span><a href="/publisher-tag/reference#googletag.events.EventTypeMap">EventTypeMap</a><span>[</span><a href="/publisher-tag/reference#googletag.CompanionAdsService.addEventListener.addEventListener.K">K</a><span>]</span><span>)</span><span> =&gt; </span><span>void</span><span>)</span></code></td><td>Function that takes a single event object argument.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Service">Service</a></code></td><td>The service object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Service.getSlots" data-text="getSlots" tabindex="-1"><a id="googletag.Service_getSlots"></a><span>getSlots</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>getSlots</span><span>(</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a><span>[]</span></code><p>Get the list of slots associated with this service.<table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot">Slot</a><span>[]</span></code></td><td>Slots in the order in which they were added to the service.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Service.removeEventListener" data-text="removeEventListener" tabindex="-1"><a id="googletag.Service_removeEventListener"></a><span>removeEventListener</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>removeEventListener</span><span>&lt;</span><span>K</span><span> extends </span><span>keyof </span><a href="/publisher-tag/reference#googletag.events.EventTypeMap">EventTypeMap</a><span>&gt;</span><span>(</span><span>eventType</span><span>: </span><a href="/publisher-tag/reference#googletag.CompanionAdsService.removeEventListener.removeEventListener.K">K</a>, <span>listener</span><span>: </span><span>(</span><span>(</span><span>event</span><span>: </span><a href="/publisher-tag/reference#googletag.events.EventTypeMap">EventTypeMap</a><span>[</span><a href="/publisher-tag/reference#googletag.CompanionAdsService.removeEventListener.removeEventListener.K">K</a><span>]</span><span>)</span><span> =&gt; </span><span>void</span><span>)</span><span>)</span><span>: </span><span>void</span></code><p>Removes a previously registered listener.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_32" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.cmd.push(() =&gt; { // Define a new ad slot. googletag.defineSlot(&quot;/6355419/Travel&quot;, [728, 90], &quot;div-for-slot&quot;).addService(googletag.pubads()); // Define a new function that removes itself via removeEventListener // after the impressionViewable event fires. const onViewableListener = (event) =&gt; { googletag.pubads().removeEventListener(&quot;impressionViewable&quot;, onViewableListener); setTimeout(() =&gt; { googletag.pubads().refresh([event.slot]); }, 30000); }; // Add onViewableListener as a listener for impressionViewable events. googletag.pubads().addEventListener(&quot;impressionViewable&quot;, onViewableListener); googletag.enableServices(); }); </pre></section><section><h3 id="javascript-legacy_32" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.cmd.push(function () { // Define a new ad slot. googletag.defineSlot(&quot;/6355419/Travel&quot;, [728, 90], &quot;div-for-slot&quot;).addService(googletag.pubads()); // Define a new function that removes itself via removeEventListener // after the impressionViewable event fires. var onViewableListener = function (event) { googletag.pubads().removeEventListener(&quot;impressionViewable&quot;, onViewableListener); setTimeout(function () { googletag.pubads().refresh([event.slot]); }, 30000); }; // Add onViewableListener as a listener for impressionViewable events. googletag.pubads().addEventListener(&quot;impressionViewable&quot;, onViewableListener); googletag.enableServices(); }); </pre></section><section><h3 id="typescript_32" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.cmd.push(() =&gt; { // Define a new ad slot. googletag .defineSlot(&quot;/6355419/Travel&quot;, [728, 90], &quot;div-for-slot&quot;)! .addService(googletag.pubads()); // Define a new function that removes itself via removeEventListener // after the impressionViewable event fires. const onViewableListener = (event: googletag.events.ImpressionViewableEvent) =&gt; { googletag.pubads().removeEventListener(&quot;impressionViewable&quot;, onViewableListener); setTimeout(() =&gt; { googletag.pubads().refresh([event.slot]); }, 30000); }; // Add onViewableListener as a listener for impressionViewable events. googletag.pubads().addEventListener(&quot;impressionViewable&quot;, onViewableListener); googletag.enableServices(); }); </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>eventType</span>: <a href="/publisher-tag/reference#googletag.CompanionAdsService.removeEventListener.removeEventListener.K">K</a></code></td><td>A string representing the type of event generated by GPT. Event types are case sensitive.</td></tr><tr><td><code translate="no" dir="ltr"><span>listener</span>: <span>(</span><span>(</span><span>event</span><span>: </span><a href="/publisher-tag/reference#googletag.events.EventTypeMap">EventTypeMap</a><span>[</span><a href="/publisher-tag/reference#googletag.CompanionAdsService.removeEventListener.removeEventListener.K">K</a><span>]</span><span>)</span><span> =&gt; </span><span>void</span><span>)</span></code></td><td>Function that takes a single event object argument.</td></tr></table></p></ul></section></section></section><hr/><section><a id="googletag_SizeMappingBuilder"></a><h2 id="googletag.SizeMappingBuilder" data-text="googletag.SizeMappingBuilder" tabindex="-1">googletag.SizeMappingBuilder</h2><div>Builder for size mapping specification objects. This builder is provided to help easily construct size specifications.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Methods</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.SizeMappingBuilder.addSize"><span>add<wbr/>Size<wbr/></span><span></span></a></code></td><td><div>Adds a mapping from a single-size array (representing the viewport) to a single- or multi-size array representing the slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.SizeMappingBuilder.build"><span>build<wbr/></span><span></span></a></code></td><td><div>Builds a size map specification from the mappings added to this builder.</div></td></tr></table></section><section><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/guides/ad-sizes#responsive_ads">Ad sizes: Responsive ads</a></li></ul></dd></dl></section><section><h3 class="hide-from-toc" id="googletag.SizeMappingBuilder_Methods" data-text="Methods" tabindex="-1">Methods</h3><section><hr/><h4 id="googletag.SizeMappingBuilder.addSize" data-text="addSize" tabindex="-1"><a id="googletag.SizeMappingBuilder_addSize"></a><span>addSize</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>addSize</span><span>(</span><span>viewportSize</span><span>: </span><a href="/publisher-tag/reference#googletag.SingleSizeArray">SingleSizeArray</a>, <span>slotSize</span><span>: </span><a href="/publisher-tag/reference#googletag.GeneralSize">GeneralSize</a><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.SizeMappingBuilder">SizeMappingBuilder</a></code><p>Adds a mapping from a single-size array (representing the viewport) to a single- or multi-size array representing the slot.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_33" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Mapping 1 googletag .sizeMapping() .addSize([1024, 768], [970, 250]) .addSize([980, 690], [728, 90]) .addSize([640, 480], &quot;fluid&quot;) .addSize([0, 0], [88, 31]) // All viewports &amp;lt; 640x480 .build(); // Mapping 2 googletag .sizeMapping() .addSize([1024, 768], [970, 250]) .addSize([980, 690], []) .addSize([640, 480], [120, 60]) .addSize([0, 0], []) .build(); // Mapping 2 will not show any ads for the following viewport sizes: // [1024, 768] &gt; size &gt;= [980, 690] and // [640, 480] &gt; size &gt;= [0, 0] </pre></section><section><h3 id="javascript-legacy_33" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// Mapping 1 googletag .sizeMapping() .addSize([1024, 768], [970, 250]) .addSize([980, 690], [728, 90]) .addSize([640, 480], &quot;fluid&quot;) .addSize([0, 0], [88, 31]) // All viewports &amp;lt; 640x480 .build(); // Mapping 2 googletag .sizeMapping() .addSize([1024, 768], [970, 250]) .addSize([980, 690], []) .addSize([640, 480], [120, 60]) .addSize([0, 0], []) .build(); // Mapping 2 will not show any ads for the following viewport sizes: // [1024, 768] &gt; size &gt;= [980, 690] and // [640, 480] &gt; size &gt;= [0, 0] </pre></section><section><h3 id="typescript_33" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Mapping 1 googletag .sizeMapping() .addSize([1024, 768], [970, 250]) .addSize([980, 690], [728, 90]) .addSize([640, 480], &quot;fluid&quot;) .addSize([0, 0], [88, 31]) // All viewports &amp;lt; 640x480 .build(); // Mapping 2 googletag .sizeMapping() .addSize([1024, 768], [970, 250]) .addSize([980, 690], []) .addSize([640, 480], [120, 60]) .addSize([0, 0], []) .build(); // Mapping 2 will not show any ads for the following viewport sizes: // [1024, 768] &gt; size &gt;= [980, 690] and // [640, 480] &gt; size &gt;= [0, 0] </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>viewportSize</span>: <a href="/publisher-tag/reference#googletag.SingleSizeArray">SingleSizeArray</a></code></td><td>The size of the viewport for this mapping entry.</td></tr><tr><td><code translate="no" dir="ltr"><span>slotSize</span>: <a href="/publisher-tag/reference#googletag.GeneralSize">GeneralSize</a></code></td><td>The sizes of the slot for this mapping entry.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.SizeMappingBuilder">SizeMappingBuilder</a></code></td><td>A reference to this builder.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.SizeMappingBuilder.build" data-text="build" tabindex="-1"><a id="googletag.SizeMappingBuilder_build"></a><span>build</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>build</span><span>(</span><span>)</span><span>: </span><span>null</span><span> | </span><a href="/publisher-tag/reference#googletag.SizeMappingArray">SizeMappingArray</a></code><p>Builds a size map specification from the mappings added to this builder.<br><br>If any invalid mappings have been supplied, this method will return <code translate="no" dir="ltr">null</code>. Otherwise it returns a specification in the correct format to pass to <a href="/publisher-tag/reference#googletag.Slot.defineSizeMapping">Slot.defineSizeMapping</a>.<br><br>Note: the behavior of the builder after calling this method is undefined.<table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>null</span><span> | </span><a href="/publisher-tag/reference#googletag.SizeMappingArray">SizeMappingArray</a></code></td><td>The result built by this builder. Can be null if invalid size mappings were supplied.</td></tr></table></p></ul></section></section></section><hr/><section><a id="googletag_Slot"></a><h2 id="googletag.Slot" data-text="googletag.Slot" tabindex="-1">googletag.Slot</h2><div>Slot is an object representing a single ad slot on a page.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Methods</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.addService"><span>add<wbr/>Service<wbr/></span><span></span></a></code></td><td><div>Adds a <a href="/publisher-tag/reference#googletag.Service">Service</a> to this slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.clearCategoryExclusions"><span>clear<wbr/>Category<wbr/>Exclusions<wbr/></span><span></span></a></code></td><td><div>Clears all slot-level ad category exclusion labels for this slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.clearTargeting"><span>clear<wbr/>Targeting<wbr/></span><span></span></a></code></td><td><div>Clears specific or all custom slot-level targeting parameters for this slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.defineSizeMapping"><span>define<wbr/>Size<wbr/>Mapping<wbr/></span><span></span></a></code></td><td><div>Sets an array of mappings from a minimum viewport size to slot size for this slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.get"><span>get<wbr/></span><span></span></a></code></td><td><div>Returns the value for the AdSense attribute associated with the given key for this slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.getAdUnitPath"><span>get<wbr/>Ad<wbr/>Unit<wbr/>Path<wbr/></span><span></span></a></code></td><td><div>Returns the full path of the ad unit, with the network code and ad unit path.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.getAttributeKeys"><span>get<wbr/>Attribute<wbr/>Keys<wbr/></span><span></span></a></code></td><td><div>Returns the list of attribute keys set on this slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.getCategoryExclusions"><span>get<wbr/>Category<wbr/>Exclusions<wbr/></span><span></span></a></code></td><td><div>Returns the ad category exclusion labels for this slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.getResponseInformation"><span>get<wbr/>Response<wbr/>Information<wbr/></span><span></span></a></code></td><td><div>Returns the ad response information.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.getSlotElementId"><span>get<wbr/>Slot<wbr/>Element<wbr/>Id<wbr/></span><span></span></a></code></td><td><div>Returns the ID of the slot <code translate="no" dir="ltr">div</code> provided when the slot was defined.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.getTargeting"><span>get<wbr/>Targeting<wbr/></span><span></span></a></code></td><td><div>Returns a specific custom targeting parameter set on this slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.getTargetingKeys"><span>get<wbr/>Targeting<wbr/>Keys<wbr/></span><span></span></a></code></td><td><div>Returns the list of all custom targeting keys set on this slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.set"><span>set<wbr/></span><span></span></a></code></td><td><div>Sets a value for an AdSense attribute on this ad slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.setCategoryExclusion"><span>set<wbr/>Category<wbr/>Exclusion<wbr/></span><span></span></a></code></td><td><div>Sets a slot-level ad category exclusion label on this slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.setClickUrl"><span>set<wbr/>Click<wbr/>Url<wbr/></span><span></span></a></code></td><td><div>Sets the click URL to which users will be redirected after clicking on the ad.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.setCollapseEmptyDiv"><span>set<wbr/>Collapse<wbr/>Empty<wbr/>Div<wbr/></span><span></span></a></code></td><td><div>Sets whether the slot <code translate="no" dir="ltr">div</code> should be hidden when there is no ad in the slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.setConfig"><span>set<wbr/>Config<wbr/></span><span></span></a></code></td><td><div>Sets general configuration options for this slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.setForceSafeFrame"><span>set<wbr/>Force<wbr/>Safe<wbr/>Frame<wbr/></span><span></span></a></code></td><td><div>Configures whether ads in this slot should be forced to be rendered using a SafeFrame container.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.setSafeFrameConfig"><span>set<wbr/>Safe<wbr/>Frame<wbr/>Config<wbr/></span><span></span></a></code></td><td><div>Sets the slot-level preferences for SafeFrame configuration.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.setTargeting"><span>set<wbr/>Targeting<wbr/></span><span></span></a></code></td><td><div>Sets a custom targeting parameter for this slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot.updateTargetingFromMap"><span>update<wbr/>Targeting<wbr/>From<wbr/>Map<wbr/></span><span></span></a></code></td><td><div>Sets custom targeting parameters for this slot, from a key:value map in a JSON object.</div></td></tr></table></section><section></section><section><h3 class="hide-from-toc" id="googletag.Slot_Methods" data-text="Methods" tabindex="-1">Methods</h3><section><hr/><h4 id="googletag.Slot.addService" data-text="addService" tabindex="-1"><a id="googletag.Slot_addService"></a><span>addService</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>addService</span><span>(</span><span>service</span><span>: </span><a href="/publisher-tag/reference#googletag.Service">Service</a><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code><p>Adds a <a href="/publisher-tag/reference#googletag.Service">Service</a> to this slot.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_34" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;).addService(googletag.pubads()); </pre></section><section><h3 id="javascript-legacy_34" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;).addService(googletag.pubads()); </pre></section><section><h3 id="typescript_34" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;)!.addService(googletag.pubads()); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul> <li><a href="https://developers.google.com/publisher-tag/guides/get-started">Get Started with Google Publisher Tags</a></li> <li><a href="https://developers.google.com/publisher-tag/samples/display-test-ad">Display a test ad</a></li> </ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>service</span>: <a href="/publisher-tag/reference#googletag.Service">Service</a></code></td><td>The service to be added.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code></td><td>The slot object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.clearCategoryExclusions" data-text="clearCategoryExclusions" tabindex="-1"><a id="googletag.Slot_clearCategoryExclusions"></a><span>clearCategoryExclusions</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>clearCategoryExclusions</span><span>(</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code><p>Clears all slot-level ad category exclusion labels for this slot.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_35" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Set category exclusion to exclude ads with &#39;AirlineAd&#39; labels. const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .setCategoryExclusion(&quot;AirlineAd&quot;) .addService(googletag.pubads()); // Make an ad request. No ad with &#39;AirlineAd&#39; label will be returned // for the slot. // Clear category exclusions so all ads can be returned. slot.clearCategoryExclusions(); // Make an ad request. Any ad can be returned for the slot. </pre></section><section><h3 id="javascript-legacy_35" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// Set category exclusion to exclude ads with &#39;AirlineAd&#39; labels. var slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .setCategoryExclusion(&quot;AirlineAd&quot;) .addService(googletag.pubads()); // Make an ad request. No ad with &#39;AirlineAd&#39; label will be returned // for the slot. // Clear category exclusions so all ads can be returned. slot.clearCategoryExclusions(); // Make an ad request. Any ad can be returned for the slot. </pre></section><section><h3 id="typescript_35" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Set category exclusion to exclude ads with &#39;AirlineAd&#39; labels. const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;)! .setCategoryExclusion(&quot;AirlineAd&quot;) .addService(googletag.pubads()); // Make an ad request. No ad with &#39;AirlineAd&#39; label will be returned // for the slot. // Clear category exclusions so all ads can be returned. slot.clearCategoryExclusions(); // Make an ad request. Any ad can be returned for the slot. </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code></td><td>The slot object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.clearTargeting" data-text="clearTargeting" tabindex="-1"><a id="googletag.Slot_clearTargeting"></a><span>clearTargeting</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>clearTargeting</span><span>(</span><span>key</span><span>?: </span><span>string</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code><p>Clears specific or all custom slot-level targeting parameters for this slot.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_36" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .setTargeting(&quot;allow_expandable&quot;, &quot;true&quot;) .setTargeting(&quot;interests&quot;, [&quot;sports&quot;, &quot;music&quot;]) .setTargeting(&quot;color&quot;, &quot;red&quot;) .addService(googletag.pubads()); slot.clearTargeting(&quot;color&quot;); // Targeting &#39;allow_expandable&#39; and &#39;interests&#39; are still present, // while &#39;color&#39; was cleared. slot.clearTargeting(); // All targeting has been cleared. </pre></section><section><h3 id="javascript-legacy_36" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">var slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .setTargeting(&quot;allow_expandable&quot;, &quot;true&quot;) .setTargeting(&quot;interests&quot;, [&quot;sports&quot;, &quot;music&quot;]) .setTargeting(&quot;color&quot;, &quot;red&quot;) .addService(googletag.pubads()); slot.clearTargeting(&quot;color&quot;); // Targeting &#39;allow_expandable&#39; and &#39;interests&#39; are still present, // while &#39;color&#39; was cleared. slot.clearTargeting(); // All targeting has been cleared. </pre></section><section><h3 id="typescript_36" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;)! .setTargeting(&quot;allow_expandable&quot;, &quot;true&quot;) .setTargeting(&quot;interests&quot;, [&quot;sports&quot;, &quot;music&quot;]) .setTargeting(&quot;color&quot;, &quot;red&quot;) .addService(googletag.pubads()); slot.clearTargeting(&quot;color&quot;); // Targeting &#39;allow_expandable&#39; and &#39;interests&#39; are still present, // while &#39;color&#39; was cleared. slot.clearTargeting(); // All targeting has been cleared. </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/guides/key-value-targeting">Key-value targeting</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><code translate="no" dir="ltr">Optional</code> <span>key</span>: <span>string</span></code></td><td>Targeting parameter key. The key is optional; all targeting parameters will be cleared if it is unspecified.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code></td><td>The slot object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.defineSizeMapping" data-text="defineSizeMapping" tabindex="-1"><a id="googletag.Slot_defineSizeMapping"></a><span>defineSizeMapping</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>defineSizeMapping</span><span>(</span><span>sizeMapping</span><span>: </span><a href="/publisher-tag/reference#googletag.SizeMappingArray">SizeMappingArray</a><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code><p>Sets an array of mappings from a minimum viewport size to slot size for this slot.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_37" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .addService(googletag.pubads()); const mapping = googletag .sizeMapping() .addSize([100, 100], [88, 31]) .addSize( [320, 400], [ [320, 50], [300, 50], ], ) .build(); slot.defineSizeMapping(mapping); </pre></section><section><h3 id="javascript-legacy_37" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">var slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .addService(googletag.pubads()); var mapping = googletag .sizeMapping() .addSize([100, 100], [88, 31]) .addSize( [320, 400], [ [320, 50], [300, 50], ], ) .build(); slot.defineSizeMapping(mapping); </pre></section><section><h3 id="typescript_37" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;)! .addService(googletag.pubads()); const mapping = googletag .sizeMapping() .addSize([100, 100], [88, 31]) .addSize( [320, 400], [ [320, 50], [300, 50], ], ) .build(); slot.defineSizeMapping(mapping!); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/guides/ad-sizes#responsive_ads">Ad sizes: Responsive ads</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>sizeMapping</span>: <a href="/publisher-tag/reference#googletag.SizeMappingArray">SizeMappingArray</a></code></td><td>Array of size mappings. You can use <a href="/publisher-tag/reference#googletag.SizeMappingBuilder">SizeMappingBuilder</a> to create it. Each size mapping is an array of two elements: <a href="/publisher-tag/reference#googletag.SingleSizeArray">SingleSizeArray</a> and <a href="/publisher-tag/reference#googletag.GeneralSize">GeneralSize</a>.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code></td><td>The slot object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.get" data-text="get" tabindex="-1"><a id="googletag.Slot_get"></a><span>get</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>get</span><span>(</span><span>key</span><span>: </span><span>string</span><span>)</span><span>: </span><span>null</span><span> | </span><span>string</span></code><p>Returns the value for the AdSense attribute associated with the given key for this slot. To see service-level attributes inherited by this slot, use <a href="/publisher-tag/reference#googletag.PubAdsService.get">PubAdsService.get</a>.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_38" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .set(&quot;adsense_background_color&quot;, &quot;#FFFFFF&quot;) .addService(googletag.pubads()); slot.get(&quot;adsense_background_color&quot;); // Returns &#39;#FFFFFF&#39;. </pre></section><section><h3 id="javascript-legacy_38" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">var slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .set(&quot;adsense_background_color&quot;, &quot;#FFFFFF&quot;) .addService(googletag.pubads()); slot.get(&quot;adsense_background_color&quot;); // Returns &#39;#FFFFFF&#39;. </pre></section><section><h3 id="typescript_38" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;)! .set(&quot;adsense_background_color&quot;, &quot;#FFFFFF&quot;) .addService(googletag.pubads()); slot.get(&quot;adsense_background_color&quot;); // Returns &#39;#FFFFFF&#39;. </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/adsense_attributes">AdSense Attributes</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>key</span>: <span>string</span></code></td><td>Name of the attribute to look for.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>null</span><span> | </span><span>string</span></code></td><td>Current value for the attribute key, or <code translate="no" dir="ltr">null</code> if the key is not present.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.getAdUnitPath" data-text="getAdUnitPath" tabindex="-1"><a id="googletag.Slot_getAdUnitPath"></a><span>getAdUnitPath</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>getAdUnitPath</span><span>(</span><span>)</span><span>: </span><span>string</span></code><p>Returns the full path of the ad unit, with the network code and ad unit path.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_39" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .addService(googletag.pubads()); slot.getAdUnitPath(); // Returns &#39;/1234567/sports&#39;. </pre></section><section><h3 id="javascript-legacy_39" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">var slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .addService(googletag.pubads()); slot.getAdUnitPath(); // Returns &#39;/1234567/sports&#39;. </pre></section><section><h3 id="typescript_39" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;)! .addService(googletag.pubads()); slot.getAdUnitPath(); // Returns &#39;/1234567/sports&#39;. </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>string</span></code></td><td>Ad unit path.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.getAttributeKeys" data-text="getAttributeKeys" tabindex="-1"><a id="googletag.Slot_getAttributeKeys"></a><span>getAttributeKeys</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>getAttributeKeys</span><span>(</span><span>)</span><span>: </span><span>string</span><span>[]</span></code><p>Returns the list of attribute keys set on this slot. To see the keys of service-level attributes inherited by this slot, use <a href="/publisher-tag/reference#googletag.PubAdsService.getAttributeKeys">PubAdsService.getAttributeKeys</a>.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_40" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .set(&quot;adsense_background_color&quot;, &quot;#FFFFFF&quot;) .set(&quot;adsense_border_color&quot;, &quot;#AABBCC&quot;) .addService(googletag.pubads()); slot.getAttributeKeys(); // Returns [&#39;adsense_background_color&#39;, &#39;adsense_border_color&#39;]. </pre></section><section><h3 id="javascript-legacy_40" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">var slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .set(&quot;adsense_background_color&quot;, &quot;#FFFFFF&quot;) .set(&quot;adsense_border_color&quot;, &quot;#AABBCC&quot;) .addService(googletag.pubads()); slot.getAttributeKeys(); // Returns [&#39;adsense_background_color&#39;, &#39;adsense_border_color&#39;]. </pre></section><section><h3 id="typescript_40" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;)! .set(&quot;adsense_background_color&quot;, &quot;#FFFFFF&quot;) .set(&quot;adsense_border_color&quot;, &quot;#AABBCC&quot;) .addService(googletag.pubads()); slot.getAttributeKeys(); // Returns [&#39;adsense_background_color&#39;, &#39;adsense_border_color&#39;]. </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>string</span><span>[]</span></code></td><td>Array of attribute keys. Ordering is undefined.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.getCategoryExclusions" data-text="getCategoryExclusions" tabindex="-1"><a id="googletag.Slot_getCategoryExclusions"></a><span>getCategoryExclusions</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>getCategoryExclusions</span><span>(</span><span>)</span><span>: </span><span>string</span><span>[]</span></code><p>Returns the ad category exclusion labels for this slot.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_41" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .setCategoryExclusion(&quot;AirlineAd&quot;) .setCategoryExclusion(&quot;TrainAd&quot;) .addService(googletag.pubads()); slot.getCategoryExclusions(); // Returns [&#39;AirlineAd&#39;, &#39;TrainAd&#39;]. </pre></section><section><h3 id="javascript-legacy_41" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">var slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .setCategoryExclusion(&quot;AirlineAd&quot;) .setCategoryExclusion(&quot;TrainAd&quot;) .addService(googletag.pubads()); slot.getCategoryExclusions(); // Returns [&#39;AirlineAd&#39;, &#39;TrainAd&#39;]. </pre></section><section><h3 id="typescript_41" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;)! .setCategoryExclusion(&quot;AirlineAd&quot;) .setCategoryExclusion(&quot;TrainAd&quot;) .addService(googletag.pubads()); slot.getCategoryExclusions(); // Returns [&#39;AirlineAd&#39;, &#39;TrainAd&#39;]. </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>string</span><span>[]</span></code></td><td>The ad category exclusion labels for this slot, or an empty array if none have been set.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.getResponseInformation" data-text="getResponseInformation" tabindex="-1"><a id="googletag.Slot_getResponseInformation"></a><span>getResponseInformation</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>getResponseInformation</span><span>(</span><span>)</span><span>: </span><span>null</span><span> | </span><a href="/publisher-tag/reference#googletag.ResponseInformation">ResponseInformation</a></code><p>Returns the ad response information. This is based on the last ad response for the slot. If this is called when the slot has no ad, <code translate="no" dir="ltr">null</code> will be returned.<table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>null</span><span> | </span><a href="/publisher-tag/reference#googletag.ResponseInformation">ResponseInformation</a></code></td><td>The latest ad response information, or <code translate="no" dir="ltr">null</code> if the slot has no ad.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.getSlotElementId" data-text="getSlotElementId" tabindex="-1"><a id="googletag.Slot_getSlotElementId"></a><span>getSlotElementId</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>getSlotElementId</span><span>(</span><span>)</span><span>: </span><span>string</span></code><p>Returns the ID of the slot <code translate="no" dir="ltr">div</code> provided when the slot was defined.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_42" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .addService(googletag.pubads()); slot.getSlotElementId(); // Returns &#39;div&#39;. </pre></section><section><h3 id="javascript-legacy_42" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">var slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .addService(googletag.pubads()); slot.getSlotElementId(); // Returns &#39;div&#39;. </pre></section><section><h3 id="typescript_42" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;)! .addService(googletag.pubads()); slot.getSlotElementId(); // Returns &#39;div&#39;. </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>string</span></code></td><td>Slot <code translate="no" dir="ltr">div</code> ID.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.getTargeting" data-text="getTargeting" tabindex="-1"><a id="googletag.Slot_getTargeting"></a><span>getTargeting</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>getTargeting</span><span>(</span><span>key</span><span>: </span><span>string</span><span>)</span><span>: </span><span>string</span><span>[]</span></code><p>Returns a specific custom targeting parameter set on this slot. Service-level targeting parameters are not included.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_43" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .setTargeting(&quot;allow_expandable&quot;, &quot;true&quot;) .addService(googletag.pubads()); slot.getTargeting(&quot;allow_expandable&quot;); // Returns [&#39;true&#39;]. slot.getTargeting(&quot;age&quot;); // Returns [] (empty array). </pre></section><section><h3 id="javascript-legacy_43" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">var slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .setTargeting(&quot;allow_expandable&quot;, &quot;true&quot;) .addService(googletag.pubads()); slot.getTargeting(&quot;allow_expandable&quot;); // Returns [&#39;true&#39;]. slot.getTargeting(&quot;age&quot;); // Returns [] (empty array). </pre></section><section><h3 id="typescript_43" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;)! .setTargeting(&quot;allow_expandable&quot;, &quot;true&quot;) .addService(googletag.pubads()); slot.getTargeting(&quot;allow_expandable&quot;); // Returns [&#39;true&#39;]. slot.getTargeting(&quot;age&quot;); // Returns [] (empty array). </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>key</span>: <span>string</span></code></td><td>The targeting key to look for.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>string</span><span>[]</span></code></td><td>The values associated with this key, or an empty array if there is no such key.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.getTargetingKeys" data-text="getTargetingKeys" tabindex="-1"><a id="googletag.Slot_getTargetingKeys"></a><span>getTargetingKeys</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>getTargetingKeys</span><span>(</span><span>)</span><span>: </span><span>string</span><span>[]</span></code><p>Returns the list of all custom targeting keys set on this slot. Service-level targeting keys are not included.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_44" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .setTargeting(&quot;allow_expandable&quot;, &quot;true&quot;) .setTargeting(&quot;interests&quot;, [&quot;sports&quot;, &quot;music&quot;]) .addService(googletag.pubads()); slot.getTargetingKeys(); // Returns [&#39;interests&#39;, &#39;allow_expandable&#39;]. </pre></section><section><h3 id="javascript-legacy_44" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">var slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .setTargeting(&quot;allow_expandable&quot;, &quot;true&quot;) .setTargeting(&quot;interests&quot;, [&quot;sports&quot;, &quot;music&quot;]) .addService(googletag.pubads()); slot.getTargetingKeys(); // Returns [&#39;interests&#39;, &#39;allow_expandable&#39;]. </pre></section><section><h3 id="typescript_44" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;)! .setTargeting(&quot;allow_expandable&quot;, &quot;true&quot;) .setTargeting(&quot;interests&quot;, [&quot;sports&quot;, &quot;music&quot;]) .addService(googletag.pubads()); slot.getTargetingKeys(); // Returns [&#39;interests&#39;, &#39;allow_expandable&#39;]. </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><span>string</span><span>[]</span></code></td><td>Array of targeting keys. Ordering is undefined.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.set" data-text="set" tabindex="-1"><a id="googletag.Slot_set"></a><span>set</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>set</span><span>(</span><span>key</span><span>: </span><span>string</span>, <span>value</span><span>: </span><span>string</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code><p>Sets a value for an AdSense attribute on this ad slot. This will override any values set at the service level for this key.<br><br>Calling this method more than once for the same key will override previously set values for that key. All values must be set before calling <code translate="no" dir="ltr">display</code> or <code translate="no" dir="ltr">refresh</code>.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_45" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Setting an attribute on a single ad slot. googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .set(&quot;adsense_background_color&quot;, &quot;#FFFFFF&quot;) .addService(googletag.pubads()); </pre></section><section><h3 id="javascript-legacy_45" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// Setting an attribute on a single ad slot. googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .set(&quot;adsense_background_color&quot;, &quot;#FFFFFF&quot;) .addService(googletag.pubads()); </pre></section><section><h3 id="typescript_45" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Setting an attribute on a single ad slot. googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;)! .set(&quot;adsense_background_color&quot;, &quot;#FFFFFF&quot;) .addService(googletag.pubads()); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/adsense_attributes">AdSense Attributes</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>key</span>: <span>string</span></code></td><td>The name of the attribute.</td></tr><tr><td><code translate="no" dir="ltr"><span>value</span>: <span>string</span></code></td><td>Attribute value.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code></td><td>The slot object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.setCategoryExclusion" data-text="setCategoryExclusion" tabindex="-1"><a id="googletag.Slot_setCategoryExclusion"></a><span>setCategoryExclusion</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>setCategoryExclusion</span><span>(</span><span>categoryExclusion</span><span>: </span><span>string</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code><p>Sets a slot-level ad category exclusion label on this slot.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_46" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Label = AirlineAd googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .setCategoryExclusion(&quot;AirlineAd&quot;) .addService(googletag.pubads()); </pre></section><section><h3 id="javascript-legacy_46" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// Label = AirlineAd googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .setCategoryExclusion(&quot;AirlineAd&quot;) .addService(googletag.pubads()); </pre></section><section><h3 id="typescript_46" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Label = AirlineAd googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;)! .setCategoryExclusion(&quot;AirlineAd&quot;) .addService(googletag.pubads()); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://support.google.com/admanager/answer/3238504">Custom labels to block ads</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>categoryExclusion</span>: <span>string</span></code></td><td>The ad category exclusion label to add.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code></td><td>The slot object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.setClickUrl" data-text="setClickUrl" tabindex="-1"><a id="googletag.Slot_setClickUrl"></a><span>setClickUrl</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>setClickUrl</span><span>(</span><span>value</span><span>: </span><span>string</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code><p>Sets the click URL to which users will be redirected after clicking on the ad.<br><br>The Google Ad Manager servers still record a click even if the click URL is replaced. Any landing page URL associated with the creative that is served is appended to the provided value. Subsequent calls overwrite the value. This works only for non-SRA requests.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_47" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .setClickUrl(&quot;http://www.example.com?original_click_url=&quot;) .addService(googletag.pubads()); </pre></section><section><h3 id="javascript-legacy_47" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .setClickUrl(&quot;http://www.example.com?original_click_url=&quot;) .addService(googletag.pubads()); </pre></section><section><h3 id="typescript_47" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;)! .setClickUrl(&quot;http://www.example.com?original_click_url=&quot;) .addService(googletag.pubads()); </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>value</span>: <span>string</span></code></td><td>The click URL to set.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code></td><td>The slot object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.setCollapseEmptyDiv" data-text="setCollapseEmptyDiv" tabindex="-1"><a id="googletag.Slot_setCollapseEmptyDiv"></a><span>setCollapseEmptyDiv</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>setCollapseEmptyDiv</span><span>(</span><span>collapse</span><span>: </span><span>boolean</span>, <span>collapseBeforeAdFetch</span><span>?: </span><span>boolean</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code><p>Sets whether the slot <code translate="no" dir="ltr">div</code> should be hidden when there is no ad in the slot. This overrides the service-level settings.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_48" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div-1&quot;) .setCollapseEmptyDiv(true, true) .addService(googletag.pubads()); // The above will cause the div for this slot to be collapsed // when the page is loaded, before ads are requested. googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div-2&quot;) .setCollapseEmptyDiv(true) .addService(googletag.pubads()); // The above will cause the div for this slot to be collapsed // only after GPT detects that no ads are available for the slot. </pre></section><section><h3 id="javascript-legacy_48" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div-1&quot;) .setCollapseEmptyDiv(true, true) .addService(googletag.pubads()); // The above will cause the div for this slot to be collapsed // when the page is loaded, before ads are requested. googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div-2&quot;) .setCollapseEmptyDiv(true) .addService(googletag.pubads()); // The above will cause the div for this slot to be collapsed // only after GPT detects that no ads are available for the slot. </pre></section><section><h3 id="typescript_48" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div-1&quot;)! .setCollapseEmptyDiv(true, true) .addService(googletag.pubads()); // The above will cause the div for this slot to be collapsed // when the page is loaded, before ads are requested. googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div-2&quot;)! .setCollapseEmptyDiv(true) .addService(googletag.pubads()); // The above will cause the div for this slot to be collapsed // only after GPT detects that no ads are available for the slot. </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul> <li><a href="https://developers.google.com/publisher-tag/samples/collapse-empty-ad-slots">Collapse empty ad slots</a></li> <li><a href="https://developers.google.com/publisher-tag/guides/minimize-layout-shift">Minimize layout shift</a></li> </ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>collapse</span>: <span>boolean</span></code></td><td>Whether to collapse the slot if no ad is returned.</td></tr><tr><td><code translate="no" dir="ltr"><code translate="no" dir="ltr">Optional</code> <span>collapseBeforeAdFetch</span>: <span>boolean</span></code></td><td>Whether to collapse the slot even before an ad is fetched. Ignored if collapse is not <code translate="no" dir="ltr">true</code>.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code></td><td>The slot object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.setConfig" data-text="setConfig" tabindex="-1"><a id="googletag.Slot_setConfig"></a><span>setConfig</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>setConfig</span><span>(</span><span>slotConfig</span><span>: </span><a href="/publisher-tag/reference#googletag.config.SlotSettingsConfig">SlotSettingsConfig</a><span>)</span><span>: </span><span>void</span></code><p>Sets general configuration options for this slot.<table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>slotConfig</span>: <a href="/publisher-tag/reference#googletag.config.SlotSettingsConfig">SlotSettingsConfig</a></code></td><td>The configuration object.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.setForceSafeFrame" data-text="setForceSafeFrame" tabindex="-1"><a id="googletag.Slot_setForceSafeFrame"></a><span>setForceSafeFrame</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>setForceSafeFrame</span><span>(</span><span>forceSafeFrame</span><span>: </span><span>boolean</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code><p>Configures whether ads in this slot should be forced to be rendered using a SafeFrame container.<br><br>Please keep the following things in mind while using this API:<ul> <li>This setting will only take effect for <strong>subsequent</strong> ad requests made for the respective slots.</li> <li>The slot level setting, if specified, will always override the page level setting.</li> <li>If set to <code translate="no" dir="ltr">true</code> (at slot-level or page level), the ad will always be rendered using a SafeFrame container independent of the choice made in the Google Ad Manager UI.</li> <li>However, if set to <code translate="no" dir="ltr">false</code> or left unspecified, the ad will be rendered using a SafeFrame container depending on the type of creative and the selection made in the Google Ad Manager UI.</li> <li>This API should be used with caution as it could impact the behaviour of creatives that attempt to break out of their iFrames or rely on them being rendered directly in a publishers page.</li> </ul><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_49" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .setForceSafeFrame(true) .addService(googletag.pubads()); </pre></section><section><h3 id="javascript-legacy_49" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .setForceSafeFrame(true) .addService(googletag.pubads()); </pre></section><section><h3 id="typescript_49" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;)! .setForceSafeFrame(true) .addService(googletag.pubads()); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://support.google.com/admanager/answer/6023110">Render creatives using SafeFrame</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>forceSafeFrame</span>: <span>boolean</span></code></td><td><code translate="no" dir="ltr">true</code> to force all ads in this slot to be rendered in SafeFrames and <code translate="no" dir="ltr">false</code> to opt-out of a page-level setting (if present). Setting this to <code translate="no" dir="ltr">false</code> when not specified at the page-level won&#39;t change anything.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code></td><td>The slot object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.setSafeFrameConfig" data-text="setSafeFrameConfig" tabindex="-1"><a id="googletag.Slot_setSafeFrameConfig"></a><span>setSafeFrameConfig</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>setSafeFrameConfig</span><span>(</span><span>config</span><span>: </span><span>null</span><span> | </span><a href="/publisher-tag/reference#googletag.SafeFrameConfig">SafeFrameConfig</a><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code><p>Sets the slot-level preferences for SafeFrame configuration. Any unrecognized keys in the config object will be ignored. The entire config will be ignored if an invalid value is passed for a recognized key.<br><br>These slot-level preferences, if specified, will override any page-level preferences.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_50" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setForceSafeFrame(true); // The following slot will have a sandboxed safeframe that only // disallows top-level navigation. googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div-1&quot;) .setSafeFrameConfig({ sandbox: true }) .addService(googletag.pubads()); // The following slot will inherit page-level settings. googletag.defineSlot(&quot;/1234567/news&quot;, [160, 600], &quot;div-2&quot;).addService(googletag.pubads()); googletag.display(&quot;div-1&quot;); googletag.display(&quot;div-2&quot;); </pre></section><section><h3 id="javascript-legacy_50" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setForceSafeFrame(true); // The following slot will have a sandboxed safeframe that only // disallows top-level navigation. googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div-1&quot;) .setSafeFrameConfig({ sandbox: true }) .addService(googletag.pubads()); // The following slot will inherit page-level settings. googletag.defineSlot(&quot;/1234567/news&quot;, [160, 600], &quot;div-2&quot;).addService(googletag.pubads()); googletag.display(&quot;div-1&quot;); googletag.display(&quot;div-2&quot;); </pre></section><section><h3 id="typescript_50" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.pubads().setForceSafeFrame(true); // The following slot will have a sandboxed safeframe that only // disallows top-level navigation. googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div-1&quot;)! .setSafeFrameConfig({ sandbox: true }) .addService(googletag.pubads()); // The following slot will inherit page-level settings. googletag.defineSlot(&quot;/1234567/news&quot;, [160, 600], &quot;div-2&quot;)!.addService(googletag.pubads()); googletag.display(&quot;div-1&quot;); googletag.display(&quot;div-2&quot;); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://support.google.com/admanager/answer/6023110">Render creatives using SafeFrame</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>config</span>: <span>null</span><span> | </span><a href="/publisher-tag/reference#googletag.SafeFrameConfig">SafeFrameConfig</a></code></td><td>The configuration object.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code></td><td>The slot object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.setTargeting" data-text="setTargeting" tabindex="-1"><a id="googletag.Slot_setTargeting"></a><span>setTargeting</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>setTargeting</span><span>(</span><span>key</span><span>: </span><span>string</span>, <span>value</span><span>: </span><span>string</span><span> | </span><span>string</span><span>[]</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code><p>Sets a custom targeting parameter for this slot. Calling this method multiple times for the same key will overwrite old values. Values set here will overwrite targeting parameters set at the service-level. These keys are defined in your Google Ad Manager account.<dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_51" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .addService(googletag.pubads()); // Example with a single value for a key. slot.setTargeting(&quot;allow_expandable&quot;, &quot;true&quot;); // Example with multiple values for a key inside in an array. slot.setTargeting(&quot;interests&quot;, [&quot;sports&quot;, &quot;music&quot;]); </pre></section><section><h3 id="javascript-legacy_51" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">var slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;) .addService(googletag.pubads()); // Example with a single value for a key. slot.setTargeting(&quot;allow_expandable&quot;, &quot;true&quot;); // Example with multiple values for a key inside in an array. slot.setTargeting(&quot;interests&quot;, [&quot;sports&quot;, &quot;music&quot;]); </pre></section><section><h3 id="typescript_51" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag .defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;)! .addService(googletag.pubads()); // Example with a single value for a key. slot.setTargeting(&quot;allow_expandable&quot;, &quot;true&quot;); // Example with multiple values for a key inside in an array. slot.setTargeting(&quot;interests&quot;, [&quot;sports&quot;, &quot;music&quot;]); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/guides/key-value-targeting">Key-value targeting</a></li></ul></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>key</span>: <span>string</span></code></td><td>Targeting parameter key.</td></tr><tr><td><code translate="no" dir="ltr"><span>value</span>: <span>string</span><span> | </span><span>string</span><span>[]</span></code></td><td>Targeting parameter value or array of values.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code></td><td>The slot object on which the method was called.</td></tr></table></p></ul></section><section><hr/><h4 id="googletag.Slot.updateTargetingFromMap" data-text="updateTargetingFromMap" tabindex="-1"><a id="googletag.Slot_updateTargetingFromMap"></a><span>updateTargetingFromMap</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>updateTargetingFromMap</span><span>(</span><span>map</span><span>: </span><span>{ </span><br/><span>  </span>[<span>adUnitPath</span>: <span>string</span>]<span>: </span><span>string</span><span> | </span><span>string</span><span>[]</span><span>; </span><br/><span>}</span><span>)</span><span>: </span><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code><p>Sets custom targeting parameters for this slot, from a key:value map in a JSON object. This is the same as calling <a href="/publisher-tag/reference#googletag.Slot.setTargeting">Slot.setTargeting</a> for all the key values of the object. These keys are defined in your Google Ad Manager account.<br><br><strong>Notes:</strong><ul> <li>In case of overwriting, only the last value will be kept.</li> <li>If the value is an array, any previous value will be overwritten, not merged.</li> <li>Values set here will overwrite targeting parameters set at the service-level.</li> </ul><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_52" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag.defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;); slot.updateTargetingFromMap({ color: &quot;red&quot;, interests: [&quot;sports&quot;, &quot;music&quot;, &quot;movies&quot;], }); </pre></section><section><h3 id="javascript-legacy_52" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">var slot = googletag.defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;); slot.updateTargetingFromMap({ color: &quot;red&quot;, interests: [&quot;sports&quot;, &quot;music&quot;, &quot;movies&quot;], }); </pre></section><section><h3 id="typescript_52" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">const slot = googletag.defineSlot(&quot;/1234567/sports&quot;, [160, 600], &quot;div&quot;)!; slot.updateTargetingFromMap({ color: &quot;red&quot;, interests: [&quot;sports&quot;, &quot;music&quot;, &quot;movies&quot;], }); </pre></section></devsite-selector></dd></dl><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>map</span>: <span>{ </span><br/><span>  </span>[<span>adUnitPath</span>: <span>string</span>]<span>: </span><span>string</span><span> | </span><span>string</span><span>[]</span><span>; </span><br/><span>}</span></code></td><td>Targeting parameter key:value map.</td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Returns</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.Slot">Slot</a></code></td><td>The slot object on which the method was called.</td></tr></table></p></ul></section></section></section><hr/><section><a id="googletag_config"></a><h2 id="googletag.config" data-text="googletag.config" tabindex="-1">googletag.config</h2><div>Main configuration interface for page-level settings.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Interfaces</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.AdExpansionConfig"><span>Ad<wbr/>Expansion<wbr/>Config<wbr/></span><span></span></a></code></td><td><div>Settings to control ad expansion.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.ComponentAuctionConfig"><span>Component<wbr/>Auction<wbr/>Config<wbr/></span><span></span></a></code></td><td><div>An object representing a single component auction in a on-device ad auction.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.InterstitialConfig"><span>Interstitial<wbr/>Config<wbr/></span><span></span></a></code></td><td><div>An object which defines the behavior of a single interstitial ad slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.PageSettingsConfig"><span>Page<wbr/>Settings<wbr/>Config<wbr/></span><span></span></a></code></td><td><div>Main configuration interface for page-level settings.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.PrivacyTreatmentsConfig"><span>Privacy<wbr/>Treatments<wbr/>Config<wbr/></span><span></span></a></code></td><td><div>Settings to control publisher privacy treatments.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.PublisherProvidedSignalsConfig"><span>Publisher<wbr/>Provided<wbr/>Signals<wbr/>Config<wbr/></span><span></span></a></code></td><td><div>Publisher provided signals (PPS) configuration object.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.SlotSettingsConfig"><span>Slot<wbr/>Settings<wbr/>Config<wbr/></span><span></span></a></code></td><td><div>Main configuration interface for slot-level settings.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.TaxonomyData"><span>Taxonomy<wbr/>Data<wbr/></span><span></span></a></code></td><td><div>An object containing the values for a single <a href="/publisher-tag/reference#googletag.config.Taxonomy">Taxonomy</a>.</div></td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Type Aliases</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.InterstitialTrigger"><span>Interstitial<wbr/>Trigger<wbr/></span><span></span></a></code></td><td><div>Supported interstitial ad triggers.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.PrivacyTreatment"><span>Privacy<wbr/>Treatment<wbr/></span><span></span></a></code></td><td><div>Supported publisher privacy treatments.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.Taxonomy"><span>Taxonomy<wbr/></span><span></span></a></code></td><td><div>Supported taxonomies for <a href="/publisher-tag/reference#googletag.config.PublisherProvidedSignalsConfig">publisher provided signals (PPS)</a>.</div></td></tr></table></section><section></section><section><h3 class="hide-from-toc" id="googletag.config_Type Aliases" data-text="Type Aliases" tabindex="-1">Type Aliases</h3><section><hr/><h4 id="googletag.config.InterstitialTrigger" data-text="InterstitialTrigger" tabindex="-1"><a id="googletag.config_InterstitialTrigger"></a><span>InterstitialTrigger</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>InterstitialTrigger</span><span>:</span> <span>&quot;unhideWindow&quot;</span><span> | </span><span>&quot;navBar&quot;</span></code></div><p>Supported interstitial ad triggers.</p></ul></section><section><hr/><h4 id="googletag.config.PrivacyTreatment" data-text="PrivacyTreatment" tabindex="-1"><a id="googletag.config_PrivacyTreatment"></a><span>PrivacyTreatment</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>PrivacyTreatment</span><span>:</span> <span>&quot;disablePersonalization&quot;</span></code></div><p>Supported publisher privacy treatments.</p></ul></section><section><hr/><h4 id="googletag.config.Taxonomy" data-text="Taxonomy" tabindex="-1"><a id="googletag.config_Taxonomy"></a><span>Taxonomy</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>Taxonomy</span><span>:</span> <span>&quot;IAB_AUDIENCE_1_1&quot;</span><span> | </span><span>&quot;IAB_CONTENT_2_2&quot;</span></code></div><p>Supported taxonomies for <a href="/publisher-tag/reference#googletag.config.PublisherProvidedSignalsConfig">publisher provided signals (PPS)</a>.</p><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul> <li><a href="https://iabtechlab.com/standards/audience-taxonomy/">IAB Audience Taxonomy 1.1</a></li> <li><a href="https://iabtechlab.com/standards/content-taxonomy/">IAB Content Taxonomy 2.2</a></li> </ul></dd></dl></ul></section></section><hr/><section><a id="googletag.config_AdExpansionConfig"></a><h2 id="googletag.config.AdExpansionConfig" data-text="googletag.config.AdExpansionConfig" tabindex="-1">googletag.config.AdExpansionConfig</h2><div>Settings to control ad expansion.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.AdExpansionConfig.enabled"><span>enabled<wbr/></span><span>?</span></a></code></td><td><div>Whether ad expansion is enabled or disabled.</div></td></tr></table></section><section><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_53" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Enable ad slot expansion across the entire page. googletag.setConfig({ adExpansion: { enabled: true }, }); </pre></section><section><h3 id="javascript-legacy_53" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// Enable ad slot expansion across the entire page. googletag.setConfig({ adExpansion: { enabled: true }, }); </pre></section><section><h3 id="typescript_53" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Enable ad slot expansion across the entire page. googletag.setConfig({ adExpansion: { enabled: true }, }); </pre></section></devsite-selector></dd></dl></section><section><h3 class="hide-from-toc" id="googletag.config.AdExpansionConfig_Properties" data-text="Properties" tabindex="-1">Properties</h3><section><hr/><h4 id="googletag.config.AdExpansionConfig.enabled" data-text="Optional enabled" tabindex="-1"><a id="googletag.config.AdExpansionConfig_enabled"></a><code translate="no" dir="ltr">Optional</code> <span>enabled</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>enabled</span><span>?:</span> <span>boolean</span></code></div><p>Whether ad expansion is enabled or disabled.<br><br>Setting this value overrides the default configured in Google Ad Manager.</p><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul> <li><a href="https://support.google.com/admanager/answer/9384852">Expand ads on desktop and tablet</a></li> <li><a href="https://support.google.com/admanager/answer/9117822">Expand ads on mobile web (partial screen)</a></li> </ul></dd></dl></ul></section></section></section><hr/><section><a id="googletag.config_ComponentAuctionConfig"></a><h2 id="googletag.config.ComponentAuctionConfig" data-text="googletag.config.ComponentAuctionConfig" tabindex="-1">googletag.config.ComponentAuctionConfig</h2><div>An object representing a single component auction in a on-device ad auction.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.ComponentAuctionConfig.auctionConfig"><span>auction<wbr/>Config<wbr/></span><span></span></a></code></td><td><div>An auction configuration object for this component auction.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.ComponentAuctionConfig.configKey"><span>config<wbr/>Key<wbr/></span><span></span></a></code></td><td><div>The configuration key associated with this component auction.</div></td></tr></table></section><section><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developer.chrome.com/docs/privacy-sandbox/fledge-api/ad-auction/">Protected Audience API Seller guide: run ad auctions</a></li></ul></dd></dl></section><section><h3 class="hide-from-toc" id="googletag.config.ComponentAuctionConfig_Properties" data-text="Properties" tabindex="-1">Properties</h3><section><hr/><h4 id="googletag.config.ComponentAuctionConfig.auctionConfig" data-text="auctionConfig" tabindex="-1"><a id="googletag.config.ComponentAuctionConfig_auctionConfig"></a><span>auctionConfig</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>auctionConfig</span><span>:</span> <span>null</span><span> | </span><span>{ </span><br/><span>  </span><span>auctionSignals</span><span>?: </span><span>unknown</span><span>; </span><br/><span>  </span><span>decisionLogicUrl</span><span>: </span><span>string</span><span>; </span><br/><span>  </span><span>interestGroupBuyers</span><span>?: </span><span>string</span><span>[]</span><span>; </span><br/><span>  </span><span>perBuyerExperimentGroupIds</span><span>?: </span><span>{ </span><br/><span>    </span>[<span>buyer</span>: <span>string</span>]<span>: </span><span>number</span><span>; </span><br/><span>  </span><span>}</span><span>; </span><br/><span>  </span><span>perBuyerGroupLimits</span><span>?: </span><span>{ </span><br/><span>    </span>[<span>buyer</span>: <span>string</span>]<span>: </span><span>number</span><span>; </span><br/><span>  </span><span>}</span><span>; </span><br/><span>  </span><span>perBuyerSignals</span><span>?: </span><span>{ </span><br/><span>    </span>[<span>buyer</span>: <span>string</span>]<span>: </span><span>unknown</span><span>; </span><br/><span>  </span><span>}</span><span>; </span><br/><span>  </span><span>perBuyerTimeouts</span><span>?: </span><span>{ </span><br/><span>    </span>[<span>buyer</span>: <span>string</span>]<span>: </span><span>number</span><span>; </span><br/><span>  </span><span>}</span><span>; </span><br/><span>  </span><span>seller</span><span>: </span><span>string</span><span>; </span><br/><span>  </span><span>sellerExperimentGroupId</span><span>?: </span><span>number</span><span>; </span><br/><span>  </span><span>sellerSignals</span><span>?: </span><span>unknown</span><span>; </span><br/><span>  </span><span>sellerTimeout</span><span>?: </span><span>number</span><span>; </span><br/><span>  </span><span>trustedScoringSignalsUrl</span><span>?: </span><span>string</span><span>; </span><br/><span>}</span></code></div><p>An auction configuration object for this component auction.<br><br>If this value is set to <code translate="no" dir="ltr">null</code>, any existing configuration for the specified <code translate="no" dir="ltr">configKey</code> will be deleted.</p><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_54" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">const componentAuctionConfig = { // Seller URL should be https and the same as decisionLogicUrl&#39;s origin seller: &quot;https://testSeller.com&quot;, decisionLogicUrl: &quot;https://testSeller.com/ssp/decision-logic.js&quot;, interestGroupBuyers: [&quot;https://example-buyer.com&quot;], auctionSignals: { auction_signals: &quot;auction_signals&quot; }, sellerSignals: { seller_signals: &quot;seller_signals&quot; }, perBuyerSignals: { // listed on interestGroupBuyers &quot;https://example-buyer.com&quot;: { per_buyer_signals: &quot;per_buyer_signals&quot;, }, }, }; const auctionSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); // To add configKey to the component auction: auctionSlot.setConfig({ componentAuction: [ { configKey: &quot;https://testSeller.com&quot;, auctionConfig: componentAuctionConfig, }, ], }); // To remove configKey from the component auction: auctionSlot.setConfig({ componentAuction: [ { configKey: &quot;https://testSeller.com&quot;, auctionConfig: null, }, ], }); </pre></section><section><h3 id="javascript-legacy_54" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">var componentAuctionConfig = { // Seller URL should be https and the same as decisionLogicUrl&#39;s origin seller: &quot;https://testSeller.com&quot;, decisionLogicUrl: &quot;https://testSeller.com/ssp/decision-logic.js&quot;, interestGroupBuyers: [&quot;https://example-buyer.com&quot;], auctionSignals: { auction_signals: &quot;auction_signals&quot; }, sellerSignals: { seller_signals: &quot;seller_signals&quot; }, perBuyerSignals: { // listed on interestGroupBuyers &quot;https://example-buyer.com&quot;: { per_buyer_signals: &quot;per_buyer_signals&quot;, }, }, }; var auctionSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); // To add configKey to the component auction: auctionSlot.setConfig({ componentAuction: [ { configKey: &quot;https://testSeller.com&quot;, auctionConfig: componentAuctionConfig, }, ], }); // To remove configKey from the component auction: auctionSlot.setConfig({ componentAuction: [ { configKey: &quot;https://testSeller.com&quot;, auctionConfig: null, }, ], }); </pre></section><section><h3 id="typescript_54" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">const componentAuctionConfig = { // Seller URL should be https and the same as decisionLogicUrl&#39;s origin seller: &quot;https://testSeller.com&quot;, decisionLogicUrl: &quot;https://testSeller.com/ssp/decision-logic.js&quot;, interestGroupBuyers: [&quot;https://example-buyer.com&quot;], auctionSignals: { auction_signals: &quot;auction_signals&quot; }, sellerSignals: { seller_signals: &quot;seller_signals&quot; }, perBuyerSignals: { // listed on interestGroupBuyers &quot;https://example-buyer.com&quot;: { per_buyer_signals: &quot;per_buyer_signals&quot;, }, }, }; const auctionSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600])!; // To add configKey to the component auction: auctionSlot.setConfig({ componentAuction: [ { configKey: &quot;https://testSeller.com&quot;, auctionConfig: componentAuctionConfig, }, ], }); // To remove configKey from the component auction: auctionSlot.setConfig({ componentAuction: [ { configKey: &quot;https://testSeller.com&quot;, auctionConfig: null, }, ], }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://github.com/WICG/turtledove/blob/main/FLEDGE.md#21-initiating-an-on-device-auction">Protected Audience API: Initiating an On-Device Auction</a></li></ul></dd></dl></ul></section><section><hr/><h4 id="googletag.config.ComponentAuctionConfig.configKey" data-text="configKey" tabindex="-1"><a id="googletag.config.ComponentAuctionConfig_configKey"></a><span>configKey</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>configKey</span><span>:</span> <span>string</span></code></div><p>The configuration key associated with this component auction.<br><br>This value must be non-empty and should be unique. If two <code translate="no" dir="ltr">ComponentAuctionConfig</code> objects share the same configKey value, the last to be set will overwrite prior configurations.</p></ul></section></section></section><hr/><section><a id="googletag.config_InterstitialConfig"></a><h2 id="googletag.config.InterstitialConfig" data-text="googletag.config.InterstitialConfig" tabindex="-1">googletag.config.InterstitialConfig</h2><div>An object which defines the behavior of a single interstitial ad slot.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.InterstitialConfig.triggers"><span>triggers<wbr/></span><span>?</span></a></code></td><td><div>The interstitial trigger configuration for this interstitial ad.</div></td></tr></table></section><section></section><section><h3 class="hide-from-toc" id="googletag.config.InterstitialConfig_Properties" data-text="Properties" tabindex="-1">Properties</h3><section><hr/><h4 id="googletag.config.InterstitialConfig.triggers" data-text="Optional triggers" tabindex="-1"><a id="googletag.config.InterstitialConfig_triggers"></a><code translate="no" dir="ltr">Optional</code> <span>triggers</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>triggers</span><span>?:</span> <span>Partial</span><span>&lt;</span><span>Record</span><span>&lt;</span><a href="/publisher-tag/reference#googletag.config.InterstitialTrigger">InterstitialTrigger</a><span>, </span><span>boolean</span><span>&gt;</span><span>&gt;</span></code></div><p>The interstitial trigger configuration for this interstitial ad.<br><br>Setting the value of an interstitial trigger to <code translate="no" dir="ltr">true</code> will enable it and <code translate="no" dir="ltr">false</code> will disable it. This will override the default values <a href="https://support.google.com/admanager/answer/9840201">configured in Google Ad Manager</a>.</p><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_55" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Define a GPT managed web interstitial ad slot. const interstitialSlot = googletag.defineOutOfPageSlot( &quot;/1234567/sports&quot;, googletag.enums.OutOfPageFormat.INTERSTITIAL, ); // Enable optional interstitial triggers. // Change this value to false to disable. const enableTriggers = true; interstitialSlot.setConfig({ interstitial: { triggers: { navBar: enableTriggers, unhideWindow: enableTriggers, }, }, }); </pre></section><section><h3 id="javascript-legacy_55" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// Define a GPT managed web interstitial ad slot. var interstitialSlot = googletag.defineOutOfPageSlot( &quot;/1234567/sports&quot;, googletag.enums.OutOfPageFormat.INTERSTITIAL, ); // Enable optional interstitial triggers. // Change this value to false to disable. var enableTriggers = true; interstitialSlot.setConfig({ interstitial: { triggers: { navBar: enableTriggers, unhideWindow: enableTriggers, }, }, }); </pre></section><section><h3 id="typescript_55" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Define a GPT managed web interstitial ad slot. const interstitialSlot = googletag.defineOutOfPageSlot( &quot;/1234567/sports&quot;, googletag.enums.OutOfPageFormat.INTERSTITIAL, )!; // Enable optional interstitial triggers. // Change this value to false to disable. const enableTriggers = true; interstitialSlot.setConfig({ interstitial: { triggers: { navBar: enableTriggers, unhideWindow: enableTriggers, }, }, }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/samples/display-web-interstitial-ad">Display a web interstitial ad</a></li></ul></dd></dl></ul></section></section></section><hr/><section><a id="googletag.config_PageSettingsConfig"></a><h2 id="googletag.config.PageSettingsConfig" data-text="googletag.config.PageSettingsConfig" tabindex="-1">googletag.config.PageSettingsConfig</h2><div>Main configuration interface for page-level settings.<br><br>Allows setting multiple features with a single API call.<br><br>All properties listed below are examples and do not reflect actual features that utilize setConfig. For the set of features, see fields within the PageSettingsConfig type below.<br><br>Examples:<ul> <li>Only features specified in the <a href="/publisher-tag/reference#googletag.setConfig">googletag.setConfig</a> call are modified. <pre class="prettyprint" translate="no" dir="ltr"> // Configure feature alpha. googletag.setConfig({ alpha: {...} }); // Configure feature bravo. Feature alpha is unchanged. googletag.setConfig({ bravo: {...} }); </pre></li> <li>All settings for a given feature are updated with each call to <a href="/publisher-tag/reference#googletag.setConfig">googletag.setConfig</a>. <pre class="prettyprint" translate="no" dir="ltr"> // Configure feature charlie to echo = 1, foxtrot = true. googletag.setConfig({ charlie: { echo: 1, foxtrot: true, } }); // Update feature charlie to echo = 2. Since foxtrot was not specified, // the value is cleared. googletag.setConfig({ charlie: { echo: 2 } }); </pre></li> <li>All settings for a feature can be cleared by passing <code translate="no" dir="ltr">null</code>. <pre class="prettyprint" translate="no" dir="ltr"> // Configure features delta, golf, and hotel. googletag.setConfig({ delta: {...}, golf: {...}, hotel: {...}, }); // Feature delta and hotel are cleared, but feature golf remains set. googletag.setConfig({ delta: null, hotel: null, }); </pre></li> </ul></div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.PageSettingsConfig.adExpansion"><span>ad<wbr/>Expansion<wbr/></span><span>?</span></a></code></td><td><div>Settings to control ad expansion.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.PageSettingsConfig.adYield"><span>ad<wbr/>Yield<wbr/></span><span>?</span></a></code></td><td><div><b>Deprecated. </b></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.PageSettingsConfig.pps"><span>pps<wbr/></span><span>?</span></a></code></td><td><div>Settings to control publisher provided signals (PPS).</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.PageSettingsConfig.privacyTreatments"><span>privacy<wbr/>Treatments<wbr/></span><span>?</span></a></code></td><td><div>Settings to control publisher privacy treatments.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.PageSettingsConfig.threadYield"><span>thread<wbr/>Yield<wbr/></span><span>?</span></a></code></td><td><div>Setting to control whether GPT should yield the JS thread when rendering creatives.</div></td></tr></table></section><section></section><section><h3 class="hide-from-toc" id="googletag.config.PageSettingsConfig_Properties" data-text="Properties" tabindex="-1">Properties</h3><section><hr/><h4 id="googletag.config.PageSettingsConfig.adExpansion" data-text="Optional adExpansion" tabindex="-1"><a id="googletag.config.PageSettingsConfig_adExpansion"></a><code translate="no" dir="ltr">Optional</code> <span>adExpansion</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>adExpansion</span><span>?:</span> <span>null</span><span> | </span><a href="/publisher-tag/reference#googletag.config.AdExpansionConfig">AdExpansionConfig</a></code></div><p>Settings to control ad expansion.</p></ul></section><section><hr/><h4 id="googletag.config.PageSettingsConfig.adYield" data-text="Optional adYield" tabindex="-1"><a id="googletag.config.PageSettingsConfig_adYield"></a><code translate="no" dir="ltr">Optional</code> <span>adYield</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>adYield</span><span>?:</span> <span>null</span><span> | </span><span>&quot;DISABLED&quot;</span><span> | </span><span>&quot;ENABLED_ALL_SLOTS&quot;</span></code></div><p></p><aside class="warning"><b>Deprecated:</b> Use <a href="/publisher-tag/reference#googletag.config.PageSettingsConfig.threadYield">threadYield</a> instead. This will be removed in the near future.</aside></ul></section><section><hr/><h4 id="googletag.config.PageSettingsConfig.pps" data-text="Optional pps" tabindex="-1"><a id="googletag.config.PageSettingsConfig_pps"></a><code translate="no" dir="ltr">Optional</code> <span>pps</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>pps</span><span>?:</span> <span>null</span><span> | </span><a href="/publisher-tag/reference#googletag.config.PublisherProvidedSignalsConfig">PublisherProvidedSignalsConfig</a></code></div><p>Settings to control publisher provided signals (PPS).</p></ul></section><section><hr/><h4 id="googletag.config.PageSettingsConfig.privacyTreatments" data-text="Optional privacyTreatments" tabindex="-1"><a id="googletag.config.PageSettingsConfig_privacyTreatments"></a><code translate="no" dir="ltr">Optional</code> <span>privacyTreatments</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>privacyTreatments</span><span>?:</span> <span>null</span><span> | </span><a href="/publisher-tag/reference#googletag.config.PrivacyTreatmentsConfig">PrivacyTreatmentsConfig</a></code></div><p>Settings to control publisher privacy treatments.</p></ul></section><section><hr/><h4 id="googletag.config.PageSettingsConfig.threadYield" data-text="Optional threadYield" tabindex="-1"><a id="googletag.config.PageSettingsConfig_threadYield"></a><code translate="no" dir="ltr">Optional</code> <span>threadYield</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>threadYield</span><span>?:</span> <span>null</span><span> | </span><span>&quot;DISABLED&quot;</span><span> | </span><span>&quot;ENABLED_ALL_SLOTS&quot;</span></code></div><p>Setting to control whether GPT should yield the JS thread when rendering creatives.<br><br>GPT will yield only for browsers that support the Scheduler.postTask or Scheduler.yield API.<br><br>Supported values:<ul> <li><code translate="no" dir="ltr">null</code> (default): GPT will yield the JS thread for slots outside of the viewport.</li> <li><code translate="no" dir="ltr">ENABLED_ALL_SLOTS</code>: GPT will yield the JS thread for all slots regardless of whether the slot is within the viewport.</li> <li><code translate="no" dir="ltr">DISABLED</code>: GPT will not yield the JS thread.</li> </ul></p><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_56" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Disable yielding. googletag.setConfig({ threadYield: &quot;DISABLED&quot; }); // Enable yielding for all slots. googletag.setConfig({ threadYield: &quot;ENABLED_ALL_SLOTS&quot; }); // Enable yielding only for slots outside of the viewport (default). googletag.setConfig({ threadYield: null }); </pre></section><section><h3 id="javascript-legacy_56" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// Disable yielding. googletag.setConfig({ threadYield: &quot;DISABLED&quot; }); // Enable yielding for all slots. googletag.setConfig({ threadYield: &quot;ENABLED_ALL_SLOTS&quot; }); // Enable yielding only for slots outside of the viewport (default). googletag.setConfig({ threadYield: null }); </pre></section><section><h3 id="typescript_56" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Disable yielding. googletag.setConfig({ threadYield: &quot;DISABLED&quot; }); // Enable yielding for all slots. googletag.setConfig({ threadYield: &quot;ENABLED_ALL_SLOTS&quot; }); // Enable yielding only for slots outside of the viewport (default). googletag.setConfig({ threadYield: null }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developer.mozilla.org/docs/Web/API/Scheduler">Scheduler</a></li></ul></dd></dl></ul></section></section></section><hr/><section><a id="googletag.config_PrivacyTreatmentsConfig"></a><h2 id="googletag.config.PrivacyTreatmentsConfig" data-text="googletag.config.PrivacyTreatmentsConfig" tabindex="-1">googletag.config.PrivacyTreatmentsConfig</h2><div>Settings to control publisher privacy treatments.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.PrivacyTreatmentsConfig.treatments"><span>treatments<wbr/></span><span></span></a></code></td><td><div>An array of publisher privacy treatments to enable.</div></td></tr></table></section><section></section><section><h3 class="hide-from-toc" id="googletag.config.PrivacyTreatmentsConfig_Properties" data-text="Properties" tabindex="-1">Properties</h3><section><hr/><h4 id="googletag.config.PrivacyTreatmentsConfig.treatments" data-text="treatments" tabindex="-1"><a id="googletag.config.PrivacyTreatmentsConfig_treatments"></a><span>treatments</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>treatments</span><span>:</span> <span>&quot;disablePersonalization&quot;</span><span>[]</span></code></div><p>An array of publisher privacy treatments to enable.</p><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_57" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Disable personalization across the entire page. googletag.setConfig({ privacyTreatments: { treatments: [&quot;disablePersonalization&quot;] }, }); </pre></section><section><h3 id="javascript-legacy_57" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// Disable personalization across the entire page. googletag.setConfig({ privacyTreatments: { treatments: [&quot;disablePersonalization&quot;] }, }); </pre></section><section><h3 id="typescript_57" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// Disable personalization across the entire page. googletag.setConfig({ privacyTreatments: { treatments: [&quot;disablePersonalization&quot;] }, }); </pre></section></devsite-selector></dd></dl></ul></section></section></section><hr/><section><a id="googletag.config_PublisherProvidedSignalsConfig"></a><h2 id="googletag.config.PublisherProvidedSignalsConfig" data-text="googletag.config.PublisherProvidedSignalsConfig" tabindex="-1">googletag.config.PublisherProvidedSignalsConfig</h2><div>Publisher provided signals (PPS) configuration object.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.PublisherProvidedSignalsConfig.taxonomies"><span>taxonomies<wbr/></span><span></span></a></code></td><td><div>An object containing <a href="/publisher-tag/reference#googletag.config.Taxonomy">Taxonomy</a> mappings.</div></td></tr></table></section><section><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_58" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.setConfig({ pps: { taxonomies: { IAB_AUDIENCE_1_1: { values: [&quot;6&quot;, &quot;626&quot;] }, // &#39;6&#39; = &#39;Demographic | Age Range | 30-34&#39; // &#39;626&#39; = &#39;Interest | Sports | Darts&#39; IAB_CONTENT_2_2: { values: [&quot;48&quot;, &quot;127&quot;] }, // &#39;48&#39; = &#39;Books and Literature | Fiction&#39; // &#39;127&#39; = &#39;Careers | Job Search&#39; }, }, }); </pre></section><section><h3 id="javascript-legacy_58" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.setConfig({ pps: { taxonomies: { IAB_AUDIENCE_1_1: { values: [&quot;6&quot;, &quot;626&quot;] }, // &#39;6&#39; = &#39;Demographic | Age Range | 30-34&#39; // &#39;626&#39; = &#39;Interest | Sports | Darts&#39; IAB_CONTENT_2_2: { values: [&quot;48&quot;, &quot;127&quot;] }, // &#39;48&#39; = &#39;Books and Literature | Fiction&#39; // &#39;127&#39; = &#39;Careers | Job Search&#39; }, }, }); </pre></section><section><h3 id="typescript_58" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">googletag.setConfig({ pps: { taxonomies: { IAB_AUDIENCE_1_1: { values: [&quot;6&quot;, &quot;626&quot;] }, // &#39;6&#39; = &#39;Demographic | Age Range | 30-34&#39; // &#39;626&#39; = &#39;Interest | Sports | Darts&#39; IAB_CONTENT_2_2: { values: [&quot;48&quot;, &quot;127&quot;] }, // &#39;48&#39; = &#39;Books and Literature | Fiction&#39; // &#39;127&#39; = &#39;Careers | Job Search&#39; }, }, }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul> <li><a href="https://support.google.com/admanager/answer/12451124">About publisher provided signals (Beta)</a></li> <li><a href="https://iabtechlab.com/standards/audience-taxonomy/">IAB Audience Taxonomy 1.1</a></li> <li><a href="https://iabtechlab.com/standards/content-taxonomy/">IAB Content Taxonomy 2.2</a></li> </ul></dd></dl></section><section><h3 class="hide-from-toc" id="googletag.config.PublisherProvidedSignalsConfig_Properties" data-text="Properties" tabindex="-1">Properties</h3><section><hr/><h4 id="googletag.config.PublisherProvidedSignalsConfig.taxonomies" data-text="taxonomies" tabindex="-1"><a id="googletag.config.PublisherProvidedSignalsConfig_taxonomies"></a><span>taxonomies</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>taxonomies</span><span>:</span> <span>Partial</span><span>&lt;</span><span>Record</span><span>&lt;</span><a href="/publisher-tag/reference#googletag.config.Taxonomy">Taxonomy</a><span>, </span><a href="/publisher-tag/reference#googletag.config.TaxonomyData">TaxonomyData</a><span>&gt;</span><span>&gt;</span></code></div><p>An object containing <a href="/publisher-tag/reference#googletag.config.Taxonomy">Taxonomy</a> mappings.</p></ul></section></section></section><hr/><section><a id="googletag.config_SlotSettingsConfig"></a><h2 id="googletag.config.SlotSettingsConfig" data-text="googletag.config.SlotSettingsConfig" tabindex="-1">googletag.config.SlotSettingsConfig</h2><div>Main configuration interface for slot-level settings.<br><br>Allows setting multiple features with a single API call for a single slot.<br><br>All properties listed below are examples and do not reflect actual features that utilize setConfig. For the set of features, see fields within the SlotSettingsConfig type below.<br><br>Examples:<ul> <li>Only features specified in the <a href="/publisher-tag/reference#googletag.Slot.setConfig">Slot.setConfig</a> call are modified. <pre class="prettyprint" translate="no" dir="ltr"> const slot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); // Configure feature alpha. slot.setConfig({ alpha: {...} }); // Configure feature bravo. Feature alpha is unchanged. slot.setConfig({ bravo: {...} }); </pre></li> <li>All settings for a given feature are updated with each call to <a href="/publisher-tag/reference#googletag.Slot.setConfig">Slot.setConfig</a>. <pre class="prettyprint" translate="no" dir="ltr"> // Configure feature charlie to echo = 1, foxtrot = true. slot.setConfig({ charlie: { echo: 1, foxtrot: true, } }); // Update feature charlie to echo = 2. Since foxtrot was not specified, // the value is cleared. slot.setConfig({ charlie: { echo: 2 } }); </pre></li> <li>All settings for a feature can be cleared by passing <code translate="no" dir="ltr">null</code>. <pre class="prettyprint" translate="no" dir="ltr"> // Configure features delta, golf, and hotel. slot.setConfig({ delta: {...}, golf: {...}, hotel: {...}, }); // Feature delta and hotel are cleared, but feature golf remains set. slot.setConfig({ delta: null, hotel: null, }); </pre></li> </ul></div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.SlotSettingsConfig.adExpansion"><span>ad<wbr/>Expansion<wbr/></span><span>?</span></a></code></td><td><div>Settings to control ad expansion.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.SlotSettingsConfig.componentAuction"><span>component<wbr/>Auction<wbr/></span><span>?</span></a></code></td><td><div>An array of component auctions to be included in an on-device ad auction.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.SlotSettingsConfig.interstitial"><span>interstitial<wbr/></span><span>?</span></a></code></td><td><div>Settings that control interstitial ad slot behavior.</div></td></tr></table></section><section></section><section><h3 class="hide-from-toc" id="googletag.config.SlotSettingsConfig_Properties" data-text="Properties" tabindex="-1">Properties</h3><section><hr/><h4 id="googletag.config.SlotSettingsConfig.adExpansion" data-text="Optional adExpansion" tabindex="-1"><a id="googletag.config.SlotSettingsConfig_adExpansion"></a><code translate="no" dir="ltr">Optional</code> <span>adExpansion</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>adExpansion</span><span>?:</span> <a href="/publisher-tag/reference#googletag.config.AdExpansionConfig">AdExpansionConfig</a></code></div><p>Settings to control ad expansion.</p></ul></section><section><hr/><h4 id="googletag.config.SlotSettingsConfig.componentAuction" data-text="Optional componentAuction" tabindex="-1"><a id="googletag.config.SlotSettingsConfig_componentAuction"></a><code translate="no" dir="ltr">Optional</code> <span>componentAuction</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>componentAuction</span><span>?:</span> <a href="/publisher-tag/reference#googletag.config.ComponentAuctionConfig">ComponentAuctionConfig</a><span>[]</span></code></div><p>An array of component auctions to be included in an on-device ad auction.</p></ul></section><section><hr/><h4 id="googletag.config.SlotSettingsConfig.interstitial" data-text="Optional interstitial" tabindex="-1"><a id="googletag.config.SlotSettingsConfig_interstitial"></a><code translate="no" dir="ltr">Optional</code> <span>interstitial</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>interstitial</span><span>?:</span> <a href="/publisher-tag/reference#googletag.config.InterstitialConfig">InterstitialConfig</a></code></div><p>Settings that control interstitial ad slot behavior.</p></ul></section></section></section><hr/><section><a id="googletag.config_TaxonomyData"></a><h2 id="googletag.config.TaxonomyData" data-text="googletag.config.TaxonomyData" tabindex="-1">googletag.config.TaxonomyData</h2><div>An object containing the values for a single <a href="/publisher-tag/reference#googletag.config.Taxonomy">Taxonomy</a>.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.config.TaxonomyData.values"><span>values<wbr/></span><span></span></a></code></td><td><div>A list of <a href="/publisher-tag/reference#googletag.config.Taxonomy">Taxonomy</a> values.</div></td></tr></table></section><section></section><section><h3 class="hide-from-toc" id="googletag.config.TaxonomyData_Properties" data-text="Properties" tabindex="-1">Properties</h3><section><hr/><h4 id="googletag.config.TaxonomyData.values" data-text="values" tabindex="-1"><a id="googletag.config.TaxonomyData_values"></a><span>values</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>values</span><span>:</span> <span>string</span><span>[]</span></code></div><p>A list of <a href="/publisher-tag/reference#googletag.config.Taxonomy">Taxonomy</a> values.</p></ul></section></section></section></section><hr/><section><a id="googletag_enums"></a><h2 id="googletag.enums" data-text="googletag.enums" tabindex="-1">googletag.enums</h2><div>This is the namespace that GPT uses for enum types.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Enumerations</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.enums.OutOfPageFormat"><span>Out<wbr/>Of<wbr/>Page<wbr/>Format<wbr/></span><span></span></a></code></td><td><div>Out-of-page formats supported by GPT.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.enums.TrafficSource"><span>Traffic<wbr/>Source<wbr/></span><span></span></a></code></td><td><div><a href="https://support.google.com/admanager/answer/11233407">Traffic sources</a> supported by GPT.</div></td></tr></table></section><section></section><section><h3 class="hide-from-toc" id="googletag.enums_Enumerations" data-text="Enumerations" tabindex="-1">Enumerations</h3><section><hr/><h4 id="googletag.enums.OutOfPageFormat" data-text="OutOfPageFormat" tabindex="-1"><a id="googletag.enums_OutOfPageFormat"></a><span>OutOfPageFormat</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>OutOfPageFormat</span></code></div><p>Out-of-page formats supported by GPT.</p><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="/publisher-tag/reference#googletag.defineOutOfPageSlot">defineOutOfPageSlot</a></li></ul></dd></dl><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Enumeration Members</th></tr><tr><td><a id="googletag.enums.OutOfPageFormat.BOTTOM_ANCHOR"></a><a id="googletag.enums.OutOfPageFormat_BOTTOM_ANCHOR"></a><code translate="no" dir="ltr"><span>BOTTOM_<wbr/>ANCHOR<wbr/></span><span></span></code></td><td><div>Anchor format where slot sticks to the bottom of the viewport.</div></td></tr><tr><td><a id="googletag.enums.OutOfPageFormat.GAME_MANUAL_INTERSTITIAL"></a><a id="googletag.enums.OutOfPageFormat_GAME_MANUAL_INTERSTITIAL"></a><code translate="no" dir="ltr"><span>GAME_<wbr/>MANUAL_<wbr/>INTERSTITIAL<wbr/></span><span></span></code></td><td><div>Game manual interstitial format.<br><br><strong>Note:</strong> Game manual interstitial is a <a href="https://support.google.com/admanager/answer/14640119">limited-access</a> format.</div></td></tr><tr><td><a id="googletag.enums.OutOfPageFormat.INTERSTITIAL"></a><a id="googletag.enums.OutOfPageFormat_INTERSTITIAL"></a><code translate="no" dir="ltr"><span>INTERSTITIAL<wbr/></span><span></span></code></td><td><div>Web interstitial creative format.</div></td></tr><tr><td><a id="googletag.enums.OutOfPageFormat.LEFT_SIDE_RAIL"></a><a id="googletag.enums.OutOfPageFormat_LEFT_SIDE_RAIL"></a><code translate="no" dir="ltr"><span>LEFT_<wbr/>SIDE_<wbr/>RAIL<wbr/></span><span></span></code></td><td><div>Left side rail format.</div></td></tr><tr><td><a id="googletag.enums.OutOfPageFormat.REWARDED"></a><a id="googletag.enums.OutOfPageFormat_REWARDED"></a><code translate="no" dir="ltr"><span>REWARDED<wbr/></span><span></span></code></td><td><div>Rewarded format.</div></td></tr><tr><td><a id="googletag.enums.OutOfPageFormat.RIGHT_SIDE_RAIL"></a><a id="googletag.enums.OutOfPageFormat_RIGHT_SIDE_RAIL"></a><code translate="no" dir="ltr"><span>RIGHT_<wbr/>SIDE_<wbr/>RAIL<wbr/></span><span></span></code></td><td><div>Right side rail format.</div></td></tr><tr><td><a id="googletag.enums.OutOfPageFormat.TOP_ANCHOR"></a><a id="googletag.enums.OutOfPageFormat_TOP_ANCHOR"></a><code translate="no" dir="ltr"><span>TOP_<wbr/>ANCHOR<wbr/></span><span></span></code></td><td><div>Anchor format where slot sticks to the top of the viewport.</div></td></tr></table></section></ul></section><section><hr/><h4 id="googletag.enums.TrafficSource" data-text="TrafficSource" tabindex="-1"><a id="googletag.enums_TrafficSource"></a><span>TrafficSource</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>TrafficSource</span></code></div><p><a href="https://support.google.com/admanager/answer/11233407">Traffic sources</a> supported by GPT.</p><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="/publisher-tag/reference#googletag.PrivacySettingsConfig.trafficSource">PrivacySettingsConfig.trafficSource</a></li></ul></dd></dl><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Enumeration Members</th></tr><tr><td><a id="googletag.enums.TrafficSource.ORGANIC"></a><a id="googletag.enums.TrafficSource_ORGANIC"></a><code translate="no" dir="ltr"><span>ORGANIC<wbr/></span><span></span></code></td><td><div>Direct URL entry, site search, or app download.</div></td></tr><tr><td><a id="googletag.enums.TrafficSource.PURCHASED"></a><a id="googletag.enums.TrafficSource_PURCHASED"></a><code translate="no" dir="ltr"><span>PURCHASED<wbr/></span><span></span></code></td><td><div>Traffic redirected from properties other than owned (acquired or otherwise incentivized activity).</div></td></tr></table></section></ul></section></section></section><hr/><section><a id="googletag_events"></a><h2 id="googletag.events" data-text="googletag.events" tabindex="-1">googletag.events</h2><div>This is the namespace that GPT uses for Events. Your code can react to these events using Service.addEventListener.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Interfaces</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event"><span>Event<wbr/></span><span></span></a></code></td><td><div>Base Interface for all GPT events.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.EventTypeMap"><span>Event<wbr/>Type<wbr/>Map<wbr/></span><span></span></a></code></td><td><div>This is a pseudo-type that maps an event name to its corresponding event object type for <a href="/publisher-tag/reference#googletag.Service.addEventListener">Service.addEventListener</a> and <a href="/publisher-tag/reference#googletag.Service.removeEventListener">Service.removeEventListener</a>.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.GameManualInterstitialSlotClosedEvent"><span>Game<wbr/>Manual<wbr/>Interstitial<wbr/>Slot<wbr/>Closed<wbr/>Event<wbr/></span><span></span></a></code></td><td><div>This event is fired when a game manual interstitial slot has been closed by the user.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.GameManualInterstitialSlotReadyEvent"><span>Game<wbr/>Manual<wbr/>Interstitial<wbr/>Slot<wbr/>Ready<wbr/>Event<wbr/></span><span></span></a></code></td><td><div>This event is fired when a game manual interstitial slot is ready to be shown to the user.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.ImpressionViewableEvent"><span>Impression<wbr/>Viewable<wbr/>Event<wbr/></span><span></span></a></code></td><td><div>This event is fired when an impression becomes viewable, according to the <a href="https://support.google.com/admanager/answer/4524488">Active View criteria</a>.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.RewardedSlotClosedEvent"><span>Rewarded<wbr/>Slot<wbr/>Closed<wbr/>Event<wbr/></span><span></span></a></code></td><td><div>This event is fired when a rewarded ad slot is closed by the user.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.RewardedSlotGrantedEvent"><span>Rewarded<wbr/>Slot<wbr/>Granted<wbr/>Event<wbr/></span><span></span></a></code></td><td><div>This event is fired when a reward is granted for viewing a <a href="https://support.google.com/admanager/answer/9116812">rewarded ad</a>.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.RewardedSlotReadyEvent"><span>Rewarded<wbr/>Slot<wbr/>Ready<wbr/>Event<wbr/></span><span></span></a></code></td><td><div>This event is fired when a <a href="https://support.google.com/admanager/answer/9116812">rewarded ad</a> is ready to be displayed.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotOnloadEvent"><span>Slot<wbr/>Onload<wbr/>Event<wbr/></span><span></span></a></code></td><td><div>This event is fired when the creative&#39;s iframe fires its load event.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotRenderEndedEvent"><span>Slot<wbr/>Render<wbr/>Ended<wbr/>Event<wbr/></span><span></span></a></code></td><td><div>This event is fired when the creative code is injected into a slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotRequestedEvent"><span>Slot<wbr/>Requested<wbr/>Event<wbr/></span><span></span></a></code></td><td><div>This event is fired when an ad has been requested for a particular slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotResponseReceived"><span>Slot<wbr/>Response<wbr/>Received<wbr/></span><span></span></a></code></td><td><div>This event is fired when an ad response has been received for a particular slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotVisibilityChangedEvent"><span>Slot<wbr/>Visibility<wbr/>Changed<wbr/>Event<wbr/></span><span></span></a></code></td><td><div>This event is fired whenever the on-screen percentage of an ad slot&#39;s area changes.</div></td></tr></table></section><section></section><hr/><section><a id="googletag.events_Event"></a><h2 id="googletag.events.Event" data-text="googletag.events.Event" tabindex="-1">googletag.events.Event</h2><div>Base Interface for all GPT events. All GPT events below will have the following fields.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName"><span>service<wbr/>Name<wbr/></span><span></span></a></code></td><td><div>Name of the service that triggered the event.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot"><span>slot<wbr/></span><span></span></a></code></td><td><div>The slot that triggered the event.</div></td></tr></table></section><section><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/samples/ad-event-listeners">Ad event listeners</a></li></ul></dd></dl></section><section><h3 class="hide-from-toc" id="googletag.events.Event_Properties" data-text="Properties" tabindex="-1">Properties</h3><section><hr/><h4 id="googletag.events.Event.serviceName" data-text="serviceName" tabindex="-1"><a id="googletag.events.Event_serviceName"></a><span>serviceName</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>serviceName</span><span>:</span> <span>string</span></code></div><p>Name of the service that triggered the event.</p></ul></section><section><hr/><h4 id="googletag.events.Event.slot" data-text="slot" tabindex="-1"><a id="googletag.events.Event_slot"></a><span>slot</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>slot</span><span>:</span> <a href="/publisher-tag/reference#googletag.Slot">Slot</a></code></div><p>The slot that triggered the event.</p></ul></section></section></section><hr/><section><a id="googletag.events_EventTypeMap"></a><h2 id="googletag.events.EventTypeMap" data-text="googletag.events.EventTypeMap" tabindex="-1">googletag.events.EventTypeMap</h2><div>This is a pseudo-type that maps an event name to its corresponding event object type for <a href="/publisher-tag/reference#googletag.Service.addEventListener">Service.addEventListener</a> and <a href="/publisher-tag/reference#googletag.Service.removeEventListener">Service.removeEventListener</a>. It is documented for reference and type safety purposes only.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.EventTypeMap.gameManualInterstitialSlotClosed"><span>game<wbr/>Manual<wbr/>Interstitial<wbr/>Slot<wbr/>Closed<wbr/></span><span></span></a></code></td><td><div>Alias for <a href="/publisher-tag/reference#googletag.events.GameManualInterstitialSlotClosedEvent">events.GameManualInterstitialSlotClosedEvent</a>.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.EventTypeMap.gameManualInterstitialSlotReady"><span>game<wbr/>Manual<wbr/>Interstitial<wbr/>Slot<wbr/>Ready<wbr/></span><span></span></a></code></td><td><div>Alias for <a href="/publisher-tag/reference#googletag.events.GameManualInterstitialSlotReadyEvent">events.GameManualInterstitialSlotReadyEvent</a>.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.EventTypeMap.impressionViewable"><span>impression<wbr/>Viewable<wbr/></span><span></span></a></code></td><td><div>Alias for <a href="/publisher-tag/reference#googletag.events.ImpressionViewableEvent">events.ImpressionViewableEvent</a>.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.EventTypeMap.rewardedSlotClosed"><span>rewarded<wbr/>Slot<wbr/>Closed<wbr/></span><span></span></a></code></td><td><div>Alias for <a href="/publisher-tag/reference#googletag.events.RewardedSlotClosedEvent">events.RewardedSlotClosedEvent</a>.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.EventTypeMap.rewardedSlotGranted"><span>rewarded<wbr/>Slot<wbr/>Granted<wbr/></span><span></span></a></code></td><td><div>Alias for <a href="/publisher-tag/reference#googletag.events.RewardedSlotGrantedEvent">events.RewardedSlotGrantedEvent</a>.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.EventTypeMap.rewardedSlotReady"><span>rewarded<wbr/>Slot<wbr/>Ready<wbr/></span><span></span></a></code></td><td><div>Alias for <a href="/publisher-tag/reference#googletag.events.RewardedSlotReadyEvent">events.RewardedSlotReadyEvent</a>.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.EventTypeMap.slotOnload"><span>slot<wbr/>Onload<wbr/></span><span></span></a></code></td><td><div>Alias for <a href="/publisher-tag/reference#googletag.events.SlotOnloadEvent">events.SlotOnloadEvent</a>.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.EventTypeMap.slotRenderEnded"><span>slot<wbr/>Render<wbr/>Ended<wbr/></span><span></span></a></code></td><td><div>Alias for <a href="/publisher-tag/reference#googletag.events.SlotRenderEndedEvent">events.SlotRenderEndedEvent</a>.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.EventTypeMap.slotRequested"><span>slot<wbr/>Requested<wbr/></span><span></span></a></code></td><td><div>Alias for <a href="/publisher-tag/reference#googletag.events.SlotRequestedEvent">events.SlotRequestedEvent</a>.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.EventTypeMap.slotResponseReceived"><span>slot<wbr/>Response<wbr/>Received<wbr/></span><span></span></a></code></td><td><div>Alias for <a href="/publisher-tag/reference#googletag.events.SlotResponseReceived">events.SlotResponseReceived</a>.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.EventTypeMap.slotVisibilityChanged"><span>slot<wbr/>Visibility<wbr/>Changed<wbr/></span><span></span></a></code></td><td><div>Alias for <a href="/publisher-tag/reference#googletag.events.SlotVisibilityChangedEvent">events.SlotVisibilityChangedEvent</a>.</div></td></tr></table></section><section></section><section><h3 class="hide-from-toc" id="googletag.events.EventTypeMap_Properties" data-text="Properties" tabindex="-1">Properties</h3><section><hr/><h4 id="googletag.events.EventTypeMap.gameManualInterstitialSlotClosed" data-text="gameManualInterstitialSlotClosed" tabindex="-1"><a id="googletag.events.EventTypeMap_gameManualInterstitialSlotClosed"></a><span>gameManualInterstitialSlotClosed</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>gameManualInterstitialSlotClosed</span><span>:</span> <a href="/publisher-tag/reference#googletag.events.GameManualInterstitialSlotClosedEvent">GameManualInterstitialSlotClosedEvent</a></code></div><p>Alias for <a href="/publisher-tag/reference#googletag.events.GameManualInterstitialSlotClosedEvent">events.GameManualInterstitialSlotClosedEvent</a>.</p></ul></section><section><hr/><h4 id="googletag.events.EventTypeMap.gameManualInterstitialSlotReady" data-text="gameManualInterstitialSlotReady" tabindex="-1"><a id="googletag.events.EventTypeMap_gameManualInterstitialSlotReady"></a><span>gameManualInterstitialSlotReady</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>gameManualInterstitialSlotReady</span><span>:</span> <a href="/publisher-tag/reference#googletag.events.GameManualInterstitialSlotReadyEvent">GameManualInterstitialSlotReadyEvent</a></code></div><p>Alias for <a href="/publisher-tag/reference#googletag.events.GameManualInterstitialSlotReadyEvent">events.GameManualInterstitialSlotReadyEvent</a>.</p></ul></section><section><hr/><h4 id="googletag.events.EventTypeMap.impressionViewable" data-text="impressionViewable" tabindex="-1"><a id="googletag.events.EventTypeMap_impressionViewable"></a><span>impressionViewable</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>impressionViewable</span><span>:</span> <a href="/publisher-tag/reference#googletag.events.ImpressionViewableEvent">ImpressionViewableEvent</a></code></div><p>Alias for <a href="/publisher-tag/reference#googletag.events.ImpressionViewableEvent">events.ImpressionViewableEvent</a>.</p></ul></section><section><hr/><h4 id="googletag.events.EventTypeMap.rewardedSlotClosed" data-text="rewardedSlotClosed" tabindex="-1"><a id="googletag.events.EventTypeMap_rewardedSlotClosed"></a><span>rewardedSlotClosed</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>rewardedSlotClosed</span><span>:</span> <a href="/publisher-tag/reference#googletag.events.RewardedSlotClosedEvent">RewardedSlotClosedEvent</a></code></div><p>Alias for <a href="/publisher-tag/reference#googletag.events.RewardedSlotClosedEvent">events.RewardedSlotClosedEvent</a>.</p></ul></section><section><hr/><h4 id="googletag.events.EventTypeMap.rewardedSlotGranted" data-text="rewardedSlotGranted" tabindex="-1"><a id="googletag.events.EventTypeMap_rewardedSlotGranted"></a><span>rewardedSlotGranted</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>rewardedSlotGranted</span><span>:</span> <a href="/publisher-tag/reference#googletag.events.RewardedSlotGrantedEvent">RewardedSlotGrantedEvent</a></code></div><p>Alias for <a href="/publisher-tag/reference#googletag.events.RewardedSlotGrantedEvent">events.RewardedSlotGrantedEvent</a>.</p></ul></section><section><hr/><h4 id="googletag.events.EventTypeMap.rewardedSlotReady" data-text="rewardedSlotReady" tabindex="-1"><a id="googletag.events.EventTypeMap_rewardedSlotReady"></a><span>rewardedSlotReady</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>rewardedSlotReady</span><span>:</span> <a href="/publisher-tag/reference#googletag.events.RewardedSlotReadyEvent">RewardedSlotReadyEvent</a></code></div><p>Alias for <a href="/publisher-tag/reference#googletag.events.RewardedSlotReadyEvent">events.RewardedSlotReadyEvent</a>.</p></ul></section><section><hr/><h4 id="googletag.events.EventTypeMap.slotOnload" data-text="slotOnload" tabindex="-1"><a id="googletag.events.EventTypeMap_slotOnload"></a><span>slotOnload</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>slotOnload</span><span>:</span> <a href="/publisher-tag/reference#googletag.events.SlotOnloadEvent">SlotOnloadEvent</a></code></div><p>Alias for <a href="/publisher-tag/reference#googletag.events.SlotOnloadEvent">events.SlotOnloadEvent</a>.</p></ul></section><section><hr/><h4 id="googletag.events.EventTypeMap.slotRenderEnded" data-text="slotRenderEnded" tabindex="-1"><a id="googletag.events.EventTypeMap_slotRenderEnded"></a><span>slotRenderEnded</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>slotRenderEnded</span><span>:</span> <a href="/publisher-tag/reference#googletag.events.SlotRenderEndedEvent">SlotRenderEndedEvent</a></code></div><p>Alias for <a href="/publisher-tag/reference#googletag.events.SlotRenderEndedEvent">events.SlotRenderEndedEvent</a>.</p></ul></section><section><hr/><h4 id="googletag.events.EventTypeMap.slotRequested" data-text="slotRequested" tabindex="-1"><a id="googletag.events.EventTypeMap_slotRequested"></a><span>slotRequested</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>slotRequested</span><span>:</span> <a href="/publisher-tag/reference#googletag.events.SlotRequestedEvent">SlotRequestedEvent</a></code></div><p>Alias for <a href="/publisher-tag/reference#googletag.events.SlotRequestedEvent">events.SlotRequestedEvent</a>.</p></ul></section><section><hr/><h4 id="googletag.events.EventTypeMap.slotResponseReceived" data-text="slotResponseReceived" tabindex="-1"><a id="googletag.events.EventTypeMap_slotResponseReceived"></a><span>slotResponseReceived</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>slotResponseReceived</span><span>:</span> <a href="/publisher-tag/reference#googletag.events.SlotResponseReceived">SlotResponseReceived</a></code></div><p>Alias for <a href="/publisher-tag/reference#googletag.events.SlotResponseReceived">events.SlotResponseReceived</a>.</p></ul></section><section><hr/><h4 id="googletag.events.EventTypeMap.slotVisibilityChanged" data-text="slotVisibilityChanged" tabindex="-1"><a id="googletag.events.EventTypeMap_slotVisibilityChanged"></a><span>slotVisibilityChanged</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>slotVisibilityChanged</span><span>:</span> <a href="/publisher-tag/reference#googletag.events.SlotVisibilityChangedEvent">SlotVisibilityChangedEvent</a></code></div><p>Alias for <a href="/publisher-tag/reference#googletag.events.SlotVisibilityChangedEvent">events.SlotVisibilityChangedEvent</a>.</p></ul></section></section></section><hr/><section><a id="googletag.events_GameManualInterstitialSlotClosedEvent"></a><h2 id="googletag.events.GameManualInterstitialSlotClosedEvent" data-text="googletag.events.GameManualInterstitialSlotClosedEvent" tabindex="-1">googletag.events.GameManualInterstitialSlotClosedEvent</h2><div style="padding-left: 20px; margin: -20px 0 16px 0;"><span class="material-icons" aria-hidden="true" translate="no">subdirectory_arrow_right</span>Extends <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event">Event</a></code></div><div>This event is fired when a game manual interstitial slot has been closed by the user.<br><br><strong>Note:</strong> Game manual interstitial is a <a href="https://support.google.com/admanager/answer/14640119">limited-access</a> format.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName"><span>service<wbr/>Name<wbr/></span><span></span></a></code></td><td><div>Name of the service that triggered the event.<h6 class="no-link" id="inherited-from-event.servicename" data-text="Inherited from Event.serviceName" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName">Event.serviceName</a></code></h6></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot"><span>slot<wbr/></span><span></span></a></code></td><td><div>The slot that triggered the event.<h6 class="no-link" id="inherited-from-event.slot" data-text="Inherited from Event.slot" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot">Event.slot</a></code></h6></div></td></tr></table></section><section><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_59" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when a game manual interstial slot is closed. const targetSlot = googletag.defineOutOfPageSlot( &quot;/1234567/example&quot;, googletag.enums.OutOfPageFormat.GAME_MANUAL_INTERSTITIAL, ); googletag.pubads().addEventListener(&quot;gameManualInterstitialSlotClosed&quot;, (event) =&gt; { const slot = event.slot; console.log(&quot;Game manual interstital slot&quot;, slot.getSlotElementId(), &quot;is closed.&quot;); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="javascript-legacy_59" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when a game manual interstial slot is closed. var targetSlot = googletag.defineOutOfPageSlot( &quot;/1234567/example&quot;, googletag.enums.OutOfPageFormat.GAME_MANUAL_INTERSTITIAL, ); googletag.pubads().addEventListener(&quot;gameManualInterstitialSlotClosed&quot;, function (event) { var slot = event.slot; console.log(&quot;Game manual interstital slot&quot;, slot.getSlotElementId(), &quot;is closed.&quot;); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="typescript_59" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when a game manual interstial slot is closed. const targetSlot = googletag.defineOutOfPageSlot( &quot;/1234567/example&quot;, googletag.enums.OutOfPageFormat.GAME_MANUAL_INTERSTITIAL, ); googletag.pubads().addEventListener(&quot;gameManualInterstitialSlotClosed&quot;, (event) =&gt; { const slot = event.slot; console.log(&quot;Game manual interstital slot&quot;, slot.getSlotElementId(), &quot;is closed.&quot;); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul> <li><a href="https://developers.google.com/publisher-tag/samples/ad-event-listeners">Ad event listeners</a></li> <li><a href="https://support.google.com/admanager/answer/14640119">Display a game manual interstitial ad</a></li> </ul></dd></dl></section></section><hr/><section><a id="googletag.events_GameManualInterstitialSlotReadyEvent"></a><h2 id="googletag.events.GameManualInterstitialSlotReadyEvent" data-text="googletag.events.GameManualInterstitialSlotReadyEvent" tabindex="-1">googletag.events.GameManualInterstitialSlotReadyEvent</h2><div style="padding-left: 20px; margin: -20px 0 16px 0;"><span class="material-icons" aria-hidden="true" translate="no">subdirectory_arrow_right</span>Extends <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event">Event</a></code></div><div>This event is fired when a game manual interstitial slot is ready to be shown to the user.<br><br><strong>Note:</strong> Game manual interstitial is a <a href="https://support.google.com/admanager/answer/14640119">limited-access</a> format.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName"><span>service<wbr/>Name<wbr/></span><span></span></a></code></td><td><div>Name of the service that triggered the event.<h6 class="no-link" id="inherited-from-event.servicename_1" data-text="Inherited from Event.serviceName" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName">Event.serviceName</a></code></h6></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot"><span>slot<wbr/></span><span></span></a></code></td><td><div>The slot that triggered the event.<h6 class="no-link" id="inherited-from-event.slot_1" data-text="Inherited from Event.slot" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot">Event.slot</a></code></h6></div></td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Methods</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.GameManualInterstitialSlotReadyEvent.makeGameManualInterstitialVisible"><span>make<wbr/>Game<wbr/>Manual<wbr/>Interstitial<wbr/>Visible<wbr/></span><span></span></a></code></td><td><div>Displays the game manual interstitial ad to the user.</div></td></tr></table></section><section><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_60" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when a game manual interstitial slot is ready to // be displayed. const targetSlot = googletag.defineOutOfPageSlot( &quot;/1234567/example&quot;, googletag.enums.OutOfPageFormat.GAME_MANUAL_INTERSTITIAL, ); googletag.pubads().addEventListener(&quot;gameManualInterstitialSlotReady&quot;, (event) =&gt; { const slot = event.slot; console.log(&quot;Game manual interstital slot&quot;, slot.getSlotElementId(), &quot;is ready to be displayed.&quot;); //Replace with custom logic. const displayGmiAd = true; if (displayGmiAd) { event.makeGameManualInterstitialVisible(); } if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="javascript-legacy_60" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when a game manual interstitial slot is ready to // be displayed. var targetSlot = googletag.defineOutOfPageSlot( &quot;/1234567/example&quot;, googletag.enums.OutOfPageFormat.GAME_MANUAL_INTERSTITIAL, ); googletag.pubads().addEventListener(&quot;gameManualInterstitialSlotReady&quot;, function (event) { var slot = event.slot; console.log(&quot;Game manual interstital slot&quot;, slot.getSlotElementId(), &quot;is ready to be displayed.&quot;); //Replace with custom logic. var displayGmiAd = true; if (displayGmiAd) { event.makeGameManualInterstitialVisible(); } if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="typescript_60" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when a game manual interstitial slot is ready to // be displayed. const targetSlot = googletag.defineOutOfPageSlot( &quot;/1234567/example&quot;, googletag.enums.OutOfPageFormat.GAME_MANUAL_INTERSTITIAL, ); googletag.pubads().addEventListener(&quot;gameManualInterstitialSlotReady&quot;, (event) =&gt; { const slot = event.slot; console.log(&quot;Game manual interstital slot&quot;, slot.getSlotElementId(), &quot;is ready to be displayed.&quot;); //Replace with custom logic. const displayGmiAd = true; if (displayGmiAd) { event.makeGameManualInterstitialVisible(); } if (slot === targetSlot) { // Slot specific logic. } }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul> <li><a href="https://developers.google.com/publisher-tag/samples/ad-event-listeners">Ad event listeners</a></li> <li><a href="https://support.google.com/admanager/answer/14640119">Display a game manual interstitial ad</a></li> </ul></dd></dl></section><section><h3 class="hide-from-toc" id="googletag.events.GameManualInterstitialSlotReadyEvent_Methods" data-text="Methods" tabindex="-1">Methods</h3><section><hr/><h4 id="googletag.events.GameManualInterstitialSlotReadyEvent.makeGameManualInterstitialVisible" data-text="makeGameManualInterstitialVisible" tabindex="-1"><a id="googletag.events.GameManualInterstitialSlotReadyEvent_makeGameManualInterstitialVisible"></a><span>makeGameManualInterstitialVisible</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>makeGameManualInterstitialVisible</span><span>(</span><span>)</span><span>: </span><span>void</span></code><p>Displays the game manual interstitial ad to the user.</p></ul></section></section></section><hr/><section><a id="googletag.events_ImpressionViewableEvent"></a><h2 id="googletag.events.ImpressionViewableEvent" data-text="googletag.events.ImpressionViewableEvent" tabindex="-1">googletag.events.ImpressionViewableEvent</h2><div style="padding-left: 20px; margin: -20px 0 16px 0;"><span class="material-icons" aria-hidden="true" translate="no">subdirectory_arrow_right</span>Extends <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event">Event</a></code></div><div>This event is fired when an impression becomes viewable, according to the <a href="https://support.google.com/admanager/answer/4524488">Active View criteria</a>.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName"><span>service<wbr/>Name<wbr/></span><span></span></a></code></td><td><div>Name of the service that triggered the event.<h6 class="no-link" id="inherited-from-event.servicename_2" data-text="Inherited from Event.serviceName" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName">Event.serviceName</a></code></h6></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot"><span>slot<wbr/></span><span></span></a></code></td><td><div>The slot that triggered the event.<h6 class="no-link" id="inherited-from-event.slot_2" data-text="Inherited from Event.slot" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot">Event.slot</a></code></h6></div></td></tr></table></section><section><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_61" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when an impression becomes viewable. const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;impressionViewable&quot;, (event) =&gt; { const slot = event.slot; console.log(&quot;Impression for slot&quot;, slot.getSlotElementId(), &quot;became viewable.&quot;); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="javascript-legacy_61" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when an impression becomes viewable. var targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;impressionViewable&quot;, function (event) { var slot = event.slot; console.log(&quot;Impression for slot&quot;, slot.getSlotElementId(), &quot;became viewable.&quot;); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="typescript_61" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when an impression becomes viewable. const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;impressionViewable&quot;, (event) =&gt; { const slot = event.slot; console.log(&quot;Impression for slot&quot;, slot.getSlotElementId(), &quot;became viewable.&quot;); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/samples/ad-event-listeners">Ad event listeners</a></li></ul></dd></dl></section></section><hr/><section><a id="googletag.events_RewardedSlotClosedEvent"></a><h2 id="googletag.events.RewardedSlotClosedEvent" data-text="googletag.events.RewardedSlotClosedEvent" tabindex="-1">googletag.events.RewardedSlotClosedEvent</h2><div style="padding-left: 20px; margin: -20px 0 16px 0;"><span class="material-icons" aria-hidden="true" translate="no">subdirectory_arrow_right</span>Extends <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event">Event</a></code></div><div>This event is fired when a rewarded ad slot is closed by the user. It may fire either before or after a reward has been granted. To determine whether a reward has been granted, use <a href="/publisher-tag/reference#googletag.events.RewardedSlotGrantedEvent">events.RewardedSlotGrantedEvent</a> instead.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName"><span>service<wbr/>Name<wbr/></span><span></span></a></code></td><td><div>Name of the service that triggered the event.<h6 class="no-link" id="inherited-from-event.servicename_3" data-text="Inherited from Event.serviceName" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName">Event.serviceName</a></code></h6></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot"><span>slot<wbr/></span><span></span></a></code></td><td><div>The slot that triggered the event.<h6 class="no-link" id="inherited-from-event.slot_3" data-text="Inherited from Event.slot" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot">Event.slot</a></code></h6></div></td></tr></table></section><section><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_62" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when the user closes a rewarded ad slot. const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;rewardedSlotClosed&quot;, (event) =&gt; { const slot = event.slot; console.log(&quot;Rewarded ad slot&quot;, slot.getSlotElementId(), &quot;has been closed.&quot;); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="javascript-legacy_62" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when the user closes a rewarded ad slot. var targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;rewardedSlotClosed&quot;, function (event) { var slot = event.slot; console.log(&quot;Rewarded ad slot&quot;, slot.getSlotElementId(), &quot;has been closed.&quot;); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="typescript_62" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when the user closes a rewarded ad slot. const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;rewardedSlotClosed&quot;, (event) =&gt; { const slot = event.slot; console.log(&quot;Rewarded ad slot&quot;, slot.getSlotElementId(), &quot;has been closed.&quot;); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul> <li><a href="https://developers.google.com/publisher-tag/samples/ad-event-listeners">Ad event listeners</a></li> <li><a href="https://developers.google.com/publisher-tag/samples/display-rewarded-ad">Display a rewarded ad</a></li> </ul></dd></dl></section></section><hr/><section><a id="googletag.events_RewardedSlotGrantedEvent"></a><h2 id="googletag.events.RewardedSlotGrantedEvent" data-text="googletag.events.RewardedSlotGrantedEvent" tabindex="-1">googletag.events.RewardedSlotGrantedEvent</h2><div style="padding-left: 20px; margin: -20px 0 16px 0;"><span class="material-icons" aria-hidden="true" translate="no">subdirectory_arrow_right</span>Extends <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event">Event</a></code></div><div>This event is fired when a reward is granted for viewing a <a href="https://support.google.com/admanager/answer/9116812">rewarded ad</a>. If the ad is closed before the criteria for granting a reward is met, this event will not fire.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.RewardedSlotGrantedEvent.payload"><span>payload<wbr/></span><span></span></a></code></td><td><div>An object containing information about the reward that was granted.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName"><span>service<wbr/>Name<wbr/></span><span></span></a></code></td><td><div>Name of the service that triggered the event.<h6 class="no-link" id="inherited-from-event.servicename_4" data-text="Inherited from Event.serviceName" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName">Event.serviceName</a></code></h6></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot"><span>slot<wbr/></span><span></span></a></code></td><td><div>The slot that triggered the event.<h6 class="no-link" id="inherited-from-event.slot_4" data-text="Inherited from Event.slot" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot">Event.slot</a></code></h6></div></td></tr></table></section><section><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_63" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called whenever a reward is granted for a // rewarded ad. const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;rewardedSlotGranted&quot;, (event) =&gt; { const slot = event.slot; console.group(&quot;Reward granted for slot&quot;, slot.getSlotElementId(), &quot;.&quot;); // Log details of the reward. console.log(&quot;Reward type:&quot;, event.payload?.type); console.log(&quot;Reward amount:&quot;, event.payload?.amount); console.groupEnd(); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="javascript-legacy_63" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called whenever a reward is granted for a // rewarded ad. var targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;rewardedSlotGranted&quot;, function (event) { var _a, _b; var slot = event.slot; console.group(&quot;Reward granted for slot&quot;, slot.getSlotElementId(), &quot;.&quot;); // Log details of the reward. console.log(&quot;Reward type:&quot;, (_a = event.payload) === null || _a === void 0 ? void 0 : _a.type); console.log( &quot;Reward amount:&quot;, (_b = event.payload) === null || _b === void 0 ? void 0 : _b.amount, ); console.groupEnd(); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="typescript_63" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called whenever a reward is granted for a // rewarded ad. const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;rewardedSlotGranted&quot;, (event) =&gt; { const slot = event.slot; console.group(&quot;Reward granted for slot&quot;, slot.getSlotElementId(), &quot;.&quot;); // Log details of the reward. console.log(&quot;Reward type:&quot;, event.payload?.type); console.log(&quot;Reward amount:&quot;, event.payload?.amount); console.groupEnd(); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul> <li><a href="https://developers.google.com/publisher-tag/samples/ad-event-listeners">Ad event listeners</a></li> <li><a href="https://developers.google.com/publisher-tag/samples/display-rewarded-ad">Display a rewarded ad</a></li> </ul></dd></dl></section><section><h3 class="hide-from-toc" id="googletag.events.RewardedSlotGrantedEvent_Properties" data-text="Properties" tabindex="-1">Properties</h3><section><hr/><h4 id="googletag.events.RewardedSlotGrantedEvent.payload" data-text="payload" tabindex="-1"><a id="googletag.events.RewardedSlotGrantedEvent_payload"></a><span>payload</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>payload</span><span>:</span> <span>null</span><span> | </span><a href="/publisher-tag/reference#googletag.RewardedPayload">RewardedPayload</a></code></div><p>An object containing information about the reward that was granted.</p></ul></section></section></section><hr/><section><a id="googletag.events_RewardedSlotReadyEvent"></a><h2 id="googletag.events.RewardedSlotReadyEvent" data-text="googletag.events.RewardedSlotReadyEvent" tabindex="-1">googletag.events.RewardedSlotReadyEvent</h2><div style="padding-left: 20px; margin: -20px 0 16px 0;"><span class="material-icons" aria-hidden="true" translate="no">subdirectory_arrow_right</span>Extends <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event">Event</a></code></div><div>This event is fired when a <a href="https://support.google.com/admanager/answer/9116812">rewarded ad</a> is ready to be displayed. The publisher is responsible for presenting the user an option to view the ad before displaying it.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName"><span>service<wbr/>Name<wbr/></span><span></span></a></code></td><td><div>Name of the service that triggered the event.<h6 class="no-link" id="inherited-from-event.servicename_5" data-text="Inherited from Event.serviceName" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName">Event.serviceName</a></code></h6></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot"><span>slot<wbr/></span><span></span></a></code></td><td><div>The slot that triggered the event.<h6 class="no-link" id="inherited-from-event.slot_5" data-text="Inherited from Event.slot" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot">Event.slot</a></code></h6></div></td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Methods</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.RewardedSlotReadyEvent.makeRewardedVisible"><span>make<wbr/>Rewarded<wbr/>Visible<wbr/></span><span></span></a></code></td><td><div>Displays the rewarded ad.</div></td></tr></table></section><section><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_64" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when a rewarded ad slot becomes ready to be // displayed. const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;rewardedSlotReady&quot;, (event) =&gt; { const slot = event.slot; console.log(&quot;Rewarded ad slot&quot;, slot.getSlotElementId(), &quot;is ready to be displayed.&quot;); // Replace with custom logic. const userHasConsented = true; if (userHasConsented) { event.makeRewardedVisible(); } if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="javascript-legacy_64" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when a rewarded ad slot becomes ready to be // displayed. var targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;rewardedSlotReady&quot;, function (event) { var slot = event.slot; console.log(&quot;Rewarded ad slot&quot;, slot.getSlotElementId(), &quot;is ready to be displayed.&quot;); // Replace with custom logic. var userHasConsented = true; if (userHasConsented) { event.makeRewardedVisible(); } if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="typescript_64" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when a rewarded ad slot becomes ready to be // displayed. const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;rewardedSlotReady&quot;, (event) =&gt; { const slot = event.slot; console.log(&quot;Rewarded ad slot&quot;, slot.getSlotElementId(), &quot;is ready to be displayed.&quot;); // Replace with custom logic. const userHasConsented = true; if (userHasConsented) { event.makeRewardedVisible(); } if (slot === targetSlot) { // Slot specific logic. } }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul> <li><a href="https://developers.google.com/publisher-tag/samples/ad-event-listeners">Ad event listeners</a></li> <li><a href="https://developers.google.com/publisher-tag/samples/display-rewarded-ad">Display a rewarded ad</a></li> </ul></dd></dl></section><section><h3 class="hide-from-toc" id="googletag.events.RewardedSlotReadyEvent_Methods" data-text="Methods" tabindex="-1">Methods</h3><section><hr/><h4 id="googletag.events.RewardedSlotReadyEvent.makeRewardedVisible" data-text="makeRewardedVisible" tabindex="-1"><a id="googletag.events.RewardedSlotReadyEvent_makeRewardedVisible"></a><span>makeRewardedVisible</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>makeRewardedVisible</span><span>(</span><span>)</span><span>: </span><span>void</span></code><p>Displays the rewarded ad. This method should not be called until the user has consented to view the ad.</p></ul></section></section></section><hr/><section><a id="googletag.events_SlotOnloadEvent"></a><h2 id="googletag.events.SlotOnloadEvent" data-text="googletag.events.SlotOnloadEvent" tabindex="-1">googletag.events.SlotOnloadEvent</h2><div style="padding-left: 20px; margin: -20px 0 16px 0;"><span class="material-icons" aria-hidden="true" translate="no">subdirectory_arrow_right</span>Extends <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event">Event</a></code></div><div>This event is fired when the creative&#39;s iframe fires its load event. When rendering rich media ads in sync rendering mode, no iframe is used so no <code translate="no" dir="ltr">SlotOnloadEvent</code> will be fired.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName"><span>service<wbr/>Name<wbr/></span><span></span></a></code></td><td><div>Name of the service that triggered the event.<h6 class="no-link" id="inherited-from-event.servicename_6" data-text="Inherited from Event.serviceName" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName">Event.serviceName</a></code></h6></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot"><span>slot<wbr/></span><span></span></a></code></td><td><div>The slot that triggered the event.<h6 class="no-link" id="inherited-from-event.slot_6" data-text="Inherited from Event.slot" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot">Event.slot</a></code></h6></div></td></tr></table></section><section><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_65" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when a creative iframe load event fires. const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;slotOnload&quot;, (event) =&gt; { const slot = event.slot; console.log(&quot;Creative iframe for slot&quot;, slot.getSlotElementId(), &quot;has loaded.&quot;); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="javascript-legacy_65" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when a creative iframe load event fires. var targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;slotOnload&quot;, function (event) { var slot = event.slot; console.log(&quot;Creative iframe for slot&quot;, slot.getSlotElementId(), &quot;has loaded.&quot;); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="typescript_65" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when a creative iframe load event fires. const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;slotOnload&quot;, (event) =&gt; { const slot = event.slot; console.log(&quot;Creative iframe for slot&quot;, slot.getSlotElementId(), &quot;has loaded.&quot;); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/samples/ad-event-listeners">Ad event listeners</a></li></ul></dd></dl></section></section><hr/><section><a id="googletag.events_SlotRenderEndedEvent"></a><h2 id="googletag.events.SlotRenderEndedEvent" data-text="googletag.events.SlotRenderEndedEvent" tabindex="-1">googletag.events.SlotRenderEndedEvent</h2><div style="padding-left: 20px; margin: -20px 0 16px 0;"><span class="material-icons" aria-hidden="true" translate="no">subdirectory_arrow_right</span>Extends <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event">Event</a></code></div><div>This event is fired when the creative code is injected into a slot. This event will occur before the creative&#39;s resources are fetched, so the creative may not be visible yet. If you need to know when all creative resources for a slot have finished loading, consider the <a href="/publisher-tag/reference#googletag.events.SlotOnloadEvent">events.SlotOnloadEvent</a> instead.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotRenderEndedEvent.advertiserId"><span>advertiser<wbr/>Id<wbr/></span><span></span></a></code></td><td><div>Advertiser ID of the rendered ad.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotRenderEndedEvent.campaignId"><span>campaign<wbr/>Id<wbr/></span><span></span></a></code></td><td><div>Campaign ID of the rendered ad.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotRenderEndedEvent.companyIds"><span>company<wbr/>Ids<wbr/></span><span></span></a></code></td><td><div>IDs of the companies that bid on the rendered backfill ad.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotRenderEndedEvent.creativeId"><span>creative<wbr/>Id<wbr/></span><span></span></a></code></td><td><div>Creative ID of the rendered reservation ad.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotRenderEndedEvent.creativeTemplateId"><span>creative<wbr/>Template<wbr/>Id<wbr/></span><span></span></a></code></td><td><div>Creative template ID of the rendered reservation ad.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotRenderEndedEvent.isBackfill"><span>is<wbr/>Backfill<wbr/></span><span></span></a></code></td><td><div>Whether an ad was a backfill ad.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotRenderEndedEvent.isEmpty"><span>is<wbr/>Empty<wbr/></span><span></span></a></code></td><td><div>Whether an ad was returned for the slot.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotRenderEndedEvent.labelIds"><span>label<wbr/>Ids<wbr/></span><span></span></a></code></td><td><div><b>Deprecated. </b></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotRenderEndedEvent.lineItemId"><span>line<wbr/>Item<wbr/>Id<wbr/></span><span></span></a></code></td><td><div>Line item ID of the rendered reservation ad.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName"><span>service<wbr/>Name<wbr/></span><span></span></a></code></td><td><div>Name of the service that triggered the event.<h6 class="no-link" id="inherited-from-event.servicename_7" data-text="Inherited from Event.serviceName" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName">Event.serviceName</a></code></h6></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotRenderEndedEvent.size"><span>size<wbr/></span><span></span></a></code></td><td><div>Indicates the pixel size of the rendered creative.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot"><span>slot<wbr/></span><span></span></a></code></td><td><div>The slot that triggered the event.<h6 class="no-link" id="inherited-from-event.slot_7" data-text="Inherited from Event.slot" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot">Event.slot</a></code></h6></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotRenderEndedEvent.slotContentChanged"><span>slot<wbr/>Content<wbr/>Changed<wbr/></span><span></span></a></code></td><td><div>Whether the slot content was changed with the rendered ad.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotRenderEndedEvent.sourceAgnosticCreativeId"><span>source<wbr/>Agnostic<wbr/>Creative<wbr/>Id<wbr/></span><span></span></a></code></td><td><div>Creative ID of the rendered reservation or backfill ad.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotRenderEndedEvent.sourceAgnosticLineItemId"><span>source<wbr/>Agnostic<wbr/>Line<wbr/>Item<wbr/>Id<wbr/></span><span></span></a></code></td><td><div>Line item ID of the rendered reservation or backfill ad.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotRenderEndedEvent.yieldGroupIds"><span>yield<wbr/>Group<wbr/>Ids<wbr/></span><span></span></a></code></td><td><div>IDs of the yield groups for the rendered backfill ad.</div></td></tr></table></section><section><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_66" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when a slot has finished rendering. const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;slotRenderEnded&quot;, (event) =&gt; { const slot = event.slot; console.group(&quot;Slot&quot;, slot.getSlotElementId(), &quot;finished rendering.&quot;); // Log details of the rendered ad. console.log(&quot;Advertiser ID:&quot;, event.advertiserId); console.log(&quot;Campaign ID:&quot;, event.campaignId); console.log(&quot;Company IDs:&quot;, event.companyIds); console.log(&quot;Creative ID:&quot;, event.creativeId); console.log(&quot;Creative Template ID:&quot;, event.creativeTemplateId); console.log(&quot;Is backfill?:&quot;, event.isBackfill); console.log(&quot;Is empty?:&quot;, event.isEmpty); console.log(&quot;Line Item ID:&quot;, event.lineItemId); console.log(&quot;Size:&quot;, event.size); console.log(&quot;Slot content changed?&quot;, event.slotContentChanged); console.log(&quot;Source Agnostic Creative ID:&quot;, event.sourceAgnosticCreativeId); console.log(&quot;Source Agnostic Line Item ID:&quot;, event.sourceAgnosticLineItemId); console.log(&quot;Yield Group IDs:&quot;, event.yieldGroupIds); console.groupEnd(); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="javascript-legacy_66" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when a slot has finished rendering. var targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;slotRenderEnded&quot;, function (event) { var slot = event.slot; console.group(&quot;Slot&quot;, slot.getSlotElementId(), &quot;finished rendering.&quot;); // Log details of the rendered ad. console.log(&quot;Advertiser ID:&quot;, event.advertiserId); console.log(&quot;Campaign ID:&quot;, event.campaignId); console.log(&quot;Company IDs:&quot;, event.companyIds); console.log(&quot;Creative ID:&quot;, event.creativeId); console.log(&quot;Creative Template ID:&quot;, event.creativeTemplateId); console.log(&quot;Is backfill?:&quot;, event.isBackfill); console.log(&quot;Is empty?:&quot;, event.isEmpty); console.log(&quot;Line Item ID:&quot;, event.lineItemId); console.log(&quot;Size:&quot;, event.size); console.log(&quot;Slot content changed?&quot;, event.slotContentChanged); console.log(&quot;Source Agnostic Creative ID:&quot;, event.sourceAgnosticCreativeId); console.log(&quot;Source Agnostic Line Item ID:&quot;, event.sourceAgnosticLineItemId); console.log(&quot;Yield Group IDs:&quot;, event.yieldGroupIds); console.groupEnd(); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="typescript_66" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when a slot has finished rendering. const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;slotRenderEnded&quot;, (event) =&gt; { const slot = event.slot; console.group(&quot;Slot&quot;, slot.getSlotElementId(), &quot;finished rendering.&quot;); // Log details of the rendered ad. console.log(&quot;Advertiser ID:&quot;, event.advertiserId); console.log(&quot;Campaign ID:&quot;, event.campaignId); console.log(&quot;Company IDs:&quot;, event.companyIds); console.log(&quot;Creative ID:&quot;, event.creativeId); console.log(&quot;Creative Template ID:&quot;, event.creativeTemplateId); console.log(&quot;Is backfill?:&quot;, event.isBackfill); console.log(&quot;Is empty?:&quot;, event.isEmpty); console.log(&quot;Line Item ID:&quot;, event.lineItemId); console.log(&quot;Size:&quot;, event.size); console.log(&quot;Slot content changed?&quot;, event.slotContentChanged); console.log(&quot;Source Agnostic Creative ID:&quot;, event.sourceAgnosticCreativeId); console.log(&quot;Source Agnostic Line Item ID:&quot;, event.sourceAgnosticLineItemId); console.log(&quot;Yield Group IDs:&quot;, event.yieldGroupIds); console.groupEnd(); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/samples/ad-event-listeners">Ad event listeners</a></li></ul></dd></dl></section><section><h3 class="hide-from-toc" id="googletag.events.SlotRenderEndedEvent_Properties" data-text="Properties" tabindex="-1">Properties</h3><section><hr/><h4 id="googletag.events.SlotRenderEndedEvent.advertiserId" data-text="advertiserId" tabindex="-1"><a id="googletag.events.SlotRenderEndedEvent_advertiserId"></a><span>advertiserId</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>advertiserId</span><span>:</span> <span>null</span><span> | </span><span>number</span></code></div><p>Advertiser ID of the rendered ad. Value is <code translate="no" dir="ltr">null</code> for empty slots, backfill ads, and creatives rendered by services other than <a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a>.</p></ul></section><section><hr/><h4 id="googletag.events.SlotRenderEndedEvent.campaignId" data-text="campaignId" tabindex="-1"><a id="googletag.events.SlotRenderEndedEvent_campaignId"></a><span>campaignId</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>campaignId</span><span>:</span> <span>null</span><span> | </span><span>number</span></code></div><p>Campaign ID of the rendered ad. Value is <code translate="no" dir="ltr">null</code> for empty slots, backfill ads, and creatives rendered by services other than <a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a>.</p></ul></section><section><hr/><h4 id="googletag.events.SlotRenderEndedEvent.companyIds" data-text="companyIds" tabindex="-1"><a id="googletag.events.SlotRenderEndedEvent_companyIds"></a><span>companyIds</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>companyIds</span><span>:</span> <span>null</span><span> | </span><span>number</span><span>[]</span></code></div><p>IDs of the companies that bid on the rendered backfill ad. Value is <code translate="no" dir="ltr">null</code> for empty slots, reservation ads, and creatives rendered by services other than <a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a>.</p></ul></section><section><hr/><h4 id="googletag.events.SlotRenderEndedEvent.creativeId" data-text="creativeId" tabindex="-1"><a id="googletag.events.SlotRenderEndedEvent_creativeId"></a><span>creativeId</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>creativeId</span><span>:</span> <span>null</span><span> | </span><span>number</span></code></div><p>Creative ID of the rendered reservation ad. Value is <code translate="no" dir="ltr">null</code> for empty slots, backfill ads, and creatives rendered by services other than <a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a>.</p></ul></section><section><hr/><h4 id="googletag.events.SlotRenderEndedEvent.creativeTemplateId" data-text="creativeTemplateId" tabindex="-1"><a id="googletag.events.SlotRenderEndedEvent_creativeTemplateId"></a><span>creativeTemplateId</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>creativeTemplateId</span><span>:</span> <span>null</span><span> | </span><span>number</span></code></div><p>Creative template ID of the rendered reservation ad. Value is <code translate="no" dir="ltr">null</code> for empty slots, backfill ads, and creatives rendered by services other than <a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a>.</p></ul></section><section><hr/><h4 id="googletag.events.SlotRenderEndedEvent.isBackfill" data-text="isBackfill" tabindex="-1"><a id="googletag.events.SlotRenderEndedEvent_isBackfill"></a><span>isBackfill</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>isBackfill</span><span>:</span> <span>boolean</span></code></div><p>Whether an ad was a backfill ad. Value is <code translate="no" dir="ltr">true</code> if the ad was a backfill ad, <code translate="no" dir="ltr">false</code> otherwise.</p></ul></section><section><hr/><h4 id="googletag.events.SlotRenderEndedEvent.isEmpty" data-text="isEmpty" tabindex="-1"><a id="googletag.events.SlotRenderEndedEvent_isEmpty"></a><span>isEmpty</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>isEmpty</span><span>:</span> <span>boolean</span></code></div><p>Whether an ad was returned for the slot. Value is <code translate="no" dir="ltr">true</code> if no ad was returned, <code translate="no" dir="ltr">false</code> otherwise.</p></ul></section><section><hr/><h4 id="googletag.events.SlotRenderEndedEvent.labelIds" data-text="labelIds" tabindex="-1"><a id="googletag.events.SlotRenderEndedEvent_labelIds"></a><span>labelIds</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>labelIds</span><span>:</span> <span>null</span><span> | </span><span>number</span><span>[]</span></code></div><p></p><aside class="warning"><b>Deprecated:</b> This field is no longer populated.</aside></ul></section><section><hr/><h4 id="googletag.events.SlotRenderEndedEvent.lineItemId" data-text="lineItemId" tabindex="-1"><a id="googletag.events.SlotRenderEndedEvent_lineItemId"></a><span>lineItemId</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>lineItemId</span><span>:</span> <span>null</span><span> | </span><span>number</span></code></div><p>Line item ID of the rendered reservation ad. Value is <code translate="no" dir="ltr">null</code> for empty slots, backfill ads, and creatives rendered by services other than <a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a>.</p></ul></section><section><hr/><h4 id="googletag.events.SlotRenderEndedEvent.size" data-text="size" tabindex="-1"><a id="googletag.events.SlotRenderEndedEvent_size"></a><span>size</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>size</span><span>:</span> <span>null</span><span> | </span><span>string</span><span> | </span><span>number</span><span>[]</span></code></div><p>Indicates the pixel size of the rendered creative. Example: <code translate="no" dir="ltr">[728, 90]</code>. Value is <code translate="no" dir="ltr">null</code> for empty ad slots.</p></ul></section><section><hr/><h4 id="googletag.events.SlotRenderEndedEvent.slotContentChanged" data-text="slotContentChanged" tabindex="-1"><a id="googletag.events.SlotRenderEndedEvent_slotContentChanged"></a><span>slotContentChanged</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>slotContentChanged</span><span>:</span> <span>boolean</span></code></div><p>Whether the slot content was changed with the rendered ad. Value is <code translate="no" dir="ltr">true</code> if the content was changed, <code translate="no" dir="ltr">false</code> otherwise.</p></ul></section><section><hr/><h4 id="googletag.events.SlotRenderEndedEvent.sourceAgnosticCreativeId" data-text="sourceAgnosticCreativeId" tabindex="-1"><a id="googletag.events.SlotRenderEndedEvent_sourceAgnosticCreativeId"></a><span>sourceAgnosticCreativeId</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>sourceAgnosticCreativeId</span><span>:</span> <span>null</span><span> | </span><span>number</span></code></div><p>Creative ID of the rendered reservation or backfill ad. Value is <code translate="no" dir="ltr">null</code> if the ad is not a reservation or line item backfill, or the creative is rendered by services other than <a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a>.</p></ul></section><section><hr/><h4 id="googletag.events.SlotRenderEndedEvent.sourceAgnosticLineItemId" data-text="sourceAgnosticLineItemId" tabindex="-1"><a id="googletag.events.SlotRenderEndedEvent_sourceAgnosticLineItemId"></a><span>sourceAgnosticLineItemId</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>sourceAgnosticLineItemId</span><span>:</span> <span>null</span><span> | </span><span>number</span></code></div><p>Line item ID of the rendered reservation or backfill ad. Value is <code translate="no" dir="ltr">null</code> if the ad is not a reservation or line item backfill, or the creative is rendered by services other than <a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a>.</p></ul></section><section><hr/><h4 id="googletag.events.SlotRenderEndedEvent.yieldGroupIds" data-text="yieldGroupIds" tabindex="-1"><a id="googletag.events.SlotRenderEndedEvent_yieldGroupIds"></a><span>yieldGroupIds</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>yieldGroupIds</span><span>:</span> <span>null</span><span> | </span><span>number</span><span>[]</span></code></div><p>IDs of the yield groups for the rendered backfill ad. Value is <code translate="no" dir="ltr">null</code> for empty slots, reservation ads, and creatives rendered by services other than <a href="/publisher-tag/reference#googletag.PubAdsService">PubAdsService</a>.</p></ul></section></section></section><hr/><section><a id="googletag.events_SlotRequestedEvent"></a><h2 id="googletag.events.SlotRequestedEvent" data-text="googletag.events.SlotRequestedEvent" tabindex="-1">googletag.events.SlotRequestedEvent</h2><div style="padding-left: 20px; margin: -20px 0 16px 0;"><span class="material-icons" aria-hidden="true" translate="no">subdirectory_arrow_right</span>Extends <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event">Event</a></code></div><div>This event is fired when an ad has been requested for a particular slot.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName"><span>service<wbr/>Name<wbr/></span><span></span></a></code></td><td><div>Name of the service that triggered the event.<h6 class="no-link" id="inherited-from-event.servicename_8" data-text="Inherited from Event.serviceName" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName">Event.serviceName</a></code></h6></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot"><span>slot<wbr/></span><span></span></a></code></td><td><div>The slot that triggered the event.<h6 class="no-link" id="inherited-from-event.slot_8" data-text="Inherited from Event.slot" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot">Event.slot</a></code></h6></div></td></tr></table></section><section><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_67" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when the specified service issues an ad // request for a slot. Each slot will fire this event, even though they // may be batched together in a single request if single request // architecture (SRA) is enabled. const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;slotRequested&quot;, (event) =&gt; { const slot = event.slot; console.log(&quot;Slot&quot;, slot.getSlotElementId(), &quot;has been requested.&quot;); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="javascript-legacy_67" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when the specified service issues an ad // request for a slot. Each slot will fire this event, even though they // may be batched together in a single request if single request // architecture (SRA) is enabled. var targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;slotRequested&quot;, function (event) { var slot = event.slot; console.log(&quot;Slot&quot;, slot.getSlotElementId(), &quot;has been requested.&quot;); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="typescript_67" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when the specified service issues an ad // request for a slot. Each slot will fire this event, even though they // may be batched together in a single request if single request // architecture (SRA) is enabled. const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;slotRequested&quot;, (event) =&gt; { const slot = event.slot; console.log(&quot;Slot&quot;, slot.getSlotElementId(), &quot;has been requested.&quot;); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/samples/ad-event-listeners">Ad event listeners</a></li></ul></dd></dl></section></section><hr/><section><a id="googletag.events_SlotResponseReceived"></a><h2 id="googletag.events.SlotResponseReceived" data-text="googletag.events.SlotResponseReceived" tabindex="-1">googletag.events.SlotResponseReceived</h2><div style="padding-left: 20px; margin: -20px 0 16px 0;"><span class="material-icons" aria-hidden="true" translate="no">subdirectory_arrow_right</span>Extends <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event">Event</a></code></div><div>This event is fired when an ad response has been received for a particular slot.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName"><span>service<wbr/>Name<wbr/></span><span></span></a></code></td><td><div>Name of the service that triggered the event.<h6 class="no-link" id="inherited-from-event.servicename_9" data-text="Inherited from Event.serviceName" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName">Event.serviceName</a></code></h6></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot"><span>slot<wbr/></span><span></span></a></code></td><td><div>The slot that triggered the event.<h6 class="no-link" id="inherited-from-event.slot_9" data-text="Inherited from Event.slot" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot">Event.slot</a></code></h6></div></td></tr></table></section><section><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_68" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when an ad response has been received // for a slot. const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;slotResponseReceived&quot;, (event) =&gt; { const slot = event.slot; console.log(&quot;Ad response for slot&quot;, slot.getSlotElementId(), &quot;received.&quot;); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="javascript-legacy_68" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when an ad response has been received // for a slot. var targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;slotResponseReceived&quot;, function (event) { var slot = event.slot; console.log(&quot;Ad response for slot&quot;, slot.getSlotElementId(), &quot;received.&quot;); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="typescript_68" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called when an ad response has been received // for a slot. const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;slotResponseReceived&quot;, (event) =&gt; { const slot = event.slot; console.log(&quot;Ad response for slot&quot;, slot.getSlotElementId(), &quot;received.&quot;); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/samples/ad-event-listeners">Ad event listeners</a></li></ul></dd></dl></section></section><hr/><section><a id="googletag.events_SlotVisibilityChangedEvent"></a><h2 id="googletag.events.SlotVisibilityChangedEvent" data-text="googletag.events.SlotVisibilityChangedEvent" tabindex="-1">googletag.events.SlotVisibilityChangedEvent</h2><div style="padding-left: 20px; margin: -20px 0 16px 0;"><span class="material-icons" aria-hidden="true" translate="no">subdirectory_arrow_right</span>Extends <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event">Event</a></code></div><div>This event is fired whenever the on-screen percentage of an ad slot&#39;s area changes. The event is throttled and will not fire more often than once every 200ms.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.SlotVisibilityChangedEvent.inViewPercentage"><span>in<wbr/>View<wbr/>Percentage<wbr/></span><span></span></a></code></td><td><div>The percentage of the ad&#39;s area that is visible.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName"><span>service<wbr/>Name<wbr/></span><span></span></a></code></td><td><div>Name of the service that triggered the event.<h6 class="no-link" id="inherited-from-event.servicename_10" data-text="Inherited from Event.serviceName" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.serviceName">Event.serviceName</a></code></h6></div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot"><span>slot<wbr/></span><span></span></a></code></td><td><div>The slot that triggered the event.<h6 class="no-link" id="inherited-from-event.slot_10" data-text="Inherited from Event.slot" tabindex="-1">Inherited from <code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.events.Event.slot">Event.slot</a></code></h6></div></td></tr></table></section><section><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_69" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called whenever the on-screen percentage of an // ad slot&#39;s area changes. const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;slotVisibilityChanged&quot;, (event) =&gt; { const slot = event.slot; console.group(&quot;Visibility of slot&quot;, slot.getSlotElementId(), &quot;changed.&quot;); // Log details of the event. console.log(&quot;Visible area:&quot;, `${event.inViewPercentage}%`); console.groupEnd(); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="javascript-legacy_69" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called whenever the on-screen percentage of an // ad slot&#39;s area changes. var targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;slotVisibilityChanged&quot;, function (event) { var slot = event.slot; console.group(&quot;Visibility of slot&quot;, slot.getSlotElementId(), &quot;changed.&quot;); // Log details of the event. console.log(&quot;Visible area:&quot;, &quot;&quot;.concat(event.inViewPercentage, &quot;%&quot;)); console.groupEnd(); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section><section><h3 id="typescript_69" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// This listener is called whenever the on-screen percentage of an // ad slot&#39;s area changes. const targetSlot = googletag.defineSlot(&quot;/1234567/example&quot;, [160, 600]); googletag.pubads().addEventListener(&quot;slotVisibilityChanged&quot;, (event) =&gt; { const slot = event.slot; console.group(&quot;Visibility of slot&quot;, slot.getSlotElementId(), &quot;changed.&quot;); // Log details of the event. console.log(&quot;Visible area:&quot;, `${event.inViewPercentage}%`); console.groupEnd(); if (slot === targetSlot) { // Slot specific logic. } }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://developers.google.com/publisher-tag/samples/ad-event-listeners">Ad event listeners</a></li></ul></dd></dl></section><section><h3 class="hide-from-toc" id="googletag.events.SlotVisibilityChangedEvent_Properties" data-text="Properties" tabindex="-1">Properties</h3><section><hr/><h4 id="googletag.events.SlotVisibilityChangedEvent.inViewPercentage" data-text="inViewPercentage" tabindex="-1"><a id="googletag.events.SlotVisibilityChangedEvent_inViewPercentage"></a><span>inViewPercentage</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>inViewPercentage</span><span>:</span> <span>number</span></code></div><p>The percentage of the ad&#39;s area that is visible. Value is a number between 0 and 100.</p></ul></section></section></section></section><hr/><section><a id="googletag_secureSignals"></a><h2 id="googletag.secureSignals" data-text="googletag.secureSignals" tabindex="-1">googletag.secureSignals</h2><div>This is the namespace that GPT uses for managing secure signals.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Interfaces</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.secureSignals.BidderSignalProvider"><span>Bidder<wbr/>Signal<wbr/>Provider<wbr/></span><span></span></a></code></td><td><div>Returns a secure signal for a specific bidder.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.secureSignals.PublisherSignalProvider"><span>Publisher<wbr/>Signal<wbr/>Provider<wbr/></span><span></span></a></code></td><td><div>Returns a secure signal for a specific publisher.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.secureSignals.SecureSignalProvidersArray"><span>Secure<wbr/>Signal<wbr/>Providers<wbr/>Array<wbr/></span><span></span></a></code></td><td><div>An interface for managing secure signals.</div></td></tr></table><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Type Aliases</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.secureSignals.SecureSignalProvider"><span>Secure<wbr/>Signal<wbr/>Provider<wbr/></span><span></span></a></code></td><td><div>Interface for returning a secure signal for a specific bidder or provider.</div></td></tr></table></section><section></section><section><h3 class="hide-from-toc" id="googletag.secureSignals_Type Aliases" data-text="Type Aliases" tabindex="-1">Type Aliases</h3><section><hr/><h4 id="googletag.secureSignals.SecureSignalProvider" data-text="SecureSignalProvider" tabindex="-1"><a id="googletag.secureSignals_SecureSignalProvider"></a><span>SecureSignalProvider</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>SecureSignalProvider</span><span>:</span> <a href="/publisher-tag/reference#googletag.secureSignals.BidderSignalProvider">BidderSignalProvider</a><span> | </span><a href="/publisher-tag/reference#googletag.secureSignals.PublisherSignalProvider">PublisherSignalProvider</a></code></div><p>Interface for returning a secure signal for a specific bidder or provider. One of <code translate="no" dir="ltr">id</code> or <code translate="no" dir="ltr">networkCode</code> must be provided, but not both.</p></ul></section></section><hr/><section><a id="googletag.secureSignals_BidderSignalProvider"></a><h2 id="googletag.secureSignals.BidderSignalProvider" data-text="googletag.secureSignals.BidderSignalProvider" tabindex="-1">googletag.secureSignals.BidderSignalProvider</h2><div>Returns a secure signal for a specific bidder.<br><br>A bidder secure signal provider consists of 2 parts:<br><br><ol> <li>A collector function, which returns a <code translate="no" dir="ltr">Promise</code> that resolves to a secure signal.</li> <li>An <code translate="no" dir="ltr">id</code> which identifies the bidder associated with the signal.</li> </ol> To return a secure signal for a publisher, use <a href="/publisher-tag/reference#googletag.secureSignals.PublisherSignalProvider">secureSignals.PublisherSignalProvider</a> instead.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.secureSignals.BidderSignalProvider.collectorFunction"><span>collector<wbr/>Function<wbr/></span><span></span></a></code></td><td><div>A function which returns a <code translate="no" dir="ltr">Promise</code> that resolves to a secure signal.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.secureSignals.BidderSignalProvider.id"><span>id<wbr/></span><span></span></a></code></td><td><div>A unique identifier for the collector associated with this secure signal, as registered in Google Ad Manager.</div></td></tr></table></section><section><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_70" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// id is provided googletag.secureSignalProviders.push({ id: &quot;collector123&quot;, collectorFunction: () =&gt; { // ...custom signal generation logic... return Promise.resolve(&quot;signal&quot;); }, }); </pre></section><section><h3 id="javascript-legacy_70" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// id is provided googletag.secureSignalProviders.push({ id: &quot;collector123&quot;, collectorFunction: function () { // ...custom signal generation logic... return Promise.resolve(&quot;signal&quot;); }, }); </pre></section><section><h3 id="typescript_70" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// id is provided googletag.secureSignalProviders!.push({ id: &quot;collector123&quot;, collectorFunction: () =&gt; { // ...custom signal generation logic... return Promise.resolve(&quot;signal&quot;); }, }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://support.google.com/admanager/answer/10488752">Share secure signals with bidders</a></li></ul></dd></dl></section><section><h3 class="hide-from-toc" id="googletag.secureSignals.BidderSignalProvider_Properties" data-text="Properties" tabindex="-1">Properties</h3><section><hr/><h4 id="googletag.secureSignals.BidderSignalProvider.collectorFunction" data-text="collectorFunction" tabindex="-1"><a id="googletag.secureSignals.BidderSignalProvider_collectorFunction"></a><span>collectorFunction</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>collectorFunction</span><span>:</span> <span>(</span><span>(</span><span>)</span><span> =&gt; </span><span>Promise</span><span>&lt;</span><span>string</span><span>&gt;</span><span>)</span></code></div><p>A function which returns a <code translate="no" dir="ltr">Promise</code> that resolves to a secure signal.</p></ul></section><section><hr/><h4 id="googletag.secureSignals.BidderSignalProvider.id" data-text="id" tabindex="-1"><a id="googletag.secureSignals.BidderSignalProvider_id"></a><span>id</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>id</span><span>:</span> <span>string</span></code></div><p>A unique identifier for the collector associated with this secure signal, as registered in Google Ad Manager.</p></ul></section></section></section><hr/><section><a id="googletag.secureSignals_PublisherSignalProvider"></a><h2 id="googletag.secureSignals.PublisherSignalProvider" data-text="googletag.secureSignals.PublisherSignalProvider" tabindex="-1">googletag.secureSignals.PublisherSignalProvider</h2><div>Returns a secure signal for a specific publisher.<br><br>A publisher signal provider consists of 2 parts:<br><br><ol> <li>A collector function, which returns a <code translate="no" dir="ltr">Promise</code> that resolves to a secure signal.</li> <li>A <code translate="no" dir="ltr">networkCode</code> which identifies the publisher associated with the signal.</li> </ol> To return a secure signal for a bidder, use <a href="/publisher-tag/reference#googletag.secureSignals.BidderSignalProvider">secureSignals.BidderSignalProvider</a> instead.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Properties</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.secureSignals.PublisherSignalProvider.collectorFunction"><span>collector<wbr/>Function<wbr/></span><span></span></a></code></td><td><div>A function which returns a <code translate="no" dir="ltr">Promise</code> that resolves to a secure signal.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.secureSignals.PublisherSignalProvider.networkCode"><span>network<wbr/>Code<wbr/></span><span></span></a></code></td><td><div>The network code (as seen in the ad unit path) for the publisher associated with this secure signal.</div></td></tr></table></section><section><dl><dt>Example</dt><dd style="margin: 0; padding: 0;"><devsite-selector><section><h3 id="javascript_71" data-text="JavaScript" tabindex="-1">JavaScript</h3><pre class="prettyprint" translate="no" dir="ltr">// networkCode is provided googletag.secureSignalProviders.push({ networkCode: &quot;123456&quot;, collectorFunction: () =&gt; { // ...custom signal generation logic... return Promise.resolve(&quot;signal&quot;); }, }); </pre></section><section><h3 id="javascript-legacy_71" data-text="JavaScript (legacy)" tabindex="-1">JavaScript (legacy)</h3><pre class="prettyprint" translate="no" dir="ltr">// networkCode is provided googletag.secureSignalProviders.push({ networkCode: &quot;123456&quot;, collectorFunction: function () { // ...custom signal generation logic... return Promise.resolve(&quot;signal&quot;); }, }); </pre></section><section><h3 id="typescript_71" data-text="TypeScript" tabindex="-1">TypeScript</h3><pre class="prettyprint" translate="no" dir="ltr">// networkCode is provided googletag.secureSignalProviders!.push({ networkCode: &quot;123456&quot;, collectorFunction: () =&gt; { // ...custom signal generation logic... return Promise.resolve(&quot;signal&quot;); }, }); </pre></section></devsite-selector></dd></dl><dl><dt>See also</dt><dd style="margin: 0; padding: 0;"><ul><li><a href="https://support.google.com/admanager/answer/10488752">Share secure signals with bidders</a></li></ul></dd></dl></section><section><h3 class="hide-from-toc" id="googletag.secureSignals.PublisherSignalProvider_Properties" data-text="Properties" tabindex="-1">Properties</h3><section><hr/><h4 id="googletag.secureSignals.PublisherSignalProvider.collectorFunction" data-text="collectorFunction" tabindex="-1"><a id="googletag.secureSignals.PublisherSignalProvider_collectorFunction"></a><span>collectorFunction</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>collectorFunction</span><span>:</span> <span>(</span><span>(</span><span>)</span><span> =&gt; </span><span>Promise</span><span>&lt;</span><span>string</span><span>&gt;</span><span>)</span></code></div><p>A function which returns a <code translate="no" dir="ltr">Promise</code> that resolves to a secure signal.</p></ul></section><section><hr/><h4 id="googletag.secureSignals.PublisherSignalProvider.networkCode" data-text="networkCode" tabindex="-1"><a id="googletag.secureSignals.PublisherSignalProvider_networkCode"></a><span>networkCode</span></h4><ul style="list-style: none;"><div><code translate="no" dir="ltr"><span>networkCode</span><span>:</span> <span>string</span></code></div><p>The network code (as seen in the ad unit path) for the publisher associated with this secure signal.</p></ul></section></section></section><hr/><section><a id="googletag.secureSignals_SecureSignalProvidersArray"></a><h2 id="googletag.secureSignals.SecureSignalProvidersArray" data-text="googletag.secureSignals.SecureSignalProvidersArray" tabindex="-1">googletag.secureSignals.SecureSignalProvidersArray</h2><div>An interface for managing secure signals.</div><section><table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Methods</th></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.secureSignals.SecureSignalProvidersArray.clearAllCache"><span>clear<wbr/>All<wbr/>Cache<wbr/></span><span></span></a></code></td><td><div>Clears all signals for all collectors from cache.</div></td></tr><tr><td><code translate="no" dir="ltr"><a href="/publisher-tag/reference#googletag.secureSignals.SecureSignalProvidersArray.push"><span>push<wbr/></span><span></span></a></code></td><td><div>Adds a new <a href="/publisher-tag/reference#googletag.secureSignals.SecureSignalProvider">secureSignals.SecureSignalProvider</a> to the signal provider array and begins the signal generation process.</div></td></tr></table></section><section></section><section><h3 class="hide-from-toc" id="googletag.secureSignals.SecureSignalProvidersArray_Methods" data-text="Methods" tabindex="-1">Methods</h3><section><hr/><h4 id="googletag.secureSignals.SecureSignalProvidersArray.clearAllCache" data-text="clearAllCache" tabindex="-1"><a id="googletag.secureSignals.SecureSignalProvidersArray_clearAllCache"></a><span>clearAllCache</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>clearAllCache</span><span>(</span><span>)</span><span>: </span><span>void</span></code><p>Clears all signals for all collectors from cache.<br><br>Calling this method may reduce the likelihood of signals being included in ad requests for the current and potentially later page views. Due to this, it should only be called when meaningful state changes occur, such as events that indicate a new user (log in, log out, sign up, etc.).</p></ul></section><section><hr/><h4 id="googletag.secureSignals.SecureSignalProvidersArray.push" data-text="push" tabindex="-1"><a id="googletag.secureSignals.SecureSignalProvidersArray_push"></a><span>push</span></h4><ul style="list-style: none;"><code translate="no" dir="ltr"><a></a><span>push</span><span>(</span><span>provider</span><span>: </span><a href="/publisher-tag/reference#googletag.secureSignals.SecureSignalProvider">SecureSignalProvider</a><span>)</span><span>: </span><span>void</span></code><p>Adds a new <a href="/publisher-tag/reference#googletag.secureSignals.SecureSignalProvider">secureSignals.SecureSignalProvider</a> to the signal provider array and begins the signal generation process.<table class="properties responsive fixed"><colgroup><col style="width: 33%"/><col/></colgroup><tr><th colSpan="2">Parameters</th></tr><tr><td><code translate="no" dir="ltr"><span>provider</span>: <a href="/publisher-tag/reference#googletag.secureSignals.SecureSignalProvider">SecureSignalProvider</a></code></td><td>The <a href="/publisher-tag/reference#googletag.secureSignals.SecureSignalProvider">secureSignals.SecureSignalProvider</a> object to be added to the array.</td></tr></table></p></ul></section></section></section></section></section> <devsite-hats-survey class="nocontent" hats-id="zs8vVTo60LHkahqinNfT0W3st7sv" listnr-id="82128"></devsite-hats-survey> </div> <devsite-thumb-rating position="footer"> </devsite-thumb-rating> <devsite-feedback position="footer" project-name="Google Publisher Tag" product-id="102150" bucket="" context="" version="t-devsite-webserver-20241114-r00-rc02.464922260396498922" data-label="Send Feedback Button" track-type="feedback" track-name="sendFeedbackLink" track-metadata-position="footer" class="nocontent" project-feedback-url="https://support.google.com/admanager" project-icon="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/developers/images/touchicon-180-new.png" > <button> Send feedback </button> </devsite-feedback> <div class="devsite-floating-action-buttons"> </div> </article> <devsite-content-footer class="nocontent"> <p>Except as otherwise noted, the content of this page is licensed under the <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 License</a>, and code samples are licensed under the <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache 2.0 License</a>. For details, see the <a href="https://developers.google.com/site-policies">Google Developers Site Policies</a>. Java is a registered trademark of Oracle and/or its affiliates.</p> <p>Last updated 2024-11-08 UTC.</p> </devsite-content-footer> <devsite-notification > </devsite-notification> <div class="devsite-content-data"> <template class="devsite-thumb-rating-feedback"> <devsite-feedback position="thumb-rating" project-name="Google Publisher Tag" product-id="102150" bucket="" context="" version="t-devsite-webserver-20241114-r00-rc02.464922260396498922" data-label="Send Feedback Button" track-type="feedback" track-name="sendFeedbackLink" track-metadata-position="thumb-rating" class="nocontent" project-feedback-url="https://support.google.com/admanager" project-icon="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/developers/images/touchicon-180-new.png" > <button> Need to tell us more? </button> </devsite-feedback> </template> <template class="devsite-content-data-template"> [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-08 UTC."],[],[]] </template> </div> </devsite-content> </main> <devsite-footer-promos class="devsite-footer"> </devsite-footer-promos> <devsite-footer-linkboxes class="devsite-footer"> <nav class="devsite-footer-linkboxes nocontent" aria-label="Footer links"> <ul class="devsite-footer-linkboxes-list"> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Connect</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="//googledevelopers.blogspot.com" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" > Blog </a> </li> <li class="devsite-footer-linkbox-item"> <a href="https://www.instagram.com/googlefordevs/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" > Instagram </a> </li> <li class="devsite-footer-linkbox-item"> <a href="https://www.linkedin.com/showcase/googledevelopers/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" > LinkedIn </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//twitter.com/googledevs" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" > X (Twitter) </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//www.youtube.com/user/GoogleDevelopers" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" > YouTube </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Programs</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="//www.womentechmakers.com" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" > Women Techmakers </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/community/gdg" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" > Google Developer Groups </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/community/experts" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" > Google Developer Experts </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/community/accelerators" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" > Accelerators </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/community/gdsc" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" > Google Developer Student Clubs </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Developer consoles</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="//console.developers.google.com" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" > Google API Console </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//console.cloud.google.com" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" > Google Cloud Platform Console </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//play.google.com/apps/publish" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" > Google Play Console </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//console.firebase.google.com" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" > Firebase Console </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//console.actions.google.com" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" > Actions on Google Console </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//cast.google.com/publish" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 6)" > Cast SDK Developer Console </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//chrome.google.com/webstore/developer/dashboard" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 7)" > Chrome Web Store Dashboard </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//console.home.google.com" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 8)" > Google Home Developer Console </a> </li> </ul> </li> </ul> </nav> </devsite-footer-linkboxes> <devsite-footer-utility class="devsite-footer"> <div class="devsite-footer-utility nocontent"> <nav class="devsite-footer-sites" aria-label="Other Google Developers websites"> <a href="https://developers.google.com/" class="devsite-footer-sites-logo-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Google Developers Link"> <picture> <img class="devsite-footer-sites-logo" src="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/developers/images/lockup-google-for-developers.svg" loading="lazy" alt="Google Developers"> </picture> </a> <ul class="devsite-footer-sites-list"> <li class="devsite-footer-sites-item"> <a href="//developer.android.com" class="devsite-footer-sites-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Android Link" > Android </a> </li> <li class="devsite-footer-sites-item"> <a href="//developer.chrome.com/home" class="devsite-footer-sites-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Chrome Link" > Chrome </a> </li> <li class="devsite-footer-sites-item"> <a href="//firebase.google.com" class="devsite-footer-sites-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Firebase Link" > Firebase </a> </li> <li class="devsite-footer-sites-item"> <a href="//cloud.google.com" class="devsite-footer-sites-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Google Cloud Platform Link" > Google Cloud Platform </a> </li> <li class="devsite-footer-sites-item"> <a href="//ai.google.dev/" class="devsite-footer-sites-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Google AI Link" > Google AI </a> </li> <li class="devsite-footer-sites-item"> <a href="/products" class="devsite-footer-sites-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer All products Link" > All products </a> </li> </ul> </nav> <nav class="devsite-footer-utility-links" aria-label="Utility links"> <ul class="devsite-footer-utility-list"> <li class="devsite-footer-utility-item "> <a class="devsite-footer-utility-link gc-analytics-event" href="/terms/site-terms" data-category="Site-Wide Custom Events" data-label="Footer Terms link" > Terms </a> </li> <li class="devsite-footer-utility-item "> <a class="devsite-footer-utility-link gc-analytics-event" href="//policies.google.com/privacy" data-category="Site-Wide Custom Events" data-label="Footer Privacy link" > Privacy </a> </li> <li class="devsite-footer-utility-item glue-cookie-notification-bar-control"> <a class="devsite-footer-utility-link gc-analytics-event" href="#" data-category="Site-Wide Custom Events" data-label="Footer Manage cookies link" aria-hidden="true" > Manage cookies </a> </li> <li class="devsite-footer-utility-item devsite-footer-utility-button"> <span class="devsite-footer-utility-description">Sign up for the Google for Developers newsletter</span> <a class="devsite-footer-utility-link gc-analytics-event" href="/newsletter/subscribe" data-category="Site-Wide Custom Events" data-label="Footer Subscribe link" > Subscribe </a> </li> </ul> <devsite-language-selector> <ul role="presentation"> <li role="presentation"> <a role="menuitem" lang="en" >English</a> </li> <li role="presentation"> <a role="menuitem" lang="de" >Deutsch</a> </li> <li role="presentation"> <a role="menuitem" lang="es" >Español</a> </li> <li role="presentation"> <a role="menuitem" lang="es_419" >Español – América Latina</a> </li> <li role="presentation"> <a role="menuitem" lang="fr" >Français</a> </li> <li role="presentation"> <a role="menuitem" lang="id" >Indonesia</a> </li> <li role="presentation"> <a role="menuitem" lang="it" >Italiano</a> </li> <li role="presentation"> <a role="menuitem" lang="pl" >Polski</a> </li> <li role="presentation"> <a role="menuitem" lang="pt_br" >Português – Brasil</a> </li> <li role="presentation"> <a role="menuitem" lang="vi" >Tiếng Việt</a> </li> <li role="presentation"> <a role="menuitem" lang="tr" >Türkçe</a> </li> <li role="presentation"> <a role="menuitem" lang="ru" >Русский</a> </li> <li role="presentation"> <a role="menuitem" lang="he" >עברית</a> </li> <li role="presentation"> <a role="menuitem" lang="ar" >العربيّة</a> </li> <li role="presentation"> <a role="menuitem" lang="fa" >فارسی</a> </li> <li role="presentation"> <a role="menuitem" lang="hi" >हिंदी</a> </li> <li role="presentation"> <a role="menuitem" lang="bn" >বাংলা</a> </li> <li role="presentation"> <a role="menuitem" lang="th" >ภาษาไทย</a> </li> <li role="presentation"> <a role="menuitem" lang="zh_cn" >中文 – 简体</a> </li> <li role="presentation"> <a role="menuitem" lang="zh_tw" >中文 – 繁體</a> </li> <li role="presentation"> <a role="menuitem" lang="ja" >日本語</a> </li> <li role="presentation"> <a role="menuitem" lang="ko" >한국어</a> </li> </ul> </devsite-language-selector> </nav> </div> </devsite-footer-utility> <devsite-panel></devsite-panel> <devsite-concierge data-info-panel data-ai-panel data-api-explorer-panel > </devsite-concierge> </section></section> <devsite-sitemask></devsite-sitemask> <devsite-snackbar></devsite-snackbar> <devsite-tooltip ></devsite-tooltip> <devsite-heading-link></devsite-heading-link> <devsite-analytics> <script type="application/json" analytics>[{&#34;dimensions&#34;: {&#34;dimension1&#34;: &#34;Signed out&#34;, &#34;dimension11&#34;: false, &#34;dimension3&#34;: false, &#34;dimension6&#34;: &#34;en&#34;, &#34;dimension5&#34;: &#34;en&#34;, &#34;dimension4&#34;: &#34;Google Publisher Tag&#34;}, &#34;gaid&#34;: &#34;UA-24532603-1&#34;, &#34;metrics&#34;: {&#34;ratings_count&#34;: &#34;metric2&#34;, &#34;ratings_value&#34;: &#34;metric1&#34;}, &#34;purpose&#34;: 1}]</script> <script type="application/json" tag-management>{&#34;at&#34;: &#34;True&#34;, &#34;ga4&#34;: [{&#34;id&#34;: &#34;G-272J68FCRF&#34;, &#34;purpose&#34;: 1}, {&#34;id&#34;: &#34;G-G8JQNMMJTK&#34;, &#34;purpose&#34;: 0}], &#34;ga4p&#34;: [{&#34;id&#34;: &#34;G-272J68FCRF&#34;, &#34;purpose&#34;: 1}], &#34;gtm&#34;: [], &#34;parameters&#34;: {&#34;internalUser&#34;: &#34;False&#34;, &#34;language&#34;: {&#34;machineTranslated&#34;: &#34;False&#34;, &#34;requested&#34;: &#34;en&#34;, &#34;served&#34;: &#34;en&#34;}, &#34;pageType&#34;: &#34;article&#34;, &#34;projectName&#34;: &#34;Google Publisher Tag&#34;, &#34;signedIn&#34;: &#34;False&#34;, &#34;tenant&#34;: &#34;developers&#34;, &#34;recommendations&#34;: {&#34;sourcePage&#34;: &#34;&#34;, &#34;sourceType&#34;: 0, &#34;sourceRank&#34;: 0, &#34;sourceIdenticalDescriptions&#34;: 0, &#34;sourceTitleWords&#34;: 0, &#34;sourceDescriptionWords&#34;: 0, &#34;experiment&#34;: &#34;&#34;}, &#34;experiment&#34;: {&#34;ids&#34;: &#34;&#34;}}}</script> </devsite-analytics> <devsite-badger></devsite-badger> <script nonce="ENtMaITdEdi+vP302vRraLkSBba1n9"> (function(d,e,v,s,i,t,E){d['GoogleDevelopersObject']=i; t=e.createElement(v);t.async=1;t.src=s;E=e.getElementsByTagName(v)[0]; E.parentNode.insertBefore(t,E);})(window, document, 'script', 'https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/developers/js/app_loader.js', '[1,"en",null,"/js/devsite_app_module.js","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/developers","https://developers-dot-devsite-v2-prod.appspot.com",1,null,["/_pwa/developers/manifest.json","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/images/video-placeholder.svg","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/developers/images/favicon-new.png","https://fonts.googleapis.com/css?family=Google+Sans:400,500|Roboto:400,400italic,500,500italic,700,700italic|Roboto+Mono:400,500,700&display=swap"],1,null,[1,6,8,12,14,17,21,25,50,52,63,70,75,76,80,87,91,92,93,97,98,100,101,102,103,104,105,107,108,109,110,112,113,116,117,118,120,122,124,125,126,127,129,130,131,132,133,134,135,136,138,140,141,147,148,149,151,152,156,157,158,159,161,163,164,168,169,170,179,180,182,183,186,191,193,196],"AIzaSyAP-jjEJBzmIyKR4F-3XITp8yM9T1gEEI8","AIzaSyB6xiKGDR5O3Ak2okS4rLkauxGUG7XP0hg","developers.google.com","AIzaSyAQk0fBONSGUqCNznf6Krs82Ap1-NV6J4o","AIzaSyCCxcqdrZ_7QMeLCRY20bh_SXdAYqy70KY",null,null,null,["Cloud__enable_cloud_dlp_service","MiscFeatureFlags__developers_footer_dark_image","Cloud__enable_cloud_facet_chat","Profiles__enable_recognition_badges","Cloud__enable_llm_concierge_chat","MiscFeatureFlags__enable_view_transitions","Search__enable_ai_search_summaries_restricted","Profiles__enable_completecodelab_endpoint","TpcFeatures__enable_required_headers","MiscFeatureFlags__enable_variable_operator","Cloud__enable_free_trial_server_call","DevPro__enable_developer_subscriptions","Cloud__enable_cloudx_experiment_ids","MiscFeatureFlags__enable_firebase_utm","Significatio__enable_by_tenant","Cloud__enable_legacy_calculator_redirect","Profiles__enable_dashboard_curated_recommendations","Cloud__enable_cloud_shell_fte_user_flow","Search__enable_ai_eligibility_checks","CloudShell__cloud_code_overflow_menu","Profiles__enable_page_saving","Concierge__enable_concierge","BookNav__enable_tenant_cache_key","Profiles__enable_release_notes_notifications","MiscFeatureFlags__emergency_css","Concierge__enable_pushui","MiscFeatureFlags__developers_footer_image","Search__enable_ai_search_summaries","Profiles__enable_public_developer_profiles","MiscFeatureFlags__enable_project_variables","Profiles__enable_profile_collections","MiscFeatureFlags__enable_explain_this_code","Profiles__enable_developer_profiles_callout","Cloud__enable_cloud_shell","Search__enable_page_map","Search__enable_suggestions_from_borg","TpcFeatures__enable_mirror_tenant_redirects","Search__enable_dynamic_content_confidential_banner","Profiles__require_profile_eligibility_for_signin","Concierge__enable_concierge_restricted","CloudShell__cloud_shell_button","Experiments__reqs_query_experiments","DevPro__enable_cloud_innovators_plus","Profiles__enable_awarding_url","Analytics__enable_clearcut_logging","Cloud__enable_cloudx_ping","Profiles__enable_complete_playlist_endpoint","EngEduTelemetry__enable_engedu_telemetry"],null,null,"AIzaSyBLEMok-5suZ67qRPzx0qUtbnLmyT_kCVE","https://developerscontentserving-pa.clients6.google.com","AIzaSyCM4QpTRSqP5qI4Dvjt4OAScIN8sOUlO-k","https://developerscontentsearch-pa.clients6.google.com",1,4,null,"https://developerprofiles-pa.clients6.google.com",[1,"developers","Google for Developers","developers.google.com",null,"developers-dot-devsite-v2-prod.appspot.com",null,null,[1,1,[1],null,null,null,null,null,null,null,null,[1],null,null,null,null,null,null,[1],[1,null,null,[1,20],"/recommendations/information"],null,null,null,[1,1,1],[1,1,null,1,1]],null,[null,null,null,null,null,null,"/images/lockup-new.svg","/images/touchicon-180-new.png",null,null,null,null,1,null,null,null,null,null,null,null,null,1,null,null,null,"/images/lockup-dark-theme-new.svg",[]],[],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[6,1,14,15,20,22,23,29,32,36],null,[[null,null,null,[3,7,10,2,39,17,4,32,24,11,12,13,34,15,25],null,null,[1,[["docType","Choose a content type",[["Tutorial",null,null,null,null,null,null,null,null,"Tutorial"],["Guide",null,null,null,null,null,null,null,null,"Guide"],["Sample",null,null,null,null,null,null,null,null,"Sample"]]],["product","Choose a product",[["Android",null,null,null,null,null,null,null,null,"Android"],["ARCore",null,null,null,null,null,null,null,null,"ARCore"],["ChromeOS",null,null,null,null,null,null,null,null,"ChromeOS"],["Firebase",null,null,null,null,null,null,null,null,"Firebase"],["Flutter",null,null,null,null,null,null,null,null,"Flutter"],["Assistant",null,null,null,null,null,null,null,null,"Google Assistant"],["GoogleCloud",null,null,null,null,null,null,null,null,"Google Cloud"],["GoogleMapsPlatform",null,null,null,null,null,null,null,null,"Google Maps Platform"],["GooglePay",null,null,null,null,null,null,null,null,"Google Pay & Google Wallet"],["GooglePlay",null,null,null,null,null,null,null,null,"Google Play"],["Tensorflow",null,null,null,null,null,null,null,null,"TensorFlow"]]],["category","Choose a topic",[["AiAndMachineLearning",null,null,null,null,null,null,null,null,"AI and Machine Learning"],["Data",null,null,null,null,null,null,null,null,"Data"],["Enterprise",null,null,null,null,null,null,null,null,"Enterprise"],["Gaming",null,null,null,null,null,null,null,null,"Gaming"],["Mobile",null,null,null,null,null,null,null,null,"Mobile"],["Web",null,null,null,null,null,null,null,null,"Web"]]]]]],[1,1],null,1],[[["UA-24532603-1"],["UA-22084204-5"],null,null,["UA-24532603-5"],null,null,[["G-272J68FCRF"],null,null,[["G-272J68FCRF",2]]],[["UA-24532603-1",2]],null,[["UA-24532603-5",2]],null,1],[[11,8],[14,11],[15,12],[4,3],[5,4],[1,1],[12,9],[13,10],[16,13],[6,5],[3,2]],[[2,2],[1,1]]],null,4,null,null,null,null,null,null,null,null,null,null,null,null,null,"developers.devsite.google"],null,"pk_live_5170syrHvgGVmSx9sBrnWtA5luvk9BwnVcvIi7HizpwauFG96WedXsuXh790rtij9AmGllqPtMLfhe2RSwD6Pn38V00uBCydV4m"]') </script> <devsite-a11y-announce></devsite-a11y-announce> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10