diff --git a/docs/api/vast-tracker.md b/docs/api/vast-tracker.md index e708b278..f7d0d85b 100644 --- a/docs/api/vast-tracker.md +++ b/docs/api/vast-tracker.md @@ -496,7 +496,7 @@ vastTracker.on('pause', () => { }); ``` -### setProgress(progress, macros) +### setProgress(progress, macros, trackOnce) Sets the duration of the ad and updates the quartiles based on that. This is required for tracking time related events such as `start`, `firstQuartile`, `midpoint`, `thirdQuartile` or `rewind`. @@ -504,6 +504,7 @@ Sets the duration of the ad and updates the quartiles based on that. This is req - **`progress: Number`** - Current playback time in seconds - **`macros: Object`** - Optional parameter. Object containing macros and their values to be replaced. Macros must be supported by VAST specification. +- **`trackOnce: Boolean`** - Optional parameter. If set to false, quartile events can be triggered again after a 'rewind' situation. #### Events emitted diff --git a/src/vast_tracker.js b/src/vast_tracker.js index c6a8a8dc..9f670332 100644 --- a/src/vast_tracker.js +++ b/src/vast_tracker.js @@ -177,7 +177,7 @@ export class VASTTracker extends EventEmitter { * @emits VASTTracker#midpoint * @emits VASTTracker#thirdQuartile */ - setProgress(progress, macros = {}) { + setProgress(progress, macros = {}, trackOnce = true) { // check if progress is a valid time input if (!util.isValidTimeValue(progress) || typeof macros !== 'object') { return; @@ -213,7 +213,7 @@ export class VASTTracker extends EventEmitter { this.lastPercentage = percent; } events.forEach((eventName) => { - this.track(eventName, { macros, once: true }); + this.track(eventName, { macros, once: trackOnce }); }); if (progress < this.progress) {