Skip to content

Commit 0a651cc

Browse files
jose-torres-marinJose Torres
andauthored
feat: Expose Vast ad ID (#8477)
Media Tailor ads have a property called "vastAdId". This PR exposes it in the same way as the rest of the ads' properties, so it's available for use e.g. in analytics reporting. Closes #8474 --------- Co-authored-by: Jose Torres <[email protected]>
1 parent 9042872 commit 0a651cc

File tree

8 files changed

+59
-1
lines changed

8 files changed

+59
-1
lines changed

externs/mediatailor.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ mediaTailor.AdBreak;
6969
* skipOffset: ?string,
7070
* startTimeInSeconds: number,
7171
* nonLinearAdList: !Array<mediaTailor.NonLinearAd>,
72-
* trackingEvents: !Array<mediaTailor.TrackingEvent>
72+
* trackingEvents: !Array<mediaTailor.TrackingEvent>,
73+
* vastAdId: ?string
7374
* }}
7475
*
7576
* @property {string} adId
@@ -83,6 +84,7 @@ mediaTailor.AdBreak;
8384
* @property {number} startTimeInSeconds
8485
* @property {!Array<mediaTailor.NonLinearAd>} nonLinearAdList
8586
* @property {!Array<mediaTailor.TrackingEvent>} trackingEvents
87+
* @property {?string} vastAdId
8688
* @exportDoc
8789
*/
8890
mediaTailor.Ad;

externs/shaka/ads.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,11 @@ shaka.extern.IAd = class {
477477
*/
478478
getVastMediaWidth() {}
479479

480+
/**
481+
* @return {string}
482+
*/
483+
getVastAdId() {}
484+
480485
/**
481486
* @return {string}
482487
*/

lib/ads/client_side_ad.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,14 @@ shaka.ads.ClientSideAd = class {
319319
return this.ad_.getVastMediaWidth();
320320
}
321321

322+
/**
323+
* @override
324+
* @export
325+
*/
326+
getVastAdId() {
327+
return '';
328+
}
329+
322330
/**
323331
* @override
324332
* @export

lib/ads/interstitial_ad.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,14 @@ shaka.ads.InterstitialAd = class {
292292
return 0;
293293
}
294294

295+
/**
296+
* @override
297+
* @export
298+
*/
299+
getVastAdId() {
300+
return '';
301+
}
302+
295303
/**
296304
* @override
297305
* @export

lib/ads/interstitial_static_ad.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,14 @@ shaka.ads.InterstitialStaticAd = class {
249249
return 0;
250250
}
251251

252+
/**
253+
* @override
254+
* @export
255+
*/
256+
getVastAdId() {
257+
return '';
258+
}
259+
252260
/**
253261
* @override
254262
* @export

lib/ads/media_tailor_ad.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,14 @@ shaka.ads.MediaTailorAd = class {
278278
return 0;
279279
}
280280

281+
/**
282+
* @override
283+
* @export
284+
*/
285+
getVastAdId() {
286+
return this.ad_.vastAdId || '';
287+
}
288+
281289
/**
282290
* @override
283291
* @export

lib/ads/server_side_ad.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,14 @@ shaka.ads.ServerSideAd = class {
276276
return this.ad_.getVastMediaWidth();
277277
}
278278

279+
/**
280+
* @override
281+
* @export
282+
*/
283+
getVastAdId() {
284+
return '';
285+
}
286+
279287
/**
280288
* @override
281289
* @export

test/test/util/fake_ad.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ shaka.test.FakeAd = class {
5050
/** @private {number} */
5151
this.vastMediaWidth_ = 1280;
5252

53+
/** @private {string} */
54+
this.vastAdId_ = 'Test VAST Ad ID';
55+
5356
/** @private {string} */
5457
this.adId_ = 'Test Ad ID';
5558

@@ -293,6 +296,14 @@ shaka.test.FakeAd = class {
293296
return this.vastMediaWidth_;
294297
}
295298

299+
/**
300+
* @override
301+
* @export
302+
*/
303+
getVastAdId() {
304+
return this.vastAdId_;
305+
}
306+
296307
/**
297308
* @override
298309
* @export

0 commit comments

Comments
 (0)