MAF.VAST.Tracker

A VAST Tracker Class that process the tracking URLs of the given ad/creative.

new MAF.VAST.Tracker()

Example

var tracker = new VAST.Tracker(ad, creative);

Methods

close()

Must be called when the player or the app is closed during the ad. Calls the closeLinear (in VAST 3.0) and close tracking URLs.

Fires:

complete()

Must be called when the user watched the linear creative until its end. Call the complete tracking URLs.

Fires:

errorWithCode(errorCode)

Send a request to the URL provided by the VAST Error element. If an [ERRORCODE] macro is included, it will be substituted with code.

Parameters:

NameTypeDescription
errorCodeString

Replaces [ERRORCODE] macro. [ERRORCODE] values are listed in the VAST specification.

load(paused)

Report the impression URL. Can only be called once. Will report the following URL's: All Impression URL's from the InLine and Wrapper tracking elements. The creativeView URL from the Tracking events.

Parameters:

NameTypeDescription
pausedBoolean

Indicate if the video is paused or not.

Fires:

setExpand(paused) → {Boolean}

Update the expand state and call the expand/collapse tracking URLs.

Parameters:

NameTypeDescription
pausedBoolean

Indicate if the video is expanded or not.

Fires:

Returns:

returns expanded.

setFullscreen(fullscreen) → {Boolean}

Update the fullscreen state and call the fullscreen tracking URLs.

Parameters:

NameTypeDescription
fullscreenBoolean

Indicate if the video is in fullscreen mode.

Fires:

Returns:

returns fullscreen.

setMuted(muted) → {Boolean}

Update the mute state and call the mute/unmute tracking URLs.

Parameters:

NameTypeDescription
mutedBoolean

Indicate if the video is muted or not.

Fires:

Returns:

returns muted.

setPaused(paused) → {Boolean}

Update the pause state and call the resume/pause tracking URLs.

Parameters:

NameTypeDescription
pausedBoolean

Indicate if the video is paused or not.

Fires:

Returns:

returns paused.

setProgress(progress) → {Number}

Update the current time value. This is required for tracking time related events such as start, firstQuartile, midpoint, thirdQuartile or rewind.

Parameters:

NameTypeDescription
progressNumber

The current playback time in seconds.

Returns:

returns progress.

setSkipDelay(duration) → {Boolean}

Must be called if you want to overwrite the Linear Skipoffset value. This will init the skip countdown duration. Then, every time you call setProgress(), it will decrease the countdown and emit a skip-countdown event with the remaining time.

Do not call this method if you want to keep the original Skipoffset value.

Parameters:

NameTypeDescription
durationNumber

The time in seconds until the skip button is displayed.

Returns:

returns duration.

skip()

Must be called when the skip button is clicked. Calls the skip tracking URLs.

Fires:

Events

firstQuartile

Fired only for linear ads with a duration. Fired when the adunit has reached 25% of its duration.

midpoint

Fired only for linear ads with a duration. Fired when the adunit has reached 50% of its duration.

onClickthrough

Fired when calling click() if there is at least one clickThroughURLTemplate element. A URL will be passed as a data.

onClose

Fired only for linear ads, fired when close() is called.

onCloseLinear

Fired only for linear ads, fired when close() is called.

onCollapse

Fired when calling setExpand(expanded) and changing the expanded state from true to false.

onComplete

Fired only for linear ads with a duration. Fired after complete() has been called.

onCreateView

Fired after load() method has been called.

onExitfullscreen

Fired when calling setFullscreen(fullscreen) and changing the fullscreen state from true to false.

onExpand

Fired when calling setExpand(expanded) and changing the expanded state from false to true.

onFullscreen

Fired when calling setFullscreen(fullscreen) and changing the fullscreen state from false to true.

onMute

Fired when calling setMuted(muted) and changing the mute state from false to true.

onPause

Fired when calling setPaused(paused) and changing the pause state from false to true.

onResume

Fired when calling setPaused(paused) and changing the pause state from true to false.

onRewind

Fired when setProgress(duration) is called with a smaller duration than the previous one.

onSkip

Fired after calling skip().

onStart

Fired only for linear ads with a duration. Fired on the 1st non-null setProgress(duration) call.

onUnmute

Fired when calling setMuted(muted) and changing the mute state from true to false.

thirdQuartile

Fired only for linear ads with a duration. Fired when the adunit has reached 75% of its duration.