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:

  1. InPage
  2. InView
  3. InBanner
  4. Rewarded
  5. Instream
inPage
inView
inBanner
rewarded
inStream
Parameter Description Value
"file"
Configures video content that plays upon ad completion:

  1. direct download link (URL) to a​ video file​

Example:

"file": "https://adplayer.pro/video/1.mp4"
  1. JSON object that contains a number of setup parameters (“rss” or “playlist” – see below).
string/JSON
"file" : {

 

"type"
Configures the type of video content sequence, if the “file” parameter is a JSON object:

  1. “rss” – refers to an RSS Feed (see a list of specific setup parameters below);

Example:

"file": {
     "type":"rss"
      ...
},
  1. “playlist” – refers to a playlist of videos (see a list of specific setup parameters
    below).

Example:

"file": {
     "type":"playlist"
      ...
},
string

Available setup parameters for RSS Feed

"file" : {

 

"limit"
Configures the maximum number of RSS feed posts enabled for display in-between ad requests.

Default value: 5

number
"file" : {

 

"url"
Configures the RSS Feed URL.

Example:

"file": {
    "type":"rss",
    "limit": "5",
    "url": "/player/xml/rss/jpostParsePage.com.rss.xml",
    ...
    },
string
"file " : {

 

"speed"
Configures the RSS feed post duration in seconds.

Default value: 6

number
"file" : {

 

"parsePage"
Optional.
If ON, switches webpage parsing for images, if there are no images in the RSS Feed.

Note! The “parsePage” parameter will only work in case the custom parser script is applied (i.e.
see the “parser” parameter below), and may increase server load.

true/false
"file" : {

 

"parser"
Optional. 
If added, configures the custom script for parsing webpage content. If missing, the following default parser
script is applied:

{
  title: function () {
    return $item.find('title').text();
  },
  link: function () {
    return $item.find('link').text();
  },
  img: function () {
    return $("<b>" + $item.find('description').text()
    + '</b>').find('img').attr('src');
  }
},

The parser script supports the following variables: 

  1. parser – object
  2. $ – jquery
  3. $item – jquery object. Refers to the item from RSS Feed
  4. page (undefined by default) – HTML string. Refers to the webpage where the item is located
  5. $page (undefined by default) – jquery object. Refers to the webpage where the item is
    located

EXAMPLE, with a custom parser script, used for parsing images on the webpage (actual script may
differ):

"file": {
           "type": "rss",
           "limit": "5",
           "url": "/player/xml/rss/jpostParsePage.com.rss.xml",
           "parsePage": "true",
           "parser":
             "parser.img = function () { return $("<b>" 
             + $item.find("description").text() 
             + "</b>").find("img").attr("src") 
             || ($page && $page.find(".article-image img").attr("src"))}"
      },
string (Javascript)

Available setup parameters for video playlists

"file" : {

 

"name"
Configures the video playlist name.
Example:

"file": {
    "type":"playlist",
    "name": "MyPlaylist",
    "playlist": [ … ]
       },
string
"file" : {

 

"playlist": []
For each video file in the playlist, you can configure the following parameters:

  1. “file” – URL. Configures the direct download link to the video file.
  2. “duration” – number. Configures video duration in seconds.
  3. “title” – string. Refers to the title of the video.
  4. “image” – URL. Configures the direct link to a thumbnail image.
  5. “description” – string. Configures a video file description (the est. limit of characters
    is ~2 lines max., but this value may differ depending on the platform/screen size).

Example:

"file": {
    "type":"playlist",
    "playlist": [
        {"file": "https://adplayer.pro/video/1.mp4",
         "duration": "10",
         "title": "One",
         "image": "https://adplayer.pro/img/1.jpg",
         "description": "This is Video One"},
        {"file": "https://adplayer.pro/video/2.mp4",
        ...
         }
      ]
  },

string
Parameter Description Value
 "tracks": [{
Sequence of parameters, configuring the display of image thumbnails in video (VTT).

See below.

 "tracks": [{

 

"file"
Configures the URL to the externally hosted *.vtt file.
Example:

"file": "https://example.com/preview.vtt"
           
string
 "tracks": [{

 

"kind"
Optional.
Configures the VTT type.
Example:

"kind": "thumbnails"
           
string
"forceFile"
Configures the switch-on of video content playback – regardless of the ad response.
true/false
"videoCloseButton"
Сonfigures the “close” button (“X”) display on a video file that plays upon ad completion.
true/false
"margin"
ONLY applied for InPage ad format. NOT applicable for the Sticky player mode.Configures the
margin area for the InPage ad placement on all four sides – i.e. top, right, bottom and left.

Tip! Follow the instructions on how to apply advanced CSS margin settings here.

string
"errorMessage"
Configures the error message describing what went wrong.

Example:

"errorMessage": "Preview is not available"
string
Parameter Description Value
"advertising"
The inner JSON object that configures video ad capabilities and contains a number of setup options.

See below for more details.

"advertising" : {

 

"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.

"advertising" : {

 

"tag" : [{

 

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

Example:

"url":"https://adplayer.pro/vast/demo.xml"

Note! For a YouTube Demand type, add the JSON with the video ID instead of the URL.

Tip! The video ID includes 11 characters and is located after the / in the YouTube video URL
(i.e. https://youtu.be/thisisaVdID).
Example:

"tag": [
           {
               "url": "{\"videoId\":\"thisisaVdID\"}",
               "type": "youtube",
               …
           }
         ]
string
"advertising" : {

 

"tag" : [{

 

"client"
Configures the ad format:

for VAST/VPAID ads: vast

for Google IMA ads: googima

vast/googima
"advertising" : {

 

"tag" : [{

 

"type"
Configures Demand Tag type:

URL
Header Bidding

url/bidding
"advertising" : {

 

"tag" : [{

 

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

Example:

"file":"https://adplayer.pro/video/1.mp4"
string
"advertising" : {

 

"tag" : [{

 

"rotation"
Configures assigned demand rotation switch-on/off.

Default: true

true/false
"advertising" : {

 

"tag" : [{

 

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

Default: true

true/false
Parameter Description Value
"advertising" : {

 

"breakSchedule"
Optional.

ONLY applicable for InStream format.

"advertising" : {

 

"breakSchedule" : [{

 

"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
"advertising" : {

 

"breakSchedule" : [{

 

"replay"
Configures ad replay for each ad break separately, including Pre-Roll, Mid-Roll and Post-Roll.

Note! If the Ad Break/s Replay is configured, the Replay settings for the ad break/s will
override the Replay settings on the Ad Placement level.

Example:

"replay": 1
number
"advertising" : {

 

"breakSchedule" : [{

 

"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
"advertising" : {

 

"breakSchedule" : [{

 

"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
"advertising" : {

 

"breakScheduleType"
Optional.

ONLY applicable for InStream format. 
Configures the scheduled ad break/s for a specific Demand, assigned to the ad placement.

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

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

Note! If ad break schedule settings for the ad placement and the specific Demand, assigned to it,
are conflicting, the ad break may NOT be scheduled.

Example:

 "breakScheduleType": [
                    "PRE",
                    "MID",
                    "POST"
                ],
PRE
MID
POST
Parameter Description Value
"advertising" : {

 

"requestTimeout"
Configures ad server response timeout (in milliseconds) for ad request.
number
"advertising" : {

 

"creativeTimeout"
Configures ad server response timeout (in milliseconds) for ad impression, upon the ad tag response.
number
"advertising" : {

 

"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
"advertising" : {

 

"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
"advertising" : {

 

"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
"advertising" : {

 

"playPercent"
"advertising" : {

 

"closeButton"
Configures whether the “close ad” (“X”) button is added during ad playback or not.
true/false
"advertising" : {

 

"closeDelay"
Configures delay (in seconds) before “close ad” (“X”) button display.
number, ≥ 0
"advertising" : {

 

"barColor"*
*Optional.

Сonfigures ad progress bar color.

Example:

"barColor":"#2e95ff"
color code
"advertising" : {

 

"controls"
ONLY applied for Google IMA Demand Tags

If true, adds playback controls to the advertising content, including a Play/Pause button, a volume slider and a full-screen mode option.

Default value: false

true/false
"advertising" : {

 

"skipOffset"
Сonfigures the ad skip offset in seconds.

Example:

"skipOffset": "1"
number, ≥ 0
"advertising" : {

 

"rotation"
Configures how many times Demand Tags are re-requested.

Example:

"rotation": 2
number, >0
"advertising" : {

 

"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
"advertising" : {

 

"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
"advertising" : {

 

"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)
"advertising" : {

 

"sticky"
ONLY applied for InPage and InBanner ad formats.

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

true/false
"advertising" : {

 

"stickyWidth"
ONLY applied for Sticky.
Specifies the Sticky player width in pixels.
number
"advertising" : {

 

"stickyHeight"
ONLY applied for Sticky.
Specifies the Sticky player height in pixels.
number
"advertising" : {

 

"copyrightText"
ONLY for InBanner format.

Configures the displayed copyright text.

Usually: Powered by

string
"advertising" : {

 

"copyrightLink"
ONLY for InBanner format.

Configures the webpage, opened onclick the copyright icon.

string
"advertising" : {

 

"copyrightIcon"
ONLY for InBanner format.

Configures the image source for the copyright icon.

string
(Base64/URL)
"advertising" : {

 

"watermarkLink"
Configures the webpage, opened onclick the watermark icon.
string
"advertising" : {

 

"watermarkIcon"
Configures the image source for the waterlink icon.
string
(Base64/URL)
"advertising" : {

 

"sequential"
Configures the sequential waterfall switch-on/off.
true/false

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
$$GDPR$$
Passes an identifier 0 (no/-) or 1 (yes), if GDPR is required.

Used in tandem with the $$GDPR_CONSENT$$ macro.

Note! You MUST implement IAB’s GDPR Transparency & Consent Framework for this to work.

string
$$GDPR_CONSENT$$
Passes a GDPR consent string, if GDPR is required (defined by $$GDPR$$ macro).

If GDPR is NOT required, $$GDPR_CONSENT$$ will be replaced by an empty string.

Note! You MUST implement IAB’s GDPR Transparency & Consent Framework for this to work.

string
$$CCPA$$
Passes the US Privacy String.

Note! You MUST implement IAB’s CCPA Compliance Framework for this
to work.

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).