Skip to main content

Premium.product

This component contains functions related to the adproduct (the infrastructure that serves the ad formats).

Premium.product.id()

Returns the product code of the creative ("wp", "cf", "hi" etc)

if (Premium.product.id() === 'wp') {
// this is a Desktop Skin
}

Premium.product.dimensions

A dynamic object with dimensions info.

var creativeWidth = Premium.product.dimensions.width;
var topWindowHeight = Premium.product.dimensions.top.height;

Premium.product.baseURL

The base URL of creative assets.

var absoluteVideoPath = Premium.product.baseURL + 'assets/video.mp4';

Premium.product.creativeEl()

Returns the iframe holding the creative panel.

Premium.product.creativeMainEl()

Returns the iframe or div holding the main creative panel. In a Desktop Skin, this is the top.html panel. In a Mobile Skin this is the main.html panel.

Premium.product.topBarEl()

Returns the black bar defining the top of a scrolling creative.

Premium.product.bottomBarEl()

Returns the black bar defining the bottom of a scrolling creative.

Premium.product.initOrientationMessage(message, background)

Initiates device orientation message. Please note this function should be called only once at the entry-point of the creative code.

ParameterDefinition
messagemessage to be displayed default: 'Please rotate your device'
backgroundCSS background value for containing div default: #4E4E4E
Premium.product.initOrientationMessage('Rotate your device for the best experience!', 'rgba(0,0,0,.5)');

Premium.product.scopeWindow

The window scope in which the product code is running. In most environments, this is the same as window.top. This should always be used in place of any direct reference to the top window.

Premium.product.scopeWindow === window.top; // true (in most cases)

Premium.product.scopeWindow.addEventListener('scroll', function () {
// do some scroll action
});