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"
Applied for InPage, InView and InBanner ad formats. NOT applicable for the Sticky player mode.

Configures the margin area for the 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/SIMID 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
"advertising" : {
"tag" : [{
"learnMore"
Configures the custom “Learn more” button display onhover the ad content in the player.

NB! The “Learn more” button will show, if the player displays a plain VAST ad unit, i.e. without extra ad setup layers included (e.g. added ad wrapper, etc.)

Default: false

true/false
"advertising" : {
"tag" : [{
"learnMoreText"
Configures the text, displayed on the “Learn more” button.

NB! The maximum length of the button text is 50 characters.

string
"advertising" : {
"tag" : [{
"learnMoreLink"
Configures the URL, which opens upon the “Learn more” button click.
string
Parameter Description Value
"advertising" : {
"breakSchedule"
Optional.
"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.
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" : {
"fixTransform"
ONLY applied for Sticky.

If true, the parameter ensures the Sticky player doesn’t change its size or position regardless of the website CSS specifics.

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" : {
"stickyVerticalMargin"
ONLY applied for Sticky.
Specifies the vertical interval between the Sticky player and the edge of the screen in pixels.
number
"advertising" : {
"stickyHorizontalMargin"
ONLY applied for Sticky.
Specifies the horizontal interval between the Sticky player and the edge of the screen in pixels.
number
"advertising" : {
"startAsSticky"
ONLY applied for Sticky.
Configures the player launch in the Sticky mode, followed by its transformation into InPage/InBanner, accordingly, when it gets in readers’ view.
true/false
"advertising" : {
"disableStickyContent"
ONLY applied for Sticky.
If true, the player Sticky mode is applied only for ad content display, then switched off [on display of video content].
true/false
"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" : {
"waterfall"
Configures the ad waterfall type:

    1. Parallel (“parallel”)
    2. Sequential (“sequential”)
    3. Performance-based (“cpm”)

Example:

"waterfall": "cpm"
parallel/
sequential/
cpm
"advertising" : {
"cpmStep"
ONLY applied for Performance-based Waterfall.

Configures the CPM bid increment for the ad auction.

Default value: $0.01

Add the number or skip this parameter to apply the default value.

Example:

"cpmStep": 0.5
number
"advertising" : {
"consentTimeout"
ONLY applied for Performance-based Waterfall.

Configures the timeout (in milliseconds) for the receipt of information regarding user data consent prior to the player launch.

Example:

"consentTimeout": 5000
number
"advertising" : {
"tag" : [{
"minCpmUrl": {
ONLY applied for Performance-based Waterfall.

Configures the minimum CPMs for the Demand Tag URL and other specific URLs, competing in the waterfall, if specified.

Note! Use this parameter in case the Advertiser doesn’t support macros for passing minimum CPM data in the Performance-based Waterfall (i.e. $$MIN_CPM$$ and $$MIN_CPM_IMA$$).

"advertising" : {
"tag" : [{
"minCpmUrl": {
"minCpm"
ONLY applied for Performance-based Waterfall.

Configures the minimum CPM required for ad display via the Demand Tag URL.

Example:

"minCpmUrl": {
"minCpm": 1
}
number
"advertising" : {
"tag" : [{
"minCpmUrl": {
"urls": [{ 
"url"
"minCpm"
ONLY applied for Performance-based Waterfall.

Optional.

Configures specific URL/s for ad display and the minimum CPM required for ad display via such URL/s.

Tip! Add multiple URLs with relevant minimum CPMs for one Advertiser’s Demand Tag if you wish to have them compete for ad display in the ad waterfall.

Example:

"minCpmUrl": {
                                        "urls": [
                        {
                            "url": "https://minUrl1.com",
                            "minCpm": 2
                        },
                        {
                            "url": "https://minUrl2.com",
                            "minCpm": 5
                        }
]
}
string
number

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 a random numeric string.
Example:

correlator:0.34637356383
number
$$RANDOM_10$$
Returns a random 10-digit integer.
Example:

correlator:4345645667
number
$$PUB_ID$$
Returns the publisher’s website ID. string
$$PPID$$
Passes the publisher-provided identifier (PPID). string
$$PLACEMENT_ID$$
Returns the ad placement ID string
$$MIN_CPM$$
Returns the minimum CPM required for non-IMA ad display in a Performance-based Waterfall. number
$$MIN_CPM_IMA$$
Returns the minimum CPM required for IMA ad display in a Performance-based Waterfall. number
$$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

<div id="divAdPlayerPro"></div>
<script src="https://static.adplayer.pro/player/AdPlayerPro.js"></script>
<script>(function () {
  AdPlayerPro("divAdPlayerPro").setup({
    "placementId": "E4PwNl4FEpNx", 
    "muted": true, 
    "autoStart": true, 
    "width": "640", 
    "height": "360", 
    "type": "inPage", 
    "advertising": { 
      "tag": [ 
        { 
          "url": "https://static.adplayer.pro/vast/demo.xml", 
        } 
       ] 
     } 
  }) 
})(); 
</script>

Example 2: InStream

<div id="divAdPlayerPro"></div>
<script src="https://static.adplayer.pro/player/AdPlayerPro.js"></script>
<script>(function () {
  AdPlayerPro("divAdPlayerPro").setup({
    "placementId": "E4PwNl4FEpNx",
    "muted": true,
    "autoStart": true,
    "width": "640",
    "height": "360",
    "type": "inStream",
    "file": "https://static.adplayer.pro/video/ProPromoVideo.mp4",
    "advertising": {
      "tag": [
        {
          "url": "https://static.adplayer.pro/vast/demo.xml",
        }
      ]
    }
  })
})();
</script>

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