Skip to content

Commit 6984573

Browse files
🤖 Merge PR DefinitelyTyped#73460 Sync latest changes to @types/google-publisher-tag by @google-publisher-tag
Co-authored-by: jimper <jimper@users.noreply.github.com>
1 parent 8e5d805 commit 6984573

3 files changed

Lines changed: 71 additions & 6 deletions

File tree

‎types/google-publisher-tag/google-publisher-tag-tests.ts‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Tests for Google Publisher Tag 1.20250728
2-
// Synced from: https://github.com/googleads/google-publisher-tag-types/commit/02d9acb6d6e8578a1a5fc39691ec36cd799f0a6b
1+
// Tests for Google Publisher Tag 1.20250811
2+
// Synced from: https://github.com/googleads/google-publisher-tag-types/commit/a3d900bc56c2ce535e539ce139d7e59bc9fe7be4
33

44
// Test for googletag.cmd
55
function test_googletag_cmd() {
@@ -1210,6 +1210,27 @@ function test_googletag_events_rewardedSlotClosedEvent() {
12101210
}
12111211
}
12121212

1213+
// Test for googletag.events.RewardedSlotVideoCompletedEvent
1214+
function test_googletag_events_rewardedSlotVideoCompletedEvent() {
1215+
const targetSlot = googletag.defineOutOfPageSlot("/1234567/example", googletag.enums.OutOfPageFormat.REWARDED);
1216+
1217+
// Slot returns null if the page or device does not support rewarded ads.
1218+
if (targetSlot) {
1219+
targetSlot.addService(googletag.pubads());
1220+
1221+
// This listener is called when the video in a rewarded ad slot has
1222+
// finished playing.
1223+
googletag.pubads().addEventListener("rewardedSlotVideoCompleted", event => {
1224+
const slot = event.slot;
1225+
console.log("Video in rewarded ad slot", slot.getSlotElementId(), "has finished playing.");
1226+
1227+
if (slot === targetSlot) {
1228+
// Slot specific logic.
1229+
}
1230+
});
1231+
}
1232+
}
1233+
12131234
// Test for googletag.events.RewardedSlotReadyEvent
12141235
function test_googletag_events_rewardedSlotReadyEvent() {
12151236
// This listener is called when a rewarded ad slot becomes ready to be

‎types/google-publisher-tag/index.d.ts‎

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,7 +2151,7 @@ declare namespace googletag {
21512151
* @see [Collapse empty ad slots](https://developers.google.com/publisher-tag/samples/collapse-empty-ad-slots)
21522152
* @see [Minimize layout shift](https://developers.google.com/publisher-tag/guides/minimize-layout-shift)
21532153
*/
2154-
collapseDiv?: "DISABLED" | "BEFORE_FETCH" | "ON_NO_FILL" | null;
2154+
collapseDiv?: CollapseDivBehavior | null;
21552155

21562156
/**
21572157
* Setting to enable or disable Single Request Architecture (SRA).
@@ -2263,6 +2263,14 @@ declare namespace googletag {
22632263
adsenseAttributes?: AdSenseAttributesConfig | null;
22642264
}
22652265

2266+
/**
2267+
* Supported values for controlling the collapsing behavior of ad slots.
2268+
*
2269+
* @see {@link googletag.config.PageSettingsConfig.collapseDiv | PageSettingsConfig.collapseDiv}
2270+
* @see {@link googletag.config.SlotSettingsConfig.collapseDiv | SlotSettingsConfig.collapseDiv}
2271+
*/
2272+
type CollapseDivBehavior = "DISABLED" | "BEFORE_FETCH" | "ON_NO_FILL";
2273+
22662274
/**
22672275
* Settings to control publisher privacy treatments.
22682276
*/
@@ -2565,7 +2573,7 @@ declare namespace googletag {
25652573
* @see [Collapse empty ad slots](https://developers.google.com/publisher-tag/samples/collapse-empty-ad-slots)
25662574
* @see [Minimize layout shift](https://developers.google.com/publisher-tag/guides/minimize-layout-shift)
25672575
*/
2568-
collapseDiv?: "DISABLED" | "BEFORE_FETCH" | "ON_NO_FILL" | null;
2576+
collapseDiv?: CollapseDivBehavior | null;
25692577

25702578
/**
25712579
* Setting to configure ad category exclusions.
@@ -3344,10 +3352,41 @@ declare namespace googletag {
33443352
* @see [Ad event listeners](https://developers.google.com/publisher-tag/samples/ad-event-listeners)
33453353
* @see [Display a rewarded ad](https://developers.google.com/publisher-tag/samples/display-rewarded-ad)
33463354
*/
3347-
33483355
// eslint-disable-next-line @typescript-eslint/no-empty-interface
33493356
interface RewardedSlotClosedEvent extends Event {}
33503357

3358+
/**
3359+
* This event is fired when a rewarded video ad has finished playing.
3360+
* @example
3361+
* const targetSlot = googletag.defineOutOfPageSlot(
3362+
* '/1234567/example',
3363+
* googletag.enums.OutOfPageFormat.REWARDED);
3364+
*
3365+
* // Slot returns null if the page or device does not support rewarded ads.
3366+
* if(targetSlot) {
3367+
* targetSlot.addService(googletag.pubads());
3368+
*
3369+
* // This listener is called when the video in a rewarded ad slot has
3370+
* // finished playing.
3371+
* googletag.pubads().addEventListener('rewardedSlotVideoCompleted',
3372+
* (event) => {
3373+
* const slot = event.slot;
3374+
* console.log('Video in rewarded ad slot', slot.getSlotElementId(),
3375+
* 'has finished playing.');
3376+
*
3377+
* if (slot === targetSlot) {
3378+
* // Slot specific logic.
3379+
* }
3380+
* }
3381+
* );
3382+
* }
3383+
*
3384+
* @see [Ad event listeners](https://developers.google.com/publisher-tag/samples/ad-event-listeners)
3385+
* @see [Display a rewarded ad](https://developers.google.com/publisher-tag/samples/display-rewarded-ad)
3386+
*/
3387+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
3388+
interface RewardedSlotVideoCompletedEvent extends Event {}
3389+
33513390
/**
33523391
* This event is fired when a
33533392
* [rewarded ad](https://support.google.com/admanager/answer/9116812) is
@@ -3518,6 +3557,11 @@ declare namespace googletag {
35183557
*/
35193558
rewardedSlotClosed: RewardedSlotClosedEvent;
35203559

3560+
/**
3561+
* Alias for {@link events.RewardedSlotVideoCompletedEvent}.
3562+
*/
3563+
rewardedSlotVideoCompleted: RewardedSlotVideoCompletedEvent;
3564+
35213565
/**
35223566
* Alias for {@link events.RewardedSlotReadyEvent}.
35233567
*/

‎types/google-publisher-tag/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "@types/google-publisher-tag",
4-
"version": "1.20250728.9999",
4+
"version": "1.20250811.9999",
55
"nonNpm": true,
66
"nonNpmDescription": "Google Publisher Tag",
77
"projects": [

0 commit comments

Comments
 (0)