Class NonceManager


Manages a nonce and its event reporting for a single content playback session. The content playback session lifecycle methods, including sendAdClick, sendAdTouch, sendPlaybackStart, and sendPlaybackEnd must be called as these respective events occur in order to enable programmatic monetization.
Methods
getNonce
sendAdClick
Notifies Google ad servers that a clickthrough on an ad has occurred during the given content playback session.
sendAdImpression
Deprecated. Notifies Google ad servers that the first frame of the ad that was requested with the nonce generated by this manager is displayed.
sendAdTouch
Notifies Google ad servers that a user touch or click on the ad other than a clickthrough (for example, skip, mute, tap, and more.) has occurred during the given content playback session.
sendPlaybackEnd
Notifies Google ad servers that playback for the given content playback session has ended.
sendPlaybackStart
Notifies Google ad servers that playback for the given content playback session has started.

Methods


getNonce

getNonce(): string
Returns
string The nonce generated for this manager when it is loaded. This value never changes for a given NonceManager instance. This nonce value is only valid for a single content playback session up to a maximum duration of 6 hours.

sendAdClick

sendAdClick(): void
Notifies Google ad servers that a clickthrough on an ad has occurred during the given content playback session.

sendAdImpression

sendAdImpression(): void
Notifies Google ad servers that the first frame of the ad that was requested with the nonce generated by this manager is displayed.

sendAdTouch

sendAdTouch(clickOrTouchEvent: MouseEvent | TouchEvent): void
Notifies Google ad servers that a user touch or click on the ad other than a clickthrough (for example, skip, mute, tap, and more.) has occurred during the given content playback session.
Parameters
clickOrTouchEvent: MouseEvent | TouchEvent The browser touch or click event that was fired for the user interaction.

sendPlaybackEnd

sendPlaybackEnd(): void
Notifies Google ad servers that playback for the given content playback session has ended. Call this method when playback ends (for example, when the player reaches end of stream, or when the user exits playback mid-way, or when the user leaves the page, or when advancing to the next content item in a playlist setting).

This method ends the asynchronous calls to Google servers started in sendPlaybackStart.

sendPlaybackStart

sendPlaybackStart(): void
Notifies Google ad servers that playback for the given content playback session has started. Call this method on video player start. This may be in response to a user-initiated action (click-to-play) or a page initiated action (autoplay).

This method starts asynchronous calls to Google servers to collect signals needed for IVT monitoring and detection.