AdPlayer.Pro Whitelabel Standalone Script Reference

This article acts a reference to the Whitelabel Standalone Script configuration options AdPlayer.Pro supports, regarding the player instance, what media to play, how to layout and behave on page.

Script Parameters Overview

AdPlayer.Pro supports a wide range of HTML5 player formats:

NB! JavaScript Object Notation (JSON) is required in the syntax of the setup blocks. Please beware of the common JSON requirements, e.g. the need for a comma after all but the last element in a list, while configuring the standalone script setup.

Script Parameters Configuration Reference

 

Parameter Description Value
"muted"
Configures whether the player is muted during playback start or not.
true/false
"autoStart"
Configures whether the player attempts to begin playback automatically on pageload or not.
true/false
"width"
Сonfigures the player width:

Static player size – in pixels
Flexible player size – as parent element percentage*

*If aspect ratio is configured – ONLY flexible player size applied (i.e. width MUST be configured as percentage).

number/number%
"height"
Сonfigures the player height*, in pixels.

*If aspect ratio is configured – NOT applied.

number
"aspectratio"
ONLY for flexible player size.

Configures proportions between the player width and height, if player width is configured as percentage, in the following format: x:y, where:

x refers to the player width,
y refers to the player height.

x:y
"soundByHover"
Configures the sound switch-on onhover.
true/false
"tapToUnmute"
Configures the “Tap to Unmute” button display.
true/false
"type"
Configures the player type:

InPage

InView

InBanner

Rewarded

Instream

inPage

inView

inBanner

rewarded

inStream
"file"
Configures the​ direct download link (URL) to a​ video file​ that should play upon ad completion​.

Example:

"file": "https://adplayer.pro/video/1.mp4"
string
"advertising": {
The inner JSON object that configures video ad capabilities and contains a number of setup options.

See below for more details.

"tag"
The “tag” :[ parameter is a sequence of specific configuration parameters.

Example:

"tag":[{"url":"https://adplayer.pro/vast/demo.xml","client":"vast",
"file":true}]

See below for more details.

Parameter Description Value
"url"
The demand tag URL that should be loaded in player.

Example:

"url":"https://adplayer.pro/vast/demo.xml"
string
"client"
Configures the ad format:

for VAST/VPAID ads: vast

for Google IMA ads: googima

vast/googima
"type"
Configures Demand Tag type:

URL
Header Bidding

url/bidding
"file"
URL to a video file that should play upon ad completion.

Example:

"file":"https://adplayer.pro/video/1.mp4"
string
"rotation"
Configures assigned demand rotation switch-on/off.

Default: true

true/false
"replay"
Configures assigned demand replay switch-on/off.

Default: true

true/false
"adBreakSchedule"
Optional.

ONLY applicable for InStream format.

"types"
Configures the video ad format for the scheduled ad break/s:

  1. Pre-Roll
  2. Mid-Roll
  3. Post-Roll

Tip! Enter one or more types to schedule one or multiple ad breaks, accordingly.

Example:

"types": [
               "PRE",
               "MID",
               "POST"
           ],

PRE
MID
POST

"startOn"
ONLY applicable for Mid-Roll ad breaks.

Configures timing in the video (in seconds), where the ad break is scheduled to occur.

Tip! Add values, separated by commas, for multiple ad breaks, ad different time.

Example:

"startOn": "10,20"
string
"startOnPercent"
ONLY applicable for Mid-Roll ad breaks.

Configures timing in the video (in % of the video), where the ad break is scheduled to occur.

Example:

"startOnPercent": "30"
number
"requestTimeout"
Configures ad server response timeout (in milliseconds) for ad request.
number
"creativeTimeout"
Configures ad server response timeout (in milliseconds) for ad impression, upon the ad tag response.
number
"bestTimeout"
Configures ad server response timeout (in milliseconds) for the top-ranked ad tag, provided there’s at least one ad server response already returned via lower-ranked ad tags.
number
"position"
Required for the InView player.

Configures the InView player position – on top or bottom of the page:

Top right (TR)

Top left (TL)

Top center (TC)

Bottom right (BR)

Bottom left (BL)

Bottom center BC (BC)

Example:

“position”: “TR”

TR/TL/TC

BR/BL/BC
"showPercent"
ONLY for InPage and InBanner formats.

InPage – both Show & Play parameters are required.
InBanner – only the Play parameter is required.

Configures the player part in-view (in %), required to show the player and launch the video ad content.

number
"playPercent"
"closeButton"
Configures whether the “close ad” (“X”) button is added during ad playback or not.
true/false
"closeDelay"
Configures delay (in seconds) before “close ad” (“X”) button display.
number, ≥ 0
"barColor"*
*Optional.

Сonfigures ad progress bar color.

Example:

"barColor":"#2e95ff"
color code
"skipOffset"
Сonfigures the ad skip offset in seconds.

Example:

"skipOffset": "1"
number, ≥ 0
"rotation"
Configures how many times Demand Tags are re-requested.

Example:

"rotation": 2
number, >0
"replay"
ONLY for InPage, InView and InBanner formats.

Configures the number of ads replayed (in addition to the 1st ad impression).

Examples:

"replay": 3
"replay": true //infinite ad replay
true/number, >0
"lifecycleLoop"
Configures the player loop: i.e. the number of player lifecycles in a loop (in addition to the 1st player lifecycle).

Examples:

"lifecycleLoop": 2
"lifecycleLoop": true //infinite loop
true/number, >0
"forceFile"
Configures the switch-on of video content playback – regardless of the ad response.
true/false
"defaultTag"
Configures the default tag (banner, image tag, etc.), applied in case of the following:


1) IF no video content URL added, when no video ad tag was processed (due to ad error, or else).
2) IF no video ad tags were added/switched on.

string 
(JavaScript)
"sticky"
ONLY applied for InPage ad format.

Implies the player sticks to the viewable area of the page on article/page scroll.

true/false
"stickyWidth"
ONLY applied for Sticky.
Specifies the Sticky player width in pixels.
number
"stickyHeight"
ONLY applied for Sticky.
Specifies the Sticky player height in pixels.
number
"copyrightText"
ONLY for InBanner format.

Configures the displayed copyright text.

Usually: Powered by

string
"copyrightLink"
ONLY for InBanner format.

Configures the webpage, opened onclick the copyright icon.

string
"copyrightIcon"
ONLY for InBanner format.

Configures the image source for the copyright icon.

string
(Base64/URL)
"watermarkLink"
Configures the webpage, opened onclick the watermark icon.
string
"watermarkIcon"
Configures the image source for the waterlink icon.
string
(Base64/URL)
"sequential"
Configures the sequential waterfall switch-on/off.
true/false
"errorMessage"
Configures the error message describing what went wrong.

Example:

"errorMessage": "Preview is not available"
string

 

AdPlayer.Pro Macros

 

Macros Description Value
$$WIDTH$$
Returns the player width, in pixels.

number
$$HEIGHT$$
Returns the player height, in pixels.

number
$$REFERER$$
Returns the webpage data, where the ad is served. Example: domain.com/page string
$$REFERER_DOMAIN$$
Returns the domain’s hostname, where the ad is served. string
$$CLIENT_USER_AGENT$$
Returns the сlient’s user agent data (navigator.userAgent). string
$$RANDOM$$
Returns the random numeric string. number
$$PUB_ID$$
Returns the publisher’s website ID. string
$$PLACEMENT_ID$$
Returns the ad placement ID string
$$TIMESTAMP$$
Returns the current time, in milliseconds. number
$$REMOTE_IP$$
Returns the client’s IP address data. string
$$REMOTE_COUNTRY$$
Returns the client’s country code. string
$$REMOTE_COUNTRY_NAME$$
Returns the client’s country name in full. string
$$LAT$$
Passes user’s location latitude (also applicable for “appLat” parameter, specified in JS code). number
$$LON$$
Passes user’s location longitude (also applicable for “appLon” parameter, specified in JS code). number
$$APP_BUNDLE$$
Passes mobile app bundle name (“appBundle” parameter value, specified in JS code). string
$$DNT$$
Passes true/false value for “Do Not Track” parameter ("dnt" parameter value, specified in JS code). 0/1
$$APP_NAME$$
Passes mobile app name ("appName" parameter value, specified in JS code). string
$$APP_STORE_URL$$
Passes link to mobile app page on the app store ("appStoreUrl" parameter value, specified in JS code). URL
$$APP_VERSION$$
Passes mobile app version ("appVersion" parameter value, specified in JS code). string
$$DEVICE_ID$$
Passes mobile device ID ("deviceId" parameter value, specified in JS code). string
$$DEVICE_MAKE$$
Passes mobile device manufacturer name ("deviceMake" parameter value, specified in JS code). string
$$C_PARAM_NAME$$
Passes the custom parameter ("paramName" parameter value, specified in JS code).

Examples:

$$C_DEVICE_WIDTH$$
$$C_DEVICE_HEIGHT$$

string

 

Code Examples

Your dedicated account manager will provide you with the default JS code for further use and customization (see Script Parameters Configuration Reference).

Example 1: InPage


<script src="https://cdn.stat-rock.com/player/demo.js""></script><script>(function(){
    document.write("<div id='NQnZsTCfCv1TVOZeJTaLZjM9zzUJ240XenGSYnKSUhpgalBwQaIT'></div>");
    AdPlayerPro('NQnZsTCfCv1TVOZeJTaLZjM9zzUJ240XenGSYnKSUhpgalBwQaIT').setup({
    "muted": true,
    "autoStart": true,
    "width": "50%",
    "height": "",
    "soundByHover": true,
    "type": "inPage",
    "advertising": {
        "tag": [
            {
                "url": "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/
ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpreonly&cmsid=496&vid=short_onecue&correlator",
                "client": "googima",
                "type": "bidding",
                "rotation": true,
                "replay": true
                }
        ],
       "requestTimeout": 10000,
       "creativeTimeout": 5000,
       "bestTimeout": 2000,
        "position": "BR",
        "showPercent": 30,
        "playPercent": 30,
        "closeButton": true,
        "closeDelay": 3,
        "barColor": "#2e95ff",
        "skipOffset": 3,
        "defaultTag": "\x3cscript\x3emy_js_logic\x3c/script\x3e",
        "sticky": true,
        "stickyWidth": "420",
        "stickyHeight": "320",
        "rotation": 2,
        "copyrightText": "copyright_text",
        "copyrightLink": "https://copyright_link.com",
        "copyrightIcon": "https://copyright_icon_link.com",
        "watermarkLink": "https://watermark_link.com",
        "watermarkIcon": "https://watermark_icon.com",
        "sequential": true
       },
"tapToUnmute": true,
"aspectratio": "16:9"

})
})();</script>

Example 2: InStream


<script src="https://cdn.stat-rock.com/player/demo.js""></script><script>(function(){
    document.write("<div id='NQnZsTCfCv1TVOZeJTaLZjM9zzUJ240XenGSYnKSUhpgalBwQaIT'></div>");
    AdPlayerPro('NQnZsTCfCv1TVOZeJTaLZjM9zzUJ240XenGSYnKSUhpgalBwQaIT').setup({
    "autoStart": true,
    "width": "480",
    "height": "360",
    "type": "inStream",
    "file": "https://www.4sync.com/web/directDownload/OzfN6a6s/K5U1HUwJ.bf74ebcb5311cd6f0e79b2b1c7f23408",
    "advertising": {
        "tag": [
            {
                "id": "60_bk0OWkF-VrTPLX6w-Cm35O-tP2PxcxbAzpC31bL_4UyxtCnLZ",
                "url": "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/
ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpreonly&cmsid=496&vid=short_onecue&correlator",
                "client": "googima",
                "type": "url",
                "rotation": true,
                "replay": true
                 "vtId": "6CDSieAnoW-o7BO2R9nywlLQXOgg1jG_779wDgOOfH_6PA0bn5Ci"
           }
             ],
        "skipOffset": 3,
        "rotation": 2,
        "replay": 3,
        "copyrightText": "copyright_text",
        "copyrightLink": "https://copyright_link.com",
        "copyrightIcon": "https://copyright_icon_link.com",
        "watermarkLink": "https://watermark_link.com",
        "watermarkIcon": "https://watermark_icon.com",
        "sequential": true
        },
"tapToUnmute": false

})
})();</script>

Tip! Manage streaming video content programmatically by changing the "file" parameter value (url).