...
The supported events are:
Event name | Description | |||
---|---|---|---|---|
onLoad | Indicates the first time an ad sources triggered the AdLoaded event | |||
AdReady | Fires on every ad AdLoaded event of any ad | |||
onEvent | AdImpressiononPlay | Called when there is a video impressionan impression, regardless of creative type.
| ||
AdClickThruAdError onClick | Called when the ad is clicked on | |||
AdPaused onPause | Called when the ad is paused | |||
AdPlaying onResume | Called when the ad starts playing or resumed | |||
onError | Called by the player every time it finish running 1 + by the player every time it finish running 1 + vastRetry waterfall runs without impression Called also whenever the player decides that it should stop running, for example when maxImp or maxRun is reached, in this case the event will pass a parameter: {errorlimit: true} to indicate the player is stopping calls for ads | |||
AdStoppedInventory onStopped | Called when the player is stoppinginitialized | |||
AdSkipped onSkip | Called when an ad is skipped | |||
Inventory onInventory | Called when the player is initialized | |||
InventoryRequest onInventoryRequest | Called every time the player InventoryRequest | Called every time the player starts a waterfall run | AdViewableImpression | Called on viewable impression event - when ad is viewable for at least 2 consecutive sconds |
Sample Events
Player Initialized Event
...
Code Block | ||
---|---|---|
| ||
player.on("AdImpression", function(){ //Ad impression accouredoccured }); |
Identify when the Player Finished Calls
An AdError event is called every time a set of vastRetry+1 calls to the waterfall finished without impression or when at least one limit of the player configuration is reached (maxRun, maxImp, errorLimit)
...
Code Block | ||
---|---|---|
| ||
player.on("AdError", function(res){ if(res && res.errorlimit) { //Player stopped } }); |
...
Placement Behavior
The player support advanced templates behaviors such as In Article, Floating, Sticky and many customizations.
...
Name | Mandatory | Default Value | Values | Description |
---|---|---|---|---|
playOnView | false | Boolean | If set to true, the player will automatically check viewability and will call startAd only when in view. | |
startOnView | false | Boolean | If set to true, the player will start only when in view. This means that inventory will be sent only when in view and the player loads | |
reqOnView | false | Boolean | If set to true, the player will run the waterfall and call ad sources only when in view. When out of view, when its time to call the ad sources, the player will verify that its in view and if not it will wait till the player is in view | |
vitab | false | Boolean | If set to true, tab viewability is taken into account when checking viewability | |
pauseOnUnseen | false | Boolean | If set to true, the player will pause when its out of view | |
pauseOnBlur | false | Boolean | Pause when browser window lose focus | |
openAnim | false | Boolean | If true, player opens in animation | |
hideInitPreloader | false | Boolean | Hide player when searching for ads | |
showPlayer | Boolean | Force showing the player | ||
scriptId | Yes | String | Id of script used to position the player if no pos defined | |
posId | String | Position id If defined the player will be located on the element with the specified id | ||
posTag | String | Position tag If defined the player will be located on the element with the specified tag name | ||
posClass | String | Position class If defined the player will be located on the first element with the specified class | ||
posSelector | String | Position selector If defined, the player position will use querySelector with the given string | ||
posDfp1x1 | Boolean | If defined, it is assumed the player script is served inside a 1x1 hidden iframe generated by DFP The player will position at the place of the iframe in the parent window | ||
adLabel | Object | If defined, it will appear above the player e.g. {"text":"Advertisment"} | ||
InArticle/InFeed | The player opens up only when there is an ad impression and takes the place in the page to display the ad. When it finish usually it collapse Use with a combination of playOnView and other flags | |||
Floating | Object | A floating player has a position in the page body and when out of view it floats to a fixed position over the page is its always viewable A floating player can start as InArticle/InFeed and float when the position is out of view | ||
size | Number 0-1 | The size of the floating player will be the size of the original player x size | ||
right | Number | Create a margin of the defined number from the right side of the window | ||
bottom | Number | Create a margin of the defined number from the bottom of the window | ||
customCss | String | Used to define custom CSS that will be implemented in <style></style>. | ||
floatingCss | String | Used to define custom place for the floating player, for example use the below for a bottom-left floating half the size of the original player. | ||
floatOnBottom | Boolean | By default the floating player only appears when scrolling down, If true, will float whenever the player is out of view | ||
closeButton | Boolean | If true, show a close button that will unfloat the player to its original position | ||
Sticky | Object | A sticky player is always sticking i a fixed position on the screen, typically in one of the screen corners | ||
size | Number | The size of the sticky player will be the size of the original placement x size Set to 1 for easy configuration | ||
position | String | Defines the position of the sticky player. Can be one of: Bottom-Right Bottom-Left Top-Right Top-Left | ||
right | Number | Create a margin of the defined number from the right side of the window | ||
left | Number | Create a margin of the defined number from the left side of the window | ||
top | Number | Create a margin of the defined number from the top side of the window | ||
bottom | Number | Create a margin of the defined number from the bottom side of the window |
Placements extend the regular studio tag configurations in the following fashion:
The following properties from the Studio Tag are ignored by Placements:
playOnView - playing or not depends on the type of creative to render, so for video creatives this config will be passed in separately.
fullscreen
- placements are creative-neutralpauseButton - assumes pause-able media, not creative neutral
soundButton - assumes media has sound, not creative neutral
showbigplay - assumes play-able media, not creative neutral
autovolume - assumes media has sound, not creative neutral
imaiosskip- assumes IMA is involved, video centric, not creative neutral
autoPlay- assumes media is playable, not creative neutral
replayFunc - assumes media is playable, not creative neutral
ifrhandler- assumes media requires an iframe handler, not creative neutral
startaddelay
- assumes media is playable, not creative neutralstartmidroll- assumes media is playable, not creative neutral
backgroundColor- assumes media has background, not creative neutral
nativetest - assumes media is a tested native video, not creative neutral
nativevideo - assumes media is a native video, not creative neutral
autosound - assumes media has sound, not creative neutral
closeButtonStyle - assumes media is close-able, not creative neutral
closeButton - assumes media is close-able, not creative neutral
timelinechange - assumes media has timeline dependent position, not creative neutral
noifsnd
- assumed media has sound, not creative neutralskipText
- placements have their own skip implementationvastRetry
- assumes media is VAST, not creative neutralmode
- setting for VAST, not creative neutralloopVideo
- assumes media is a video, not creative neutralMidrolltime - assumes media is a video, not creative neutral
loop - assumes media is a video, not creative neutral
loopVideo - assumes media is a video, not creative neutral
timelineMode - assumes media has a timeline, not creative neutral
vastIconEnabled - assumes media is a video, not creative neutral
lastFrame - assumes media is a video, not creative neutral
The following properties from the Studio Tag haven’t yet been implemented by Placements:
...
adLabel
...
HD
...
hidemobilecontrols
...
hidecontrols
...
customCSS
...
customLogo
...
adsControlPositioning
...
logo
...
hideLogoOnAd
...
hideControls
...
contentUrl
...
showpreloader
...
preloader
...
contentClickThrough
...