ima
可控制 PAL 的 Roku IMA 的全域函式。
ima.NonceLoader 類別
方法
程式輔助存取程式庫可讓發布商收集信號,用來發掘 AdX 需求。針對每個廣告請求,視需要呼叫相關的 setter,然後呼叫 loadNonceManager。接著,發布商可以呼叫 NonceManager.getNonce() 以取得應加入廣告請求的字串,做為
createNonceLoader()
傳回 ima.NonceLoader
:
loadNonceManager(request)
傳回 ima.NonceManager
:為廣告請求產生 Nonce 的 Nonce 管理員。
參數 | 類型 | 說明 |
---|---|---|
request |
ima.NonceRequest |
這類要求內含所要求 Nonce 的相關資訊。 |
ima.NonceManager 類別
方法
管理單一內容播放工作階段的 Nonce 及其事件報表。內容播放工作階段生命週期方法 (包括 ima.NonceManager.sendAdClick
、ima.NonceManager.sendAdTouch
、ima.NonceManager.sendPlaybackStart
和 sendPlaybackEnd
) 在這些事件發生時必須呼叫,才能啟用程式輔助營利。
getNonce()
傳回 String
:載入此管理員時為這個管理員產生的 Nonce。這個值不會變更特定 NonceManager 執行個體的值。這個 Nonce 值僅適用於單一內容播放工作階段,時間上限為 6 小時。
poll()
更新管理員狀態,使其能夠追蹤播放進度。
sendAdClick()
通知 Google 廣告伺服器,在特定內容播放工作階段期間發生廣告點擊。
sendAdImpression()
已淘汰,使用 ima.NonceManager.sendPlaybackStart
和 ima.NonceManager.sendPlaybackEnd/code>.
sendAdTouch(touch)
Notifies Google ad servers that a user touch or click on the ad other than a
clickthrough (for example, skip, mute, tap, etc.) has occurred during the given
content playback session.
Parameter
Type
Description
touch
roInputEvent|String
The key received from onKeyEvent (if using
SceneGraph), or the roInputEvent otherwise.
sendPlaybackEnd()
Notifies Google ad servers that playback for the given content playback
session has ended. This should be called when playback ends (for example, when the
player reaches end of stream, or when the user exits playback mid-way, or when
the user quits the channel, 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()
Notifies Google ad servers that playback for the given content playback
session has started. This should be called on "video player start". This may
be in response to a user-initiated action (click-to-play) or a channel
initiated action (autoplay).
This method will start asynchronous calls to Google servers to collect signal
needed for IVT monitoring and detection.
Class
ima.NonceRequest
Fields
adWillAutoPlay,
adWillPlayMuted,
continuousPlayback,
descriptionUrl,
directedForChildOrUnknownAge,
iconsSupported,
ppid,
sessionId,
storageAllowed,
supportedApiFrameworks,
videoHeight,
videoWidth
Methods
Information a publisher can provide when requesting a PAL nonce.
Properties
Name
Type
Description
adWillAutoPlay
Set to true if the ad will be auto played without waiting for user
interaction. Set to false if the ad will wait for user interaction before
being played.
adWillPlayMuted
Set to true if the ad will be played while muted. Set to false if the ad
will play unmuted.
continuousPlayback
Set to true if the player intends to continuously play the content videos
one after another similar to TV broadcast or video playlist. Set to false
otherwise.
descriptionUrl
The description URL of the content during which the ad will be played.
Any description URL string longer than 500 characters will be ignored and
excluded from the nonce.
directedForChildOrUnknownAge
Whether the ad request is directed to a child or user of an unknown age
(TFCD or TFUA). Default value is false.
iconsSupported
Whether VAST icons are supported by the video player. On Roku this value
should always be false.
ppid
The publisher provided ID. Any PPID longer than 200 characters will be
ignored.
Note: The PPID will not be used in personalisation. If it is appropriate to
use a ppid for personalization, include it separately in clear text in your
ad request.
sessionId
Session ID is a temporary random ID. It is used exclusively for frequency
capping. A session ID must be a UUID.
storageAllowed
Whether storage consent (purpose 1 consent) from the IAB TCF V2 spec has
been granted by the user. Defaults to true.
supportedApiFrameworks
Accepts an array of strings representing API framweworks supported by the
player as defined in AdCOM 1.0 "API Frameworks" list https://github.com/InteractiveAdvertisingBureau/AdCOM/blob/master/AdCOM%20v1.0%20FINAL.md#list--api-frameworks-.
Example: ["2","7","9"] indicates this player supports VPAID 2.0, OMID 1.0,
and SIMID 1.1.
videoHeight
The height of the ad video element.
videoWidth
The width of the ad video element.
createNonceRequest()
Returns ima.NonceRequest
: