From f6d3c0d99cd2db627890559385531f2f7ee2f963 Mon Sep 17 00:00:00 2001 From: Florian Hase <72435707+HaseFlrn@users.noreply.github.com> Date: Thu, 28 May 2026 13:08:58 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#75028=20[selen?= =?UTF-8?q?ium-webdriver]=20fix=20getAttribute=20return=20type=20to=20Prom?= =?UTF-8?q?ise=20by=20@HaseFlrn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/selenium-webdriver/index.d.ts | 4 ++-- types/selenium-webdriver/test/index.ts | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/types/selenium-webdriver/index.d.ts b/types/selenium-webdriver/index.d.ts index d3916ac767910b..607f8e5dcd9c71 100644 --- a/types/selenium-webdriver/index.d.ts +++ b/types/selenium-webdriver/index.d.ts @@ -1169,7 +1169,7 @@ export interface IWebElement { * @return {!Promise} A promise that will be resolved with the * attribute's value. */ - getAttribute(attributeName: string): Promise; + getAttribute(attributeName: string): Promise; /** * Get the visible (i.e. not hidden by CSS) innerText of this element, @@ -1564,7 +1564,7 @@ export class WebElement implements Serializable { * resolved with the attribute's value. The returned value will always be * either a string or null. */ - getAttribute(attributeName: string): Promise; + getAttribute(attributeName: string): Promise; /** * Get the visible (i.e. not hidden by CSS) innerText of this element, diff --git a/types/selenium-webdriver/test/index.ts b/types/selenium-webdriver/test/index.ts index 225168813d6af2..ddfb9e3923aaaf 100644 --- a/types/selenium-webdriver/test/index.ts +++ b/types/selenium-webdriver/test/index.ts @@ -513,7 +513,12 @@ function TestWebElement() { element = element.findElement({ id: "ABC" }); element.findElements({ className: "ABC" }).then((elements: webdriver.WebElement[]) => {}); - stringPromise = element.getAttribute("class"); + const maybeAttr: Promise = element.getAttribute("class"); + maybeAttr.then(v => { + if (v !== null) { + v.toUpperCase(); + } + }); stringPromise = element.getCssValue("display"); driver = element.getDriver(); element.getLocation().then((location: webdriver.ILocation) => {}); From 5bb8fd5fab059db4dde28dc89cb48e546e816187 Mon Sep 17 00:00:00 2001 From: Google Publisher Tag Bot Date: Thu, 28 May 2026 22:31:32 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#75055=20Sync?= =?UTF-8?q?=20latest=20changes=20to=20@types/google-publisher-tag=20by=20@?= =?UTF-8?q?google-publisher-tag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: jimper --- .../google-publisher-tag-tests.ts | 292 ++++++++++++----- types/google-publisher-tag/index.d.ts | 298 +++++++++++++----- types/google-publisher-tag/package.json | 18 +- 3 files changed, 434 insertions(+), 174 deletions(-) diff --git a/types/google-publisher-tag/google-publisher-tag-tests.ts b/types/google-publisher-tag/google-publisher-tag-tests.ts index fc4f3ebd53b712..76b2ac809f1863 100644 --- a/types/google-publisher-tag/google-publisher-tag-tests.ts +++ b/types/google-publisher-tag/google-publisher-tag-tests.ts @@ -1,5 +1,5 @@ -// Tests for Google Publisher Tag 1.20260518 -// Synced from: https://github.com/googleads/google-publisher-tag-types/commit/26b00c99eb377e0e93b1510a795f2e647d91d8e5 +// Tests for Google Publisher Tag 1.20260525 +// Synced from: https://github.com/googleads/google-publisher-tag-types/commit/3a5fc88b30b26709f89e5dc6f8f1bb725322c2b6 // Test for googletag.cmd function test_googletag_cmd() { @@ -139,61 +139,97 @@ function test_googletag_privacySettingsConfig_tagForAgeTreatment() { // Test for googletag.PubAdsService.setTargeting function test_googletag_pubAdsService_setTargeting() { // Example with a single value for a key. - googletag.pubads().setTargeting("interests", "sports"); + googletag.setConfig({ + targeting: { + interests: "sports", + }, + }); // Example with multiple values for a key inside in an array. - googletag.pubads().setTargeting("interests", ["sports", "music"]); + googletag.setConfig({ + targeting: { + interests: ["sports", "music"], + }, + }); } // Test for googletag.PubAdsService.clearTargeting function test_googletag_pubAdsService_clearTargeting() { - googletag.pubads().setTargeting("interests", "sports"); - googletag.pubads().setTargeting("colors", "blue"); - googletag.pubads().setTargeting("fruits", "apple"); + googletag.setConfig({ + targeting: { + interests: "sports", + colors: "blue", + fruits: "apple", + }, + }); - googletag.pubads().clearTargeting("interests"); + googletag.setConfig({ + targeting: { + interests: null, + }, + }); // Targeting 'colors' and 'fruits' are still present, while 'interests' // was cleared. - googletag.pubads().clearTargeting(); + googletag.setConfig({ + targeting: null, + }); // All targeting has been cleared. } // Test for googletag.PubAdsService.getTargeting function test_googletag_pubAdsService_getTargeting() { - googletag.pubads().setTargeting("interests", "sports"); + googletag.setConfig({ + targeting: { + interests: "sports", + }, + }); + + const targetingConfig = googletag.getConfig("targeting").targeting; - googletag.pubads().getTargeting("interests"); + // Get targeting for a specific key. + const targeting = targetingConfig?.["interests"] || []; // Returns ['sports']. - googletag.pubads().getTargeting("age"); + const ageTargeting = targetingConfig?.["age"] || []; // Returns [] (empty array). } // Test for googletag.PubAdsService.getTargetingKeys function test_googletag_pubAdsService_getTargetingKeys() { - googletag.pubads().setTargeting("interests", "sports"); - googletag.pubads().setTargeting("colors", "blue"); + googletag.setConfig({ + targeting: { + interests: "sports", + colors: "blue", + }, + }); - googletag.pubads().getTargetingKeys(); + const targetingConfig = googletag.getConfig("targeting").targeting; + const keys = Object.keys(targetingConfig || {}); // Returns ['interests', 'colors']. } // Test for googletag.PubAdsService.setCategoryExclusion function test_googletag_pubAdsService_setCategoryExclusion() { // Label = AirlineAd. - googletag.pubads().setCategoryExclusion("AirlineAd"); + googletag.setConfig({ + categoryExclusion: ["AirlineAd"], + }); } // Test for googletag.PubAdsService.clearCategoryExclusions function test_googletag_pubAdsService_clearCategoryExclusions() { // Set category exclusion to exclude ads with 'AirlineAd' labels. - googletag.pubads().setCategoryExclusion("AirlineAd"); + googletag.setConfig({ + categoryExclusion: ["AirlineAd"], + }); // Make ad requests. No ad with 'AirlineAd' label will be returned. // Clear category exclusions so all ads can be returned. - googletag.pubads().clearCategoryExclusions(); + googletag.setConfig({ + categoryExclusion: null, + }); // Make ad requests. Any ad can be returned. } @@ -201,7 +237,9 @@ function test_googletag_pubAdsService_clearCategoryExclusions() { // Test for googletag.PubAdsService.setCentering function test_googletag_pubAdsService_setCentering() { // Make ads centered. - googletag.pubads().setCentering(true); + googletag.setConfig({ + centering: true, + }); } // Test for googletag.PubAdsService.refresh @@ -249,7 +287,9 @@ function test_googletag_pubAdsService_clear() { // Test for googletag.PubAdsService.setLocation function test_googletag_pubAdsService_setLocation() { // Postal code: - googletag.pubads().setLocation("10001,US"); + googletag.setConfig({ + location: "10001,US", + }); } // Test for googletag.PubAdsService.setPublisherProvidedId @@ -259,22 +299,38 @@ function test_googletag_pubAdsService_setPublisherProvidedId() { // Test for googletag.PubAdsService.set function test_googletag_pubAdsService_set() { - googletag.pubads().set("adsense_background_color", "#FFFFFF"); + googletag.setConfig({ + adsenseAttributes: { + page_url: "http://www.example.com", + }, + }); } // Test for googletag.PubAdsService.get function test_googletag_pubAdsService_get() { - googletag.pubads().set("adsense_background_color", "#FFFFFF"); - googletag.pubads().get("adsense_background_color"); - // Returns '#FFFFFF'. + googletag.setConfig({ + adsenseAttributes: { + page_url: "http://www.example.com", + }, + }); + + const adsenseConfig = googletag.getConfig("adsenseAttributes").adsenseAttributes; + const pageUrl = adsenseConfig?.page_url || null; + // Returns 'http://www.example.com'. } // Test for googletag.PubAdsService.getAttributeKeys function test_googletag_pubAdsService_getAttributeKeys() { - googletag.pubads().set("adsense_background_color", "#FFFFFF"); - googletag.pubads().set("adsense_border_color", "#AABBCC"); - googletag.pubads().getAttributeKeys(); - // Returns ['adsense_background_color', 'adsense_border_color']. + googletag.setConfig({ + adsenseAttributes: { + page_url: "http://www.example.com", + document_language: "en", + }, + }); + + const adsenseConfig = googletag.getConfig("adsenseAttributes").adsenseAttributes; + const adsenseAttributes = Object.keys(adsenseConfig || {}); + // Returns ['page_url', 'document_language']. } // Test for googletag.PubAdsService.display @@ -297,13 +353,21 @@ function test_googletag_pubAdsService_updateCorrelator() { // Test for googletag.PubAdsService.setForceSafeFrame function test_googletag_pubAdsService_setForceSafeFrame() { - googletag.pubads().setForceSafeFrame(true); + googletag.setConfig({ + safeFrame: { + forceSafeFrame: true, + }, + }); // The following slot will be opted-out of the page-level force // SafeFrame instruction. googletag .defineSlot("/1234567/sports", [160, 600], "div-1")! - .setForceSafeFrame(false) + .setConfig({ + safeFrame: { + forceSafeFrame: false, + }, + }) .addService(googletag.pubads()); // The following slot will have SafeFrame forced. @@ -315,22 +379,22 @@ function test_googletag_pubAdsService_setForceSafeFrame() { // Test for googletag.PubAdsService.setSafeFrameConfig function test_googletag_pubAdsService_setSafeFrameConfig() { - googletag.pubads().setForceSafeFrame(true); - - const pageConfig = { - allowOverlayExpansion: true, - allowPushExpansion: true, - sandbox: true, - }; - - const slotConfig = { allowOverlayExpansion: false }; - - googletag.pubads().setSafeFrameConfig(pageConfig); + googletag.setConfig({ + safeFrame: { + forceSafeFrame: true, + allowOverlayExpansion: true, + allowPushExpansion: true, + sandbox: true, + }, + }); - // The following slot will not allow for expansion by overlay. googletag .defineSlot("/1234567/sports", [160, 600], "div-1")! - .setSafeFrameConfig(slotConfig) + .setConfig({ + safeFrame: { + allowOverlayExpansion: false, + }, + }) .addService(googletag.pubads()); // The following slot will inherit the page level settings, and hence @@ -343,13 +407,15 @@ function test_googletag_pubAdsService_setSafeFrameConfig() { // Test for googletag.PubAdsService.enableLazyLoad function test_googletag_pubAdsService_enableLazyLoad() { - 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, + googletag.setConfig({ + lazyLoad: { + // Fetch slots within 5 viewports. + fetchMarginPercent: 500, + // Render slots within 2 viewports. + renderMarginPercent: 200, + // Double the above values on mobile. + mobileScaling: 2.0, + }, }); } @@ -443,7 +509,11 @@ function test_googletag_slot_set() { // Setting an attribute on a single ad slot. googletag .defineSlot("/1234567/sports", [160, 600], "div")! - .set("adsense_background_color", "#FFFFFF") + .setConfig({ + adsenseAttributes: { + page_url: "http://www.example.com", + }, + }) .addService(googletag.pubads()); } @@ -451,23 +521,33 @@ function test_googletag_slot_set() { function test_googletag_slot_get() { const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! - .set("adsense_background_color", "#FFFFFF") + .setConfig({ + adsenseAttributes: { + page_url: "http://www.example.com", + }, + }) .addService(googletag.pubads()); - slot.get("adsense_background_color"); - // Returns '#FFFFFF'. + const adsenseConfig = slot.getConfig("adsenseAttributes").adsenseAttributes; + const pageUrl = adsenseConfig?.page_url || null; + // Returns 'http://www.example.com'. } // Test for googletag.Slot.getAttributeKeys function test_googletag_slot_getAttributeKeys() { const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! - .set("adsense_background_color", "#FFFFFF") - .set("adsense_border_color", "#AABBCC") + .setConfig({ + adsenseAttributes: { + page_url: "http://www.example.com", + document_language: "en", + }, + }) .addService(googletag.pubads()); - slot.getAttributeKeys(); - // Returns ['adsense_background_color', 'adsense_border_color']. + const adsenseConfig = slot.getConfig("adsenseAttributes").adsenseAttributes; + const adsenseAttributes = Object.keys(adsenseConfig || {}); + // Returns ['page_url', 'document_language']. } // Test for googletag.Slot.addService @@ -498,16 +578,20 @@ function test_googletag_slot_defineSizeMapping() { function test_googletag_slot_setClickUrl() { googletag .defineSlot("/1234567/sports", [160, 600], "div")! - .setClickUrl("http://www.example.com?original_click_url=") + .setConfig({ + clickUrl: "http://www.example.com?original_click_url=", + }) .addService(googletag.pubads()); } // Test for googletag.Slot.setCategoryExclusion function test_googletag_slot_setCategoryExclusion() { - // Label = AirlineAd + // Label = AirlineAd. googletag .defineSlot("/1234567/sports", [160, 600], "div")! - .setCategoryExclusion("AirlineAd") + .setConfig({ + categoryExclusion: ["AirlineAd"], + }) .addService(googletag.pubads()); } @@ -516,14 +600,18 @@ function test_googletag_slot_clearCategoryExclusions() { // Set category exclusion to exclude ads with 'AirlineAd' labels. const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! - .setCategoryExclusion("AirlineAd") + .setConfig({ + categoryExclusion: ["AirlineAd"], + }) .addService(googletag.pubads()); // Make an ad request. No ad with 'AirlineAd' label will be returned // for the slot. // Clear category exclusions so all ads can be returned. - slot.clearCategoryExclusions(); + slot.setConfig({ + categoryExclusion: null, + }); // Make an ad request. Any ad can be returned for the slot. } @@ -532,39 +620,59 @@ function test_googletag_slot_clearCategoryExclusions() { function test_googletag_slot_getCategoryExclusions() { const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! - .setCategoryExclusion("AirlineAd") - .setCategoryExclusion("TrainAd") + .setConfig({ + categoryExclusion: ["AirlineAd", "TrainAd"], + }) .addService(googletag.pubads()); - slot.getCategoryExclusions(); + const exclusions = slot.getConfig("categoryExclusion")?.categoryExclusion || []; // Returns ['AirlineAd', 'TrainAd']. } // Test for googletag.Slot.setTargeting function test_googletag_slot_setTargeting() { - const slot = googletag.defineSlot("/1234567/sports", [160, 600], "div")!.addService(googletag.pubads()); + const slot = googletag.defineSlot("/1234567/sports", [160, 600], "div")!; + slot.addService(googletag.pubads()); // Example with a single value for a key. - slot.setTargeting("allow_expandable", "true"); + slot.setConfig({ + targeting: { + allow_expandable: "true", + }, + }); // Example with multiple values for a key inside in an array. - slot.setTargeting("interests", ["sports", "music"]); + slot.setConfig({ + targeting: { + interests: ["sports", "music"], + }, + }); } // Test for googletag.Slot.clearTargeting function test_googletag_slot_clearTargeting() { const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! - .setTargeting("allow_expandable", "true") - .setTargeting("interests", ["sports", "music"]) - .setTargeting("color", "red") + .setConfig({ + targeting: { + allow_expandable: "true", + interests: ["sports", "music"], + color: "red", + }, + }) .addService(googletag.pubads()); - slot.clearTargeting("color"); + slot.setConfig({ + targeting: { + color: null, + }, + }); // Targeting 'allow_expandable' and 'interests' are still present, // while 'color' was cleared. - slot.clearTargeting(); + slot.setConfig({ + targeting: null, + }); // All targeting has been cleared. } @@ -572,13 +680,20 @@ function test_googletag_slot_clearTargeting() { function test_googletag_slot_getTargeting() { const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! - .setTargeting("allow_expandable", "true") + .setConfig({ + targeting: { + allow_expandable: "true", + }, + }) .addService(googletag.pubads()); - slot.getTargeting("allow_expandable"); + const targetingConfig = slot.getConfig("targeting").targeting; + + // Get targeting for a specific key. + const targeting = targetingConfig?.["allow_expandable"] || []; // Returns ['true']. - slot.getTargeting("age"); + const ageTargeting = targetingConfig?.["age"] || []; // Returns [] (empty array). } @@ -586,26 +701,35 @@ function test_googletag_slot_getTargeting() { function test_googletag_slot_getTargetingKeys() { const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! - .setTargeting("allow_expandable", "true") - .setTargeting("interests", ["sports", "music"]) + .setConfig({ + targeting: { + allow_expandable: "true", + interests: ["sports", "music"], + }, + }) .addService(googletag.pubads()); - slot.getTargetingKeys(); + const targetingConfig = slot.getConfig("targeting").targeting; + const keys = Object.keys(targetingConfig || {}); // Returns ['interests', 'allow_expandable']. } // Test for googletag.Slot.setCollapseEmptyDiv function test_googletag_slot_setCollapseEmptyDiv() { - googletag + const slot1 = googletag .defineSlot("/1234567/sports", [160, 600], "div-1")! - .setCollapseEmptyDiv(true, true) + .setConfig({ + collapseDiv: "BEFORE_FETCH", + }) .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 + const slot2 = googletag .defineSlot("/1234567/sports", [160, 600], "div-2")! - .setCollapseEmptyDiv(true) + .setConfig({ + collapseDiv: "ON_NO_FILL", + }) .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. diff --git a/types/google-publisher-tag/index.d.ts b/types/google-publisher-tag/index.d.ts index 225f8937c13905..d1a07c84c58dd0 100644 --- a/types/google-publisher-tag/index.d.ts +++ b/types/google-publisher-tag/index.d.ts @@ -484,10 +484,18 @@ declare namespace googletag { * * @example * // Example with a single value for a key. - * googletag.pubads().setTargeting('interests', 'sports'); + * googletag.setConfig({ + * targeting: { + * interests: 'sports' + * } + * }); * * // Example with multiple values for a key inside in an array. - * googletag.pubads().setTargeting('interests', ['sports', 'music']); + * googletag.setConfig({ + * targeting: { + * interests: ['sports', 'music'] + * } + * }); * * @see [Key-value targeting](https://developers.google.com/publisher-tag/guides/key-value-targeting) * @param key Targeting parameter key. @@ -501,15 +509,25 @@ declare namespace googletag { * Clears custom targeting parameters for a specific key or for all keys. * * @example - * googletag.pubads().setTargeting('interests', 'sports'); - * googletag.pubads().setTargeting('colors', 'blue'); - * googletag.pubads().setTargeting('fruits', 'apple'); + * googletag.setConfig({ + * targeting: { + * interests: 'sports', + * colors: 'blue', + * fruits: 'apple' + * } + * }); * - * googletag.pubads().clearTargeting('interests'); + * googletag.setConfig({ + * targeting: { + * interests: null + * } + * }); * // Targeting 'colors' and 'fruits' are still present, while 'interests' * // was cleared. * - * googletag.pubads().clearTargeting(); + * googletag.setConfig({ + * targeting: null + * }); * // All targeting has been cleared. * * @see [Key-value targeting](https://developers.google.com/publisher-tag/guides/key-value-targeting) @@ -525,12 +543,19 @@ declare namespace googletag { * set. * * @example - * googletag.pubads().setTargeting('interests', 'sports'); + * googletag.setConfig({ + * targeting: { + * interests: 'sports' + * } + * }); + * + * const targetingConfig = googletag.getConfig('targeting').targeting; * - * googletag.pubads().getTargeting('interests'); + * // Get targeting for a specific key. + * const targeting = targetingConfig?.['interests'] || []; * // Returns ['sports']. * - * googletag.pubads().getTargeting('age'); + * const ageTargeting = targetingConfig?.['age'] || []; * // Returns [] (empty array). * * @param key The targeting key to look for. @@ -545,10 +570,15 @@ declare namespace googletag { * been set. * * @example - * googletag.pubads().setTargeting('interests', 'sports'); - * googletag.pubads().setTargeting('colors', 'blue'); + * googletag.setConfig({ + * targeting: { + * interests: 'sports', + * colors: 'blue' + * } + * }); * - * googletag.pubads().getTargetingKeys(); + * const targetingConfig = googletag.getConfig('targeting').targeting; + * const keys = Object.keys(targetingConfig || {}); * // Returns ['interests', 'colors']. * * @return Array of targeting keys. Ordering is undefined. @@ -561,7 +591,9 @@ declare namespace googletag { * * @example * // Label = AirlineAd. - * googletag.pubads().setCategoryExclusion('AirlineAd'); + * googletag.setConfig({ + * categoryExclusion: ['AirlineAd'] + * }); * * @see [Custom labels to block ads](https://support.google.com/admanager/answer/3238504) * @param categoryExclusion The ad category exclusion label to add. @@ -576,12 +608,16 @@ declare namespace googletag { * * @example * // Set category exclusion to exclude ads with 'AirlineAd' labels. - * googletag.pubads().setCategoryExclusion('AirlineAd'); + * googletag.setConfig({ + * categoryExclusion: ['AirlineAd'] + * }); * * // Make ad requests. No ad with 'AirlineAd' label will be returned. * * // Clear category exclusions so all ads can be returned. - * googletag.pubads().clearCategoryExclusions(); + * googletag.setConfig({ + * categoryExclusion: null + * }); * * // Make ad requests. Any ad can be returned. * @@ -639,7 +675,9 @@ declare namespace googletag { * * @example * // Make ads centered. - * googletag.pubads().setCentering(true); + * googletag.setConfig({ + * centering: true + * }); * * @param centerAds `true` to center ads, `false` to left-align them. * @deprecated Use {@link googletag.config.PageSettingsConfig.centering | PageSettingsConfig.centering} @@ -794,7 +832,9 @@ declare namespace googletag { * * @example * // Postal code: - * googletag.pubads().setLocation("10001,US") + * googletag.setConfig({ + * location: '10001,US' + * }); * * @param address Freeform address. * @return The service object on which the method was called. @@ -825,7 +865,11 @@ declare namespace googletag { * `display` or `refresh`. * * @example - * googletag.pubads().set('adsense_background_color', '#FFFFFF'); + * googletag.setConfig({ + * adsenseAttributes: { + * page_url: 'http://www.example.com' + * } + * }); * * @see [AdSense Attributes](https://developers.google.com/publisher-tag/adsense_attributes) * @param key The name of the attribute. @@ -840,9 +884,15 @@ declare namespace googletag { * key. * * @example - * googletag.pubads().set('adsense_background_color', '#FFFFFF'); - * googletag.pubads().get('adsense_background_color'); - * // Returns '#FFFFFF'. + * googletag.setConfig({ + * adsenseAttributes: { + * page_url: 'http://www.example.com' + * } + * }); + * + * const adsenseConfig = googletag.getConfig('adsenseAttributes').adsenseAttributes; + * const pageUrl = adsenseConfig?.page_url || null; + * // Returns 'http://www.example.com'. * * @see [AdSense Attributes](https://developers.google.com/publisher-tag/adsense_attributes) * @param key Name of the attribute to look for. @@ -856,10 +906,16 @@ declare namespace googletag { * Returns the attribute keys that have been set on this service. * * @example - * googletag.pubads().set('adsense_background_color', '#FFFFFF'); - * googletag.pubads().set('adsense_border_color', '#AABBCC'); - * googletag.pubads().getAttributeKeys(); - * // Returns ['adsense_background_color', 'adsense_border_color']. + * googletag.setConfig({ + * adsenseAttributes: { + * page_url: 'http://www.example.com', + * document_language: 'en' + * } + * }); + * + * const adsenseConfig = googletag.getConfig('adsenseAttributes').adsenseAttributes; + * const adsenseAttributes = Object.keys(adsenseConfig || {}); + * // Returns ['page_url', 'document_language']. * * @return Array of attribute keys set on this service. Ordering is * undefined. @@ -950,12 +1006,20 @@ declare namespace googletag { * them being rendered directly in a publishers page. * * @example - * googletag.pubads().setForceSafeFrame(true); + * googletag.setConfig({ + * safeFrame: { + * forceSafeFrame: true + * } + * }); * * // The following slot will be opted-out of the page-level force * // SafeFrame instruction. * googletag.defineSlot('/1234567/sports', [160, 600], 'div-1')! - * .setForceSafeFrame(false) + * .setConfig({ + * safeFrame: { + * forceSafeFrame: false + * } + * }) * .addService(googletag.pubads()); * * // The following slot will have SafeFrame forced. @@ -984,21 +1048,21 @@ declare namespace googletag { * preferences, if specified. * * @example - * googletag.pubads().setForceSafeFrame(true); - * - * const pageConfig = { - * allowOverlayExpansion: true, - * allowPushExpansion: true, - * sandbox: true - * }; - * - * const slotConfig = {allowOverlayExpansion: false}; - * - * googletag.pubads().setSafeFrameConfig(pageConfig); + * googletag.setConfig({ + * safeFrame: { + * forceSafeFrame: true, + * allowOverlayExpansion: true, + * allowPushExpansion: true, + * sandbox: true + * } + * }); * - * // The following slot will not allow for expansion by overlay. * googletag.defineSlot('/1234567/sports', [160, 600], 'div-1')! - * .setSafeFrameConfig(slotConfig) + * .setConfig({ + * safeFrame: { + * allowOverlayExpansion: false + * } + * }) * .addService(googletag.pubads()); * * // The following slot will inherit the page level settings, and hence @@ -1026,13 +1090,15 @@ declare namespace googletag { * fetching margin. * * @example - * 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 + * googletag.setConfig({ + * lazyLoad: { + * // Fetch slots within 5 viewports. + * fetchMarginPercent: 500, + * // Render slots within 2 viewports. + * renderMarginPercent: 200, + * // Double the above values on mobile. + * mobileScaling: 2.0 + * } * }); * * @see [Ads best practices: Prioritize "important" ad slots](https://developers.google.com/publisher-tag/guides/ad-best-practices#prioritize_important_ad_slots) @@ -1294,7 +1360,11 @@ declare namespace googletag { * @example * // Setting an attribute on a single ad slot. * googletag.defineSlot('/1234567/sports', [160, 600], 'div')! - * .set('adsense_background_color', '#FFFFFF') + * .setConfig({ + * adsenseAttributes: { + * page_url: 'http://www.example.com' + * } + * }) * .addService(googletag.pubads()); * * @see [AdSense Attributes](https://developers.google.com/publisher-tag/adsense_attributes) @@ -1312,11 +1382,16 @@ declare namespace googletag { * * @example * const slot = googletag.defineSlot('/1234567/sports', [160, 600], 'div')! - * .set('adsense_background_color', '#FFFFFF') + * .setConfig({ + * adsenseAttributes: { + * page_url: 'http://www.example.com' + * } + * }) * .addService(googletag.pubads()); * - * slot.get('adsense_background_color'); - * // Returns '#FFFFFF'. + * const adsenseConfig = slot.getConfig('adsenseAttributes').adsenseAttributes; + * const pageUrl = adsenseConfig?.page_url || null; + * // Returns 'http://www.example.com'. * * @see [AdSense Attributes](https://developers.google.com/publisher-tag/adsense_attributes) * @param key Name of the attribute to look for. @@ -1333,12 +1408,17 @@ declare namespace googletag { * * @example * const slot = googletag.defineSlot('/1234567/sports', [160, 600], 'div')! - * .set('adsense_background_color', '#FFFFFF') - * .set('adsense_border_color', '#AABBCC') + * .setConfig({ + * adsenseAttributes: { + * page_url: 'http://www.example.com', + * document_language: 'en' + * } + * }) * .addService(googletag.pubads()); * - * slot.getAttributeKeys(); - * // Returns ['adsense_background_color', 'adsense_border_color']. + * const adsenseConfig = slot.getConfig('adsenseAttributes').adsenseAttributes; + * const adsenseAttributes = Object.keys(adsenseConfig || {}); + * // Returns ['page_url', 'document_language']. * * @return Array of attribute keys. Ordering is undefined. * @deprecated Use {@link googletag.Slot.getConfig} instead. @@ -1393,7 +1473,9 @@ declare namespace googletag { * * @example * googletag.defineSlot('/1234567/sports', [160, 600], 'div')! - * .setClickUrl('http://www.example.com?original_click_url=') + * .setConfig({ + * clickUrl: 'http://www.example.com?original_click_url=' + * }) * .addService(googletag.pubads()); * * @param value The click URL to set. @@ -1406,9 +1488,11 @@ declare namespace googletag { * Sets a slot-level ad category exclusion label on this slot. * * @example - * // Label = AirlineAd + * // Label = AirlineAd. * googletag.defineSlot('/1234567/sports', [160, 600], 'div')! - * .setCategoryExclusion('AirlineAd') + * .setConfig({ + * categoryExclusion: ['AirlineAd'] + * }) * .addService(googletag.pubads()); * * @see [Custom labels to block ads](https://support.google.com/admanager/answer/3238504) @@ -1424,14 +1508,18 @@ declare namespace googletag { * @example * // Set category exclusion to exclude ads with 'AirlineAd' labels. * const slot = googletag.defineSlot('/1234567/sports', [160, 600], 'div')! - * .setCategoryExclusion('AirlineAd') + * .setConfig({ + * categoryExclusion: ['AirlineAd'] + * }) * .addService(googletag.pubads()); * * // Make an ad request. No ad with 'AirlineAd' label will be returned * // for the slot. * * // Clear category exclusions so all ads can be returned. - * slot.clearCategoryExclusions(); + * slot.setConfig({ + * categoryExclusion: null + * }); * * // Make an ad request. Any ad can be returned for the slot. * @@ -1445,11 +1533,12 @@ declare namespace googletag { * * @example * const slot = googletag.defineSlot('/1234567/sports', [160, 600], 'div')! - * .setCategoryExclusion('AirlineAd') - * .setCategoryExclusion('TrainAd') + * .setConfig({ + * categoryExclusion: ['AirlineAd', 'TrainAd'] + * }) * .addService(googletag.pubads()); * - * slot.getCategoryExclusions(); + * const exclusions = slot.getConfig('categoryExclusion')?.categoryExclusion || []; * // Returns ['AirlineAd', 'TrainAd']. * * @return The ad category exclusion labels for this slot, or an empty array @@ -1465,14 +1554,22 @@ declare namespace googletag { * keys are defined in your Google Ad Manager account. * * @example - * const slot = googletag.defineSlot('/1234567/sports', [160, 600], 'div')! - * .addService(googletag.pubads()); + * const slot = googletag.defineSlot('/1234567/sports', [160, 600], 'div')!; + * slot.addService(googletag.pubads()); * * // Example with a single value for a key. - * slot.setTargeting('allow_expandable', 'true'); + * slot.setConfig({ + * targeting: { + * allow_expandable: 'true' + * } + * }); * * // Example with multiple values for a key inside in an array. - * slot.setTargeting('interests', ['sports', 'music']); + * slot.setConfig({ + * targeting: { + * interests: ['sports', 'music'] + * } + * }); * * @see [Key-value targeting](https://developers.google.com/publisher-tag/guides/key-value-targeting) * @param key Targeting parameter key. @@ -1488,16 +1585,26 @@ declare namespace googletag { * * @example * const slot = googletag.defineSlot('/1234567/sports', [160, 600], 'div')! - * .setTargeting('allow_expandable', 'true') - * .setTargeting('interests', ['sports', 'music']) - * .setTargeting('color', 'red') + * .setConfig({ + * targeting: { + * allow_expandable: 'true', + * interests: ['sports', 'music'], + * color: 'red' + * } + * }) * .addService(googletag.pubads()); * - * slot.clearTargeting('color'); + * slot.setConfig({ + * targeting: { + * color: null + * } + * }); * // Targeting 'allow_expandable' and 'interests' are still present, * // while 'color' was cleared. * - * slot.clearTargeting(); + * slot.setConfig({ + * targeting: null + * }); * // All targeting has been cleared. * * @see [Key-value targeting](https://developers.google.com/publisher-tag/guides/key-value-targeting) @@ -1514,13 +1621,20 @@ declare namespace googletag { * * @example * const slot = googletag.defineSlot('/1234567/sports', [160, 600], 'div')! - * .setTargeting('allow_expandable', 'true') + * .setConfig({ + * targeting: { + * allow_expandable: 'true' + * } + * }) * .addService(googletag.pubads()); * - * slot.getTargeting('allow_expandable'); + * const targetingConfig = slot.getConfig('targeting').targeting; + * + * // Get targeting for a specific key. + * const targeting = targetingConfig?.['allow_expandable'] || []; * // Returns ['true']. * - * slot.getTargeting('age'); + * const ageTargeting = targetingConfig?.['age'] || []; * // Returns [] (empty array). * * @param key The targeting key to look for. @@ -1536,11 +1650,16 @@ declare namespace googletag { * * @example * const slot = googletag.defineSlot('/1234567/sports', [160, 600], 'div')! - * .setTargeting('allow_expandable', 'true') - * .setTargeting('interests', ['sports', 'music']) + * .setConfig({ + * targeting: { + * allow_expandable: 'true', + * interests: ['sports', 'music'] + * } + * }) * .addService(googletag.pubads()); * - * slot.getTargetingKeys(); + * const targetingConfig = slot.getConfig('targeting').targeting; + * const keys = Object.keys(targetingConfig || {}); * // Returns ['interests', 'allow_expandable']. * * @return Array of targeting keys. Ordering is undefined. @@ -1553,15 +1672,19 @@ declare namespace googletag { * ad in the slot. This overrides the service-level settings. * * @example - * googletag.defineSlot('/1234567/sports', [160, 600], 'div-1')! - * .setCollapseEmptyDiv(true, true) - * .addService(googletag.pubads()); + * const slot1 = googletag.defineSlot('/1234567/sports', [160, 600], 'div-1')! + * .setConfig({ + * collapseDiv: 'BEFORE_FETCH' + * }) + * .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('/1234567/sports', [160, 600], 'div-2')! - * .setCollapseEmptyDiv(true) - * .addService(googletag.pubads()); + * const slot2 = googletag.defineSlot('/1234567/sports', [160, 600], 'div-2')! + * .setConfig({ + * collapseDiv: 'ON_NO_FILL' + * }) + * .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. * @@ -2793,6 +2916,11 @@ declare namespace googletag { /** * Supported interstitial ad triggers. + * + * **Note**: Beginning June 15, 2026, the `backward` trigger will no longer be + * supported and enabling it will have no effect. See the + * [GPT release notes](https://developers.google.com/publisher-tag/release-notes#2026-05-18) + * for more information. */ type InterstitialTrigger = | "unhideWindow" diff --git a/types/google-publisher-tag/package.json b/types/google-publisher-tag/package.json index b3307bd42c23e0..144417954b8a35 100644 --- a/types/google-publisher-tag/package.json +++ b/types/google-publisher-tag/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/google-publisher-tag", - "version": "1.20260518.9999", + "version": "1.20260525.9999", "nonNpm": "conflict", "nonNpmDescription": "Google Publisher Tag", "projects": [ @@ -16,12 +16,20 @@ "githubUsername": "jimper" }, { - "name": "Khoi Doan", - "githubUsername": "zombifier" + "name": "Zheng Wei", + "githubUsername": "zhengweiwithoutthei" }, { - "name": "Taymon A. Beal", - "githubUsername": "taymonbeal" + "name": "Jacob Goldman", + "githubUsername": "JacobGo" + }, + { + "name": "Anthony LaConte", + "githubUsername": "alaconte" + }, + { + "name": "Gene Levitzky", + "githubUsername": "glevitzky" } ] }