...
placementConfig Configuration Options
Event name
Description
AdImpression
Called when there is an impression, regardless of creative type.
The AdImpression event passes a parameter with extra data that is used for 3rd party reporting:
Name | Mandatory | Default Value | Values | Description | ||
publisherId | Yes | String | Aniview publisher id | |||
channelId | Yes | String | Aniview channel id from the same account of the publisher id used | |||
position | Yes | String | the div id where the player should be created | |||
width | yes | Number | The player width in pixels If width = 100 and height = 0, width is auto detected based on containing element | |||
height | yes | Number | The player height in pixels If width = 100 and height = 0, height is auto detected based on containing element and is calculated as width / 1.777 | |||
minHeight | No | Number | Minimum player height - Used with width/height of 100/0 | |||
minWidth | No | Number | Minimum player width - Used with width/height of 100/0 | |||
maxRun | No | Number | Maximum number of waterfall runs in the player session | |||
maxImp | No | Number | Maximum number of impressions per player session | |||
errorLimit | No | Number | Maximum number of (1 + vastRetry) runs of the waterfall that do not generate impression. This means (1 + vastRetry) * (1 + errorLimit) - max number of consecutive waterfall runs that do not generate impression If there is an impression the counter reset to 0 | |||
ref1 | No | String | Macro list ref1: “AV_MACRO1=value1&AV_MACRO2=value2“ Values should be URL encoded | |||
clickthrough | String Array | Clickthrough url when clicking on the content. Not relevant in js If preloader is Content, can also be an array of clickthrough urls per video in the content array | ||||
Skip | No | false | Boolean | Show or not the skip button | ||
skipTimer | No | Number | Time to wait before showing the skip button. Required to be > 0 for skip button functionality | |||
skipText | No | String | Text to show in skip button | |||
passbackUrlpassback | No | string | Link to a javascript that will execute in an iframe and will be displayed after the player finishes all its retries and impressions, contact support for the exact format It can also be an object as defined below | passbackUrlobject | config for showing passback for placement | |
| No | object | ||||
width | No | 100% | Number | width of passback iframe iframe is centered | ||
height | No | 100% | Number | height of passback iframe iframe is centered | ||
hideControls | No | false | Boolean | Hide player controls or not |
Placement API
avDisplay(placementConfig)
Instantiate the placement object with the placementConfig configuration
start()
Start/resume the placement instance, including ad flow.
stop()
Stop the placement, including ad flow.
close() / destroy()
Close the placement and stop its functionality completely.
getWidth()
Returns the player width in pixels
getHeight()
Returns the player height in pixels
on(evt, func, context)
Register an event listener for placement events
hasNext()
Returns whether we have a ready ad to render for this placement.
show()
Shows the placement, resuming it and the ad flow (no re-construction).
hide()
Hides the placement, stopping it and the ad flow (no destruction).
startInRead()
Applies in-read appearance to the placement.
startInFloat(FloatingConfig
)
Applies floating appearance to the placement, as specific in FloatingConfig:
startInSticky(StickyConfig
)
Applies floating appearance to the placement, as specific in StickyConfig:
resetAppearance()
Applies appearance to the placement, as specified in the original placementConfig
.
Placement Events
The player on() function can be used to subscribe to events. Multiple listeners can be set for each event
In addition, callback on functions are supported to the events
Note: With vpaid ad sources, the player relies on events triggered by the vpaid. In some cases, some events are not supported by vpaids so those events might not be called sometimes.
The supported events are:
allows setting overriding configs to the placement in case of desktop | ||||
| No | number | ||
height | No | number | ||
| No | [{ w:Number, h: Number }] | ||
| No | object | just like desktop settings but for mobile, with 2 extra fields | |
| string | different position to the placement if needed | ||
| string | |||
| boolean | |||
| object | as per refresh config | ||
| {width: Number, height: Number} | |||
| {width: Number, height: Number} | |||
hideControls | No | false | Boolean | Hide player controls or not |
refresh | No | object | refresh policy config | |
strategy | string | AutoStart, Interval, None | ||
interval | No | number | 30/60/90 seconds |
Placement API
avDisplay(placementConfig)
Instantiate the placement object with the placementConfig configuration
start()
Start/resume the placement instance, including ad flow.
stop()
Stop the placement, including ad flow.
close() / destroy()
Close the placement and stop its functionality completely.
getWidth()
Returns the player width in pixels
getHeight()
Returns the player height in pixels
on(evt, func, context)
Register an event listener for placement events
hasNext()
Returns whether we have a ready ad to render for this placement.
show()
Shows the placement, resuming it and the ad flow (no re-construction).
hide()
Hides the placement, stopping it and the ad flow (no destruction).
startInRead()
Applies in-read appearance to the placement.
startInFloat(FloatingConfig
)
Applies floating appearance to the placement, as specific in FloatingConfig:
startInSticky(StickyConfig
)
Applies floating appearance to the placement, as specific in StickyConfig:
resetAppearance()
Applies appearance to the placement, as specified in the original placementConfig
.
Placement Events
The player on() function can be used to subscribe to events. Multiple listeners can be set for each event
In addition, callback on functions are supported to the events
Note: With vpaid ad sources, the player relies on events triggered by the vpaid. In some cases, some events are not supported by vpaids so those events might not be called sometimes.
The supported events are:
...
Event name | Description | ||
---|---|---|---|
AdImpression | Called when there is an impression, regardless of creative type.
| ||
AdError | Called 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 | ||
Inventory | Called when the player is initialized | ||
InventoryRequest | Called every time the player starts a waterfall run |
Sample Events
Player Initialized Event
The player is initialized on the inventory event
Code Block | ||
---|---|---|
| ||
player.on("Inventory", function(){
//Player is initialized
}); |
| |
AdError | Called 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 |
Inventory | Called when the player is initialized |
InventoryRequest | Called every time the player starts a waterfall run |
Sample Events
Player Initialized Event
The player is initialized on the inventory event
Code Block | ||
---|---|---|
| ||
player.on("AdImpressionInventory", function(){ //AdPlayer impressionis occuredinitialized }); |
...
Impression Event
Code Block | ||
---|---|---|
| ||
player.on("AdImpression", function(){
//Ad impression occured
}); |
Identify when the Player Finished Calls
An AdError event is called every time a set of calls to the waterfall finished without impression or when at least one limit of the player configuration is reached (maxRun, maxImp, errorLimit)
...
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 | 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 | 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 | |||||||||||||||||||||||||||||||||||||||||
Sticky/Floating | 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 | |||||||||||||||||||||||||||||||||||||||||
creativeDimensions | [{ w:Number, h: Number }] | Specific dimensions for the creatives to be rendered to this placement. |