Interface NonceManager

Manages a nonce and event reporting for a single content playback session. To enable automated monetization, call the following content playback lifecycle methods:
  • sendAdClick
  • sendAdTouch
  • sendPlaybackStart
  • sendPlaybackEnd
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 you are displaying the first frame of the ad.
sendAdTouch
Notifies Google ad servers of a user touch or click on the ad, for example, skip, mute, and tap, 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. 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 six hour duration.

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 you are displaying the first frame of the ad. This ad is the ad you request using the nonce that this NonceManager instance generates.

sendAdTouch

sendAdTouch(clickOrTouchEvent: MouseEvent | TouchEvent): void
Notifies Google ad servers of a user touch or click on the ad, for example, skip, mute, and tap, during the given content playback session. This ad interaction is different from a clickthrough, where the user clicks on the ad to navigate to the advertiser's site.
Parameters
clickOrTouchEvent: MouseEvent | TouchEvent The browser touch or click event based on user touch and click interaction.

sendPlaybackEnd

sendPlaybackEnd(): void
Notifies Google ad servers that playback for the given content playback session has ended. Call this method when playback ends. The following list details examples of playback ending:
  • The player reaches the end of the stream.
  • The user exits playback mid-way.
  • The user leaves the page.
  • When advancing to the next content item in a playlist setting.
This method ends the asynchronous calls to Google servers.

sendPlaybackStart

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

This method starts asynchronous calls to Google servers and collects signals needed for invalid traffic (IVT) monitoring and detection.