Placements are entities representing “real-estate spaces” on screen, i.e. HTML elements into which we render ads. Placement entities connect channels to custom placements on any site utilizing CSS selectors and allow customization of the placement’s behavior.
Placements extend the regular studio tag configurations in the following fashion:
3. Tag entity API
3.1 Get Tags List
Retrieves a list of all Tags in the network.
Request URL:
https://manage.aniview.com/api/taggenerator/playertag?format=json&expand=null&filter={"$and":[{"status":{"$in":[1]}}]}
Request Method:
GET
Status Code:
200 OK
Filtering Parameters (Optional):
Parameter | Description | Values |
---|---|---|
Type | Player type | outstream:1,instream:2 |
Status | Player status | 1:active,2:archived |
3.2. Create Tag
Request URL:
Request URL:
https://manage.aniview.com/api/taggenerator/playertag?format=json
Request Method:
POST
Main
Parameter | Type | Description |
description | String | Player Tag description. |
name | String | Player Tag Name.(Mandatory) |
channel | String | Channel ID. |
publisher | String | Publisher ID. |
posDfp1x1 | Boolean | Set true if there is a DFP pixel on the site. |
posType | Boolean | Set true if you would like to set custom positioning using CSS selector. |
type | 0:ID, 1:Tag, 2:Class, 3:Selector | Select the CSS selector type. |
value | String | Fill CSS Selector. Note that for ID and Class there is not need to use the # and . sings before the selector. |
ref1 | String | Use to pass one or more values for reporting and/or targeting purposes. |
template | String | Template ID. |
Mobile
Parameter | Type | Description |
_id | String | Channel ID |
posDfp1x1 | Boolean | Set true if there is a DFP pixel on the site. |
posType | Boolean | Set true if you would like to set custom positioning using CSS selector. |
type | 0:ID, 1:Tag, 2:Class, 3:Selector | Select the CSS selector type. |
value | String | Fill CSS Selector. Note that for ID and Class there is not need to use the # and . sings before the selector. |
publisher | String | Publisher ID. |
ref1 | String | Use to pass one or more values for reporting and/or targeting purposes. |
template | String | Template ID. |
A/B Testing
Parameter | Type | Description |
abTest | String | Test title. |
sp | Number between 1-100 | Traffic allocation precentage. |
channel | Int | Channel ID. |
template | Int | Template ID. |
posDfp1x1 | Boolean | Select to add a DFP pixel for targeting as an override function. |
A/B Testing: Test position (can be applied for each test)
Parameter | Type | Description |
useDifferent | Boolean | Set true to use a different position for the specific test. |
posType | Boolean | Set true if you would like to set custom positioning using CSS selector. |
type | 0:ID, 1:Tag, 2:Class, 3:Selector | Select the CSS selector type. |
value | Fill CSS Selector. Note that for ID and Class there is not need to use the # and . sings before the selector. |
A/B Testing Request Example Payload :
{ "staging": { "template": "template", "channel": "channel", "publisher": "publisher", "posDfp1x1": false, "overrideExtensions": { "isActive": false, "preloader": { "type": 0, "clickThrough": null } }, "ref1": null }, "configsArray": null, "configs": [ { "playerTag": { "template": { "name": "template_name", "id": null, "_id": { "$oid": "template_id" } }, "channel": { "name": "channel_name", "_id": { "$oid": "channel_id" } }, "publisher": null, "position": { "type": 2, "value": "class_here" } }, "abTest": "2", "sp": 100 } ], "type": 1, "usage": null, "isDeployed": true, "status": 1, "name": "tag_name", "publisherId": "publisherId" }
3.2.1 Create Outstream Tag
Outstream tag is an ad only player.
Minimal Request Example Payload :
{ "staging": { "template": "template_id", "channel": "channel_id", "publisher": "publisher_id", "posDfp1x1": false, "overrideExtensions": { "isActive": false, "preloader": { "type": 0, "clickThrough": null } }, "ref1": null }, "configsArray": null, "type": 1, "usage": null, "isDeployed": true, "status": 1, "name": "tag_name", "publisherId": "publisherId" }
Override Functions
The override function feature enables users to access the code that loads the Player. We recommend updating only the preRun and postStart functions. The preRun can be used to modify the config object and all other actions that should occur before the player loads. The postStart function should be applied whenever adjustments are made after the player loads. Please note that the postStart function loads with the player parameter represented as p.
Override function name | Type | Base code |
create | 4 | var d1 = document.createElement("div"); d1.style.width = "100%"; d1.style.margin = "0 auto"; d1.style.maxWidth = "" + a.maxWidth + "px"; var d2 = document.createElement("div"); d2.id = "aniBox"; d2.style.height = "1px"; var d3 = document.createElement("div"); d3.id = "" + a.position; if (p === this.doc || p === this.doc.head) { p = this.doc.body; } if (n) { p.insertBefore(d1, n); } else { p.appendChild(d1); } a.refDiv = p; d1.appendChild(d2); d2.appendChild(d3); this.postCreate(d1); |
findWin | 1 | try { if ((!a.posDfp1x1 && !a.posClass && !a.posSelector && !a.posId && !a.posTag) || (w === top) || !w.frameElement) { this.doc = document; this.win = w; } else { if (a.posDfp1x1 && w.frameElement) { this.win = parent; this.doc = parent.document; } else { this.win = top; this.doc = top.document; } } } catch (f) { this.doc = document; this.win = w; } |
getAttr | 8 | if (a.scriptId) { var s = document.getElementById(a.scriptId) || document.getElementById(a.scriptId + "-used"); if (s) { for (var i = 0, t = s.attributes; i < s.attributes.length; i++) { if (t[i].nodeName && t[i].nodeName.indexOf("data-") == 0) { var n = t[i].nodeName.replace("data-", ""); try { a[n] = t[i].nodeValue; } catch { } } } if (s.src) { var p = s.src.indexOf("?"); if (p > 10) { var r = (s.src.substring(p + 1, s.src.length)); a.ref1 = (a.ref1 || "") + "&" + (r || ""); } } } } |
load | 6 | var that = this; var scp = this.doc.createElement("script"); scp.src = (a.baseJsUrl || "https://player.aniview.com/script/6.1/") + "player.js"; scp.onload = function () { that.start(); }; scp.async = true; this.doc.body.appendChild(scp); |
position | 5 | var p = this.doc; var isScp = false; if (a.posSelector) { try { p = this.doc.querySelector(a.posSelector); } catch (e) { this.track("AV_M3", "&prbdres=badpos&sn=" + encodeURIComponent(location.href).slice(0, 400)); return; } if (!p) { this.retry(); return; } } if (a.posId) { p = this.doc.getElementById(a.posId); if (!p) { this.retry(); return; } } if (a.posTag) { var c = a.posTag.split("#"); if (c && c.length == 2) { var e = p.getElementsByTagName(c[0]); if (e.length == 0) { this.retry(); return; } p = e[Math.min(c[1] - 1, e.length - 1)]; } } if (a.posClass) { var c = a.posClass.split("#"); var e = 1; if (c.length == 2) { e = c[1]; } var f = p.getElementsByClassName(c[0]); if (f.length > 0) { p = f[Math.min(e - 1, f.length - 1)]; } if (!p) { this.retry(); return; } } if (a.posDfp1x1 && window.frameElement) { n = window.frameElement.parentNode.parentNode; p = n.parentNode; if (document.body.clientHeight > 5 && !a.nohideIframe) { frameElement.style.height = "0px"; } if (a.posType == "after") { n = n.nextElementSibling; } } var n; if (p === this.doc) { n = this.doc.getElementById(a.scriptId); if (n) { n.id += "-used"; p = n.parentNode; } } if (p === this.doc.head) { n = null; p = this.doc; } if (a.posType && a.posType !== "in" && !n) { if (a.posType === "after" && p.nextElementSibling) { p = p.nextElementSibling; } n = p; p = n.parentNode; } if (p) { if (!p.av_setpos) { p.av_setpos = {}; } if (!p.av_setpos[a.position]) { p.av_setpos[a.position] = true; a.position += "-" + Date.now(); this.create(p, n); this.load(); } else { this.track("AV_M3", "&prbdres=duppos&sn=" + encodeURIComponent(location.href).slice(0, 400)); } } |
postCreate | 2 | Empty |
postStart | 7 | Empty |
preRun | 10 | Empty |
retry | 3 | if (this.retryCnt++ > this.timeout) { this.track("AV_M3", "&prbdres=nopos&sn=" + encodeURIComponent(location.href).slice(0, 400)); return; } var that = this; setTimeout(function () { that.position(); }, 250); |
run | 11 | if (b && b.length > 0) { st.target(); } this.a = a; this.preRun(); this.findWin(); if (!this.doc.body) { this.doc.addEventListener('DOMContentLoaded', function () { st.run(); }); if (this.bodyRetry > 0) { setTimeout(function () { st.run(); }, 250); this.domRetry--; } return; } if (this.unique() && !this.loaded) { this.loaded = true; this.track("playerLoaded"); this.retryCnt = 0; this.timeout = a.posTimeout || 40; this.pbjs = window.aniviewRenderer && window.aniviewRenderer.units && window.aniviewRenderer.units[a.scriptId]; if (this.pbjs) { this.pbjs.prepareConfig(a, st); } this.position(); } |
start | 9 | var b; this.getAttr(); try { if (this.win.avPlayer) { b = new this.win.avPlayer(a); } else { if (window.avPlayer) { b = new avPlayer(a); } else { b = new top.avPlayer(a); } } } catch (exp) { b = new avPlayer(a); } this.p = b; if (this.pbjs) { this.pbjs.preparePlayer(b, st); } if (a.templateType != 0) { b.startTemplate(this.doc.getElementById(a.position).parentNode); } b.play(a); this.postStart(b); |
target | 12 | var ua = navigator.userAgent || navigator.vendor || window.opera; var uav = navigator.appVersion ? navigator.appVersion.toLowerCase() : ""; var op = 2; if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(ua) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(ua.substr(0, 4))) { op = 1; } else { if (/web0s|webos|tizen/i.test(uav)) { op = 4; } } for (var i = 0; i < b.length; i++) { var b1 = b[i]; if (b1.t && b1.t.p && b1.t.p == op && b1.a) { a = b1.a; break; } } |
track | 13 | if (!this.trackUrl) { this.trackUrl = "https://" + (a.trackDomain || "track1.aniview.com") + "/track?pid=" + a.publisherId + "&cid=" + a.channelId + "&cb=" + Date.now() + "&r=" + location.host + "&e="; } m = m ? m : ""; (new Image()).src = this.trackUrl + e + m; |
unique | 0 | if (!this.win.aniplayerPos) { this.win.aniplayerPos = {}; } this.win.aniplayerPos[a.position] = true; return true; |
3.2.2 Create Instream Tag
Instream tag is an ad and content player.
Minimal Request Example Payload :
{ "staging": { "template": "template_id", "channel": "channel_id", "publisher": "publisher_id", "posDfp1x1": false, "overrideExtensions": { "isActive": false, "preloader": { "type": 0, "clickThrough": null } }, "ref1": null }, "configsArray": null, "type": 2, "usage": null, "isDeployed": true, "status": 1, "name": "tag_name", "publisherId": "publisherId" }
Content
Parameter | Type | Description |
breakingAdsMode | 1:Slot, 2:Breaking Ads | Select from Ads Mode Type. Define when ads are displayed. |
breakingAds | Int | Time in seconds between waterfalls. Only when set to breaking ads mode. |
order | 1:Sequence, 2:Random | Order Type. |
randomFrom | Int | Define from which content number the player will start to randomize. Only when order:2 |
tagContent
| Boolean | Select for the player to only show content from the tag and not merge content from the tag and template. |
firstPrerollSlotEnable | Boolean | Set true to configure the first preroll slot. Only when set to breaking ads mode. |
Content: Slots
Parameter | Type | Description |
time | Int | Content time in seconds for an ad to start. |
firstAdTimeout | Int | Limit in seconds to find the first ad. Only when set to slot mode and firstPrerollSlot:true. |
preloadAdTime | Int | Limit in seconds to find an ad. |
maxAds | Int | Maximum number of ads player per slot. |
nextAdTimeout | Int | Time in seconds for the next ad. |
Tag with Slots Request Example Payload :
{ "type": 2, "staging": { "overrideFunctions": { "unique": { "value": " if (!this.win.aniplayerPos)\n this.win.aniplayerPos = {};\n this.win.aniplayerPos[a.position] = true;\n return true;", "isActive": false }, "findWin": { "value": "try {\n if ((!a.posDfp1x1 && !a.posClass && !a.posSelector && !a.posId && !a.posTag) || (w === top) || !w.frameElement) {\n this.doc = document;\n this.win = w;\n } else if (a.posDfp1x1 && w.frameElement) {\n this.win = parent;\n this.doc = parent.document;\n } else {\n this.win = top;\n this.doc = top.document;\n }\n } catch (f) {\n this.doc = document;\n this.win = w;\n }", "isActive": false }, "postCreate": { "value": "", "isActive": false }, "retry": { "value": " if (this.retryCnt++ > this.timeout) {\n this.track(\"AV_M3\", \"&prbdres=nopos&sn=\" + encodeURIComponent(location.href).slice(0, 400));\n return;\n }\n var that = this;\n setTimeout(function () {\n that.position();\n }, 250);\n", "isActive": false }, "create": { "value": "var d1 = document.createElement(\"div\");\n if(a.scriptId) {\n d1.className = a.scriptId;\n }\n d1.style.width = \"100%\";\n d1.style.margin = \"0 auto\";\n d1.style.maxWidth = \"\" + a.maxWidth + \"px\";\n var d2 = document.createElement(\"div\");\n d2.id = \"aniBox\";\n var d3 = document.createElement(\"div\");\n d3.id = a.position;\n if (p === this.doc || p === this.doc.head)\n p = this.doc.body;\n if (n) {\n p.insertBefore(d1, n);\n } else {\n p.appendChild(d1);\n }\n a.refDiv = p;\n d1.appendChild(d2);\n d2.appendChild(d3);\n this.postCreate(d1);", "isActive": false }, "position": { "value": "var p = this.doc;\n var isScp = false;\n if (a.posSelector) {\n try {\n var q = this.doc.querySelectorAll(a.posSelector);\n var l = 0;\n if(a.posCounter > 0) {\n l = a.posCounter - 1;\n }\n p = q[l];\n } catch (e) {\n this.track(\"AV_M3\", \"&prbdres=badpos&sn=\" + encodeURIComponent(location.href).slice(0, 400));\n return;\n }\n if (!p) {\n this.retry();\n return;\n }\n }\n if (a.posId) {\n p = this.doc.getElementById(a.posId);\n if (!p) {\n this.retry();\n return;\n }\n }\n if (a.posTag) {\n var c = a.posTag.split(\"#\");\n if (c && c.length == 2) {\n var e = p.getElementsByTagName(c[0]);\n if (e.length == 0) {\n this.retry();\n return;\n }\n p = e[Math.min(c[1] - 1, e.length - 1)];\n }\n }\n if (a.posClass) {\n var c = a.posClass.split(\"#\");\n var e = 1;\n if (c.length == 2) {\n e = c[1];\n }\n var f = p.getElementsByClassName(c[0]);\n if (f.length > 0) {\n p = f[Math.min(e - 1, f.length - 1)];\n }\n if (!p) {\n this.retry();\n return;\n }\n }\n if (a.posDfp1x1 && window.frameElement) {\n n = window.frameElement.parentNode.parentNode;\n p = n.parentNode;\n if ((frameElement.clientHeight > 5 || document.body.clientHeight > 5) && !a.nohideIframe) {\n frameElement.style.height = \"0px\";\n }\n if (a.posType == \"after\") {\n n = n.nextElementSibling;\n }\n }\n var n;\n if (p === this.doc) {\n n = this.doc.getElementById(a.scriptId);\n if (n) {\n n.id += \"-used\";\n p = n.parentNode;\n }\n }\n if (p === this.doc.head) {\n n = null;\n p = this.doc;\n }\n if (a.posType && a.posType !== \"in\" && !n) {\n if (a.posType === \"after\" && p.nextElementSibling) {\n n = p.nextElementSibling;\n } else {\n n = null;\n }\n p = p.parentNode;\n }\n if (p) {\n if (!p.av_setpos) {\n p.av_setpos = {};\n }\n if (!p.av_setpos[a.position]) {\n p.av_setpos[a.position] = true;\n a.position += \"-\" + Date.now();\n this.create(p, n);\n this.load();\n } else {\n this.track(\"AV_M3\", \"&prbdres=duppos&sn=\" + encodeURIComponent(location.href).slice(0, 400));\n }\n }\n", "isActive": false }, "load": { "value": "var that = this;\n this.getAttr();\n var loadCounter = 0;\n var scp = this.doc.createElement(\"script\");\n scp.src = \"https://player.avplayer.com/script/2/v/avcplayer.js\";\n function checkIfLoad() {\n if(++loadCounter > 1) {\n that.start();\n }\n }\n scp.onload = function() {\n scp.onload = null;\n checkIfLoad();\n };\n scp.async = true;\n this.fetchContent(checkIfLoad);\n this.doc.body.appendChild(scp)", "isActive": false }, "postStart": { "value": "", "isActive": false }, "getAttr": { "value": "if (a.scriptId) {\n var s = document.getElementById(a.scriptId) || document.getElementById(a.scriptId + \"-used\");\n if (s) {\n for (var i = 0, t = s.attributes; i < s.attributes.length; i++) {\n if (t[i].nodeName && t[i].nodeName.indexOf(\"data-\") == 0) {\n var n = t[i].nodeName.replace(/^data-/, \"\").replace(/[-_]+?(\\w)/g, function (_, letter) { return letter.toUpperCase(); }).split(\".\");\n var lastProp = n.pop();\n try {\n var innerConfig = n.reduce(function (a, prop) { return a[prop]; }, a);\n innerConfig[lastProp] = t[i].nodeValue;\n } catch(e) {\n }\n }\n }\n if (s.src) {\n var p = s.src.indexOf(\"?\");\n if (p > 10) {\n var r = (s.src.substring(p + 1, s.src.length));\n a.adConfig.ref1 = (a.adConfig.ref1 || \"\") + \"&\" + (r || \"\");\n }\n }\n }\n }", "isActive": false }, "start": { "value": "var player;\n this.getAttr();\n try {\n if (this.win._avcp) {\n player = new this.win._avcp(a);\n } else if (window._avcp) {\n player = new _avcp(a);\n } else {\n player = new top._avcp(a);\n }\n } catch (exp) {\n player = new _avcp(a);\n }\n this.p = player;\n if (this.pbjs && this.pbjs.preparePlayer) {\n this.pbjs.preparePlayer(player, st);\n }\n if(a.playerApi && typeof this.win[a.playerApi] === \"function\" ) {\n try{\n this.win[a.playerApi](a, player);\n } catch(ex){}\n }\n player.nextContent();\n this.postStart(player);", "isActive": false }, "preRun": { "value": "", "isActive": false }, "run": { "value": " this.config = a = config = this.getConfig();\n this.a = this.config;\n this.getAttr();\n this.preRun();\n this.findWin();\n if (!this.doc.body) {\n this.doc.addEventListener(\"DOMContentLoaded\", function () {\n st.run();\n });\n if (this.bodyRetry > 0) {\n setTimeout(function () {\n st.run();\n }, 250);\n this.domRetry--;\n }\n return;\n }\n if (a.configApi && typeof this.win[a.configApi] === \"function\") {\n try {\n this.win[a.configApi](a);\n } catch (ex) {\n }\n }\n if (this.unique() && !this.loaded) {\n this.loaded = true;\n this.track(\"playerLoaded\");\n this.retryCnt = 0;\n this.timeout = a.posTimeout || 40;\n this.pbjs = window.aniviewRenderer && window.aniviewRenderer.units && window.aniviewRenderer.units[a.scriptId];\n if (this.pbjs && this.pbjs.prepareConfig) {\n this.pbjs.prepareConfig(a, st);\n }\n this.position();\n }", "isActive": false }, "target": { "value": " if (this.sp) {\n return\n }\n var ua = navigator.userAgent || navigator.vendor || window.opera;\n var uav = navigator.appVersion ? navigator.appVersion.toLowerCase() : \"\";\n var op = 2;\n if (/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(ua) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(ua.substr(0, 4))) {\n op = 1;\n } else {\n if (/web0s|webos|tizen/i.test(uav)) {\n op = 4;\n }\n }\n this.op = op;", "isActive": false }, "track": { "value": " if (!this.trackUrl) {\n this.trackUrl = \"https://\" + (a.trackDomain || \"track1.aniview.com\") + \"/track?pid=\" + a.adConfig.publisherId + \"&cid=\" + a.adConfig.channelId + \"&cb=\" + Date.now() + \"&r=\" + location.host + \"&stagid=\" + (a.tagId || \"\") + \"&stplid=\" + (a.templateId || \"\") + \"&d35=\" + (a.adConfig.sabTest || \"\") + \"&e=\";\n }\n m = m ? m : \"\";\n (new Image()).src = this.trackUrl + e + m;\n", "isActive": false }, "fetchContent": { "value": "if(a.content && (a.content.cmsId && a.content.cmsType)) {\n a.content.contentFeed = \"https://\" + (a.cmsFeedDomain || \"feed.avplayer.com\") + \"/backend/get?cmsType=\" + a.content.cmsType + \"&id=\" + a.content.cmsId\n }\n if (a.content.contentFeed) {\n var xhr = new XMLHttpRequest();\n xhr.open(\"GET\", a.content.contentFeed, true);\n xhr.onload = function () {\n xhr.onload = null;\n try {\n var json = JSON.parse(xhr.responseText);\n if (json && json.playlist) {\n a.content.contents = json.playlist;\n }\n } catch (e) {\n }\n callback();\n };\n xhr.send();\n } else {\n callback();\n }", "isActive": false } }, "overrideExtensions": {}, "position": { "value": "", "number": 1 }, "publisher": "publisher", "posDfp1x1": false, "channel": "channel", "template": "template" }, "content": { "breakingAdsMode": 1, "commonSlots": [ { "time": 3, "firstAdTimeOut": 1, "preloadAdTime": 2, "maxAds": 4, "nextAdTimeout": 5 } ], "type": 0, "order": 1, "firstPrerollSlotEnable": true, "firstPrerollSlot": { "firstAdTimeOut": 1, "preloadAdTime": 2, "maxAds": 3, "nextAdTimeout": 4 } }, "name": "slot" }
Tag with Breaking Ads Request Example Payload :
{ "type": 2, "staging": { "overrideFunctions": { "unique": { "value": " if (!this.win.aniplayerPos)\n this.win.aniplayerPos = {};\n this.win.aniplayerPos[a.position] = true;\n return true;", "isActive": false }, "findWin": { "value": "try {\n if ((!a.posDfp1x1 && !a.posClass && !a.posSelector && !a.posId && !a.posTag) || (w === top) || !w.frameElement) {\n this.doc = document;\n this.win = w;\n } else if (a.posDfp1x1 && w.frameElement) {\n this.win = parent;\n this.doc = parent.document;\n } else {\n this.win = top;\n this.doc = top.document;\n }\n } catch (f) {\n this.doc = document;\n this.win = w;\n }", "isActive": false }, "postCreate": { "value": "", "isActive": false }, "retry": { "value": " if (this.retryCnt++ > this.timeout) {\n this.track(\"AV_M3\", \"&prbdres=nopos&sn=\" + encodeURIComponent(location.href).slice(0, 400));\n return;\n }\n var that = this;\n setTimeout(function () {\n that.position();\n }, 250);\n", "isActive": false }, "create": { "value": "var d1 = document.createElement(\"div\");\n if(a.scriptId) {\n d1.className = a.scriptId;\n }\n d1.style.width = \"100%\";\n d1.style.margin = \"0 auto\";\n d1.style.maxWidth = \"\" + a.maxWidth + \"px\";\n var d2 = document.createElement(\"div\");\n d2.id = \"aniBox\";\n var d3 = document.createElement(\"div\");\n d3.id = a.position;\n if (p === this.doc || p === this.doc.head)\n p = this.doc.body;\n if (n) {\n p.insertBefore(d1, n);\n } else {\n p.appendChild(d1);\n }\n a.refDiv = p;\n d1.appendChild(d2);\n d2.appendChild(d3);\n this.postCreate(d1);", "isActive": false }, "position": { "value": "var p = this.doc;\n var isScp = false;\n if (a.posSelector) {\n try {\n var q = this.doc.querySelectorAll(a.posSelector);\n var l = 0;\n if(a.posCounter > 0) {\n l = a.posCounter - 1;\n }\n p = q[l];\n } catch (e) {\n this.track(\"AV_M3\", \"&prbdres=badpos&sn=\" + encodeURIComponent(location.href).slice(0, 400));\n return;\n }\n if (!p) {\n this.retry();\n return;\n }\n }\n if (a.posId) {\n p = this.doc.getElementById(a.posId);\n if (!p) {\n this.retry();\n return;\n }\n }\n if (a.posTag) {\n var c = a.posTag.split(\"#\");\n if (c && c.length == 2) {\n var e = p.getElementsByTagName(c[0]);\n if (e.length == 0) {\n this.retry();\n return;\n }\n p = e[Math.min(c[1] - 1, e.length - 1)];\n }\n }\n if (a.posClass) {\n var c = a.posClass.split(\"#\");\n var e = 1;\n if (c.length == 2) {\n e = c[1];\n }\n var f = p.getElementsByClassName(c[0]);\n if (f.length > 0) {\n p = f[Math.min(e - 1, f.length - 1)];\n }\n if (!p) {\n this.retry();\n return;\n }\n }\n if (a.posDfp1x1 && window.frameElement) {\n n = window.frameElement.parentNode.parentNode;\n p = n.parentNode;\n if ((frameElement.clientHeight > 5 || document.body.clientHeight > 5) && !a.nohideIframe) {\n frameElement.style.height = \"0px\";\n }\n if (a.posType == \"after\") {\n n = n.nextElementSibling;\n }\n }\n var n;\n if (p === this.doc) {\n n = this.doc.getElementById(a.scriptId);\n if (n) {\n n.id += \"-used\";\n p = n.parentNode;\n }\n }\n if (p === this.doc.head) {\n n = null;\n p = this.doc;\n }\n if (a.posType && a.posType !== \"in\" && !n) {\n if (a.posType === \"after\" && p.nextElementSibling) {\n n = p.nextElementSibling;\n } else {\n n = null;\n }\n p = p.parentNode;\n }\n if (p) {\n if (!p.av_setpos) {\n p.av_setpos = {};\n }\n if (!p.av_setpos[a.position]) {\n p.av_setpos[a.position] = true;\n a.position += \"-\" + Date.now();\n this.create(p, n);\n this.load();\n } else {\n this.track(\"AV_M3\", \"&prbdres=duppos&sn=\" + encodeURIComponent(location.href).slice(0, 400));\n }\n }\n", "isActive": false }, "load": { "value": "var that = this;\n this.getAttr();\n var loadCounter = 0;\n var scp = this.doc.createElement(\"script\");\n scp.src = \"https://player.avplayer.com/script/2/v/avcplayer.js\";\n function checkIfLoad() {\n if(++loadCounter > 1) {\n that.start();\n }\n }\n scp.onload = function() {\n scp.onload = null;\n checkIfLoad();\n };\n scp.async = true;\n this.fetchContent(checkIfLoad);\n this.doc.body.appendChild(scp)", "isActive": false }, "postStart": { "value": "", "isActive": false }, "getAttr": { "value": "if (a.scriptId) {\n var s = document.getElementById(a.scriptId) || document.getElementById(a.scriptId + \"-used\");\n if (s) {\n for (var i = 0, t = s.attributes; i < s.attributes.length; i++) {\n if (t[i].nodeName && t[i].nodeName.indexOf(\"data-\") == 0) {\n var n = t[i].nodeName.replace(/^data-/, \"\").replace(/[-_]+?(\\w)/g, function (_, letter) { return letter.toUpperCase(); }).split(\".\");\n var lastProp = n.pop();\n try {\n var innerConfig = n.reduce(function (a, prop) { return a[prop]; }, a);\n innerConfig[lastProp] = t[i].nodeValue;\n } catch(e) {\n }\n }\n }\n if (s.src) {\n var p = s.src.indexOf(\"?\");\n if (p > 10) {\n var r = (s.src.substring(p + 1, s.src.length));\n a.adConfig.ref1 = (a.adConfig.ref1 || \"\") + \"&\" + (r || \"\");\n }\n }\n }\n }", "isActive": false }, "start": { "value": "var player;\n this.getAttr();\n try {\n if (this.win._avcp) {\n player = new this.win._avcp(a);\n } else if (window._avcp) {\n player = new _avcp(a);\n } else {\n player = new top._avcp(a);\n }\n } catch (exp) {\n player = new _avcp(a);\n }\n this.p = player;\n if (this.pbjs && this.pbjs.preparePlayer) {\n this.pbjs.preparePlayer(player, st);\n }\n if(a.playerApi && typeof this.win[a.playerApi] === \"function\" ) {\n try{\n this.win[a.playerApi](a, player);\n } catch(ex){}\n }\n player.nextContent();\n this.postStart(player);", "isActive": false }, "preRun": { "value": "", "isActive": false }, "run": { "value": " this.config = a = config = this.getConfig();\n this.a = this.config;\n this.getAttr();\n this.preRun();\n this.findWin();\n if (!this.doc.body) {\n this.doc.addEventListener(\"DOMContentLoaded\", function () {\n st.run();\n });\n if (this.bodyRetry > 0) {\n setTimeout(function () {\n st.run();\n }, 250);\n this.domRetry--;\n }\n return;\n }\n if (a.configApi && typeof this.win[a.configApi] === \"function\") {\n try {\n this.win[a.configApi](a);\n } catch (ex) {\n }\n }\n if (this.unique() && !this.loaded) {\n this.loaded = true;\n this.track(\"playerLoaded\");\n this.retryCnt = 0;\n this.timeout = a.posTimeout || 40;\n this.pbjs = window.aniviewRenderer && window.aniviewRenderer.units && window.aniviewRenderer.units[a.scriptId];\n if (this.pbjs && this.pbjs.prepareConfig) {\n this.pbjs.prepareConfig(a, st);\n }\n this.position();\n }", "isActive": false }, "target": { "value": " if (this.sp) {\n return\n }\n var ua = navigator.userAgent || navigator.vendor || window.opera;\n var uav = navigator.appVersion ? navigator.appVersion.toLowerCase() : \"\";\n var op = 2;\n if (/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(ua) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(ua.substr(0, 4))) {\n op = 1;\n } else {\n if (/web0s|webos|tizen/i.test(uav)) {\n op = 4;\n }\n }\n this.op = op;", "isActive": false }, "track": { "value": " if (!this.trackUrl) {\n this.trackUrl = \"https://\" + (a.trackDomain || \"track1.aniview.com\") + \"/track?pid=\" + a.adConfig.publisherId + \"&cid=\" + a.adConfig.channelId + \"&cb=\" + Date.now() + \"&r=\" + location.host + \"&stagid=\" + (a.tagId || \"\") + \"&stplid=\" + (a.templateId || \"\") + \"&d35=\" + (a.adConfig.sabTest || \"\") + \"&e=\";\n }\n m = m ? m : \"\";\n (new Image()).src = this.trackUrl + e + m;\n", "isActive": false }, "fetchContent": { "value": "if(a.content && (a.content.cmsId && a.content.cmsType)) {\n a.content.contentFeed = \"https://\" + (a.cmsFeedDomain || \"feed.avplayer.com\") + \"/backend/get?cmsType=\" + a.content.cmsType + \"&id=\" + a.content.cmsId\n }\n if (a.content.contentFeed) {\n var xhr = new XMLHttpRequest();\n xhr.open(\"GET\", a.content.contentFeed, true);\n xhr.onload = function () {\n xhr.onload = null;\n try {\n var json = JSON.parse(xhr.responseText);\n if (json && json.playlist) {\n a.content.contents = json.playlist;\n }\n } catch (e) {\n }\n callback();\n };\n xhr.send();\n } else {\n callback();\n }", "isActive": false } }, "overrideExtensions": {}, "position": { "value": "", "number": 1 }, "publisher": "publisher", "posDfp1x1": false, "channel": "channel", "template": "template" }, "content": { "breakingAdsMode": 2, "commonSlots": [ { "time": 0 } ], "type": 0, "order": 1, "breakingAds": 15 }, "name": "test123" }
3.2.3 Generate Tag Script
Short Tag
Short Tag is a script element that can be applied directly on the publisher's site. If the tag created does not include a position the player will open in the location the element is implemented at.
<script async id="AV${Tag_ID}" type="text/javascript" src="https://tg1.aniview.com/api/adserver/spt?AV_TAGID=${Tag_ID}&AV_PUBLISHERID=${Publisher_ID}"></script>
Full Tag
Full tag is the full script that is loading the player to the page.
Request URL:
https://tg1.aniview.com/api/adserver/spt?AV_PUBLISHERID=${Publisher_ID}&AV_TAGID=${Tag_ID}&id=AV_${Tag_ID}
Request Method:
GET
Status Code:
200 OK
Parameter | Description |
AV_PUBLISHERID | Publisher ID |
AV_TAGID | Tag ID |
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
Preroll