Members
(constant) texts
Returns default texts for PayOkay modal
Methods
addAzureExport()
Saves segments to cookies for later use (Azure/Piano export)
addElement(name, container, attributesopt) → {HTMLElement}
Shortens DOM element adding
| Name | Type | Attributes | Description |
|---|---|---|---|
name |
string | Tag name |
|
container |
HTMLElement | Parent element |
|
attributes |
Object | <optional> | HTML attributes |
Created element
- Type:
- HTMLElement
addIframe(element, attributes, callbackopt) → {HTMLIFrameElement}
Adds iframe for creative rendering
| Name | Type | Attributes | Description |
|---|---|---|---|
element |
HTMLElement | Parent element |
|
attributes |
Object | HTML attributes for iframe |
|
callback |
function | <optional> | Callback function after loading |
Created iframe element
- Type:
- HTMLIFrameElement
addPixel(url)
Adds 1px image for tracking
| Name | Type | Description |
|---|---|---|
url |
string | Tracking pixel URL |
addStyle(doc, css) → {HTMLElement}
Adds custom CSS style to document
| Name | Type | Description |
|---|---|---|
doc |
Document | Document object |
css |
string | CSS code |
Created style element
- Type:
- HTMLElement
addTCFStub()
Adds TCF stub for GDPR (official Didomi implementation)
awaitDOM() → {Promise}
Waits for DOM to be loaded
Promise that resolves after DOM is loaded
- Type:
- Promise
b64DecodeUnicode(str) → {string}
Decodes UTF-8 Base64 string
| Name | Type | Description |
|---|---|---|
str |
string | Base64 string |
Decoded string
- Type:
- string
clamp(val, min, max) → {number}
Limits value between min and max (inclusive)
| Name | Type | Description |
|---|---|---|
val |
number | Value to limit |
min |
number | Minimum value |
max |
number | Maximum value |
Limited value
- Type:
- number
clone(source) → {*}
Creates deep copy of object using JSON
| Name | Type | Description |
|---|---|---|
source |
* | Source object |
Copy of object
- Type:
- *
cpexError(message, error) → {Error}
Shows console error with common prefix and creates Error object
| Name | Type | Description |
|---|---|---|
message |
string | Error message |
error |
Error
| |
Error object or error text |
Error object with cause
- Type:
- Error
cpexLog()
Shows console log only when debug mode is enabled
cpexLogHeadline(text)
Shows console log in large font
| Name | Type | Description |
|---|---|---|
text |
string | Text to display |
cpexWarn()
Shows console warning with common prefix
cropText(text, maxLength) → {string}
Crops text and adds ellipsis
| Name | Type | Description |
|---|---|---|
text |
string | Text to crop |
maxLength |
number | Maximum length |
Cropped text
- Type:
- string
decorateLog(args) → {Array}
Decorates log arguments with timing information
| Name | Type | Description |
|---|---|---|
args |
* | Arguments for logging |
Decorated arguments
- Type:
- Array
deepMerge(target, source) → {Object|boolean}
Deep merges two objects
| Name | Type | Description |
|---|---|---|
target |
Object | Target object |
source |
Object | Source object |
Merged object or false on error
- Type:
-
Object
|
boolean
displayMetaData(elementId, creativeMetaData)
Shows visual debug "tags" on banners
| Name | Type | Description |
|---|---|---|
elementId |
string | Ad element ID |
creativeMetaData |
Object | Ad metadata |
enrichVast(url) → {string}
Adds GDPR parameters to VAST URL (TODO: implement)
| Name | Type | Description |
|---|---|---|
url |
string | VAST URL |
Modified URL
- Type:
- string
fillIframeDoc(doc, creative)
Inserts creative into iframe document
| Name | Type | Description |
|---|---|---|
doc |
Document | Iframe document |
creative |
string | Creative HTML code |
fillNativeTemplate(native, html, configopt) → {string}
DEPRECATED. Fills HTML template from Native ad data
| Name | Type | Attributes | Description |
|---|---|---|---|
native |
Object | Native ad data |
|
html |
string | HTML template |
|
config |
Object | <optional> | Configuration |
Filled template
- Type:
- string
fillOrtbNativeTemplate(native, html, configopt) → {string}
Fills HTML template from Prebid Native ad data
| Name | Type | Attributes | Description |
|---|---|---|---|
native |
Object | Prebid Native ad data |
|
html |
string | HTML template |
|
config |
Object | <optional> | Configuration |
Filled template
- Type:
- string
gamGetElementByPath(adUnitPath) → {Object|undefined}
Returns googletag slot by its adUnit path in GAM
| Name | Type | Description |
|---|---|---|
adUnitPath |
string | Ad unit path in GAM |
Google tag slot object
- Type:
-
Object
|
undefined
getConsent() → {Promise.<string>}
Gets GDPR consent string from CMP
TC string
- Type:
-
Promise.
<string>
getCookie(name) → {string|null}
Reads a cookie by name
| Name | Type | Description |
|---|---|---|
name |
string | Cookie name |
Cookie value or null
- Type:
-
string
|
null
getId5PartnerData(ip) → {Promise.<string>}
Returns custom user identification info for ID5
| Name | Type | Description |
|---|---|---|
ip |
Object | Object with IP address |
Base64 encoded data
- Type:
-
Promise.
<string>
getIpAddress() → {Promise.<Object>}
Gets user's IP address
Object with IP address (ip4 or ip6)
- Type:
-
Promise.
<Object>
getPackage() → {Object}
Returns the main cpexPackage object instance
cpexPackage instance
- Type:
- Object
getRandomInt(a, b) → {number}
Returns random integer in range (inclusive)
| Name | Type | Description |
|---|---|---|
a |
number | Minimum value |
b |
number | Maximum value |
Random number
- Type:
- number
getThirdPartyCookieSupport() → {Promise.<number>}
Detects third-party cookie support in browser
1 if supported, 0 otherwise
- Type:
-
Promise.
<number>
hasAdblock(prebidPath) → {Promise.<boolean>}
Tests for adblock presence using AJAX request
| Name | Type | Description |
|---|---|---|
prebidPath |
string | Path to Prebid file |
True if adblock is active
- Type:
-
Promise.
<boolean>
hideAdContent(element)
Hides ad content (used e.g. on error)
| Name | Type | Description |
|---|---|---|
element |
string | Element ID |
isAdsObject(obj) → {boolean}
Checks if object contains ads structure
| Name | Type | Description |
|---|---|---|
obj |
* | Object to check |
True if it has correct structure
- Type:
- boolean
isDOMObject(obj) → {boolean}
Checks if object is a DOM element
| Name | Type | Description |
|---|---|---|
obj |
* | Object to check |
True if it's a DOM element
- Type:
- boolean
isFilledArray(arr) → {boolean}
Checks if variable is an array with content
| Name | Type | Description |
|---|---|---|
arr |
* | Variable to check |
True if it's a non-empty array
- Type:
- boolean
isMobile() → {boolean}
Returns whether browser is on mobile device
True for mobile device
- Type:
- boolean
isObject(obj) → {boolean}
Checks if variable is an object (not null or array)
| Name | Type | Description |
|---|---|---|
obj |
* | Variable to check |
True if it's an object
- Type:
- boolean
isPrebidLoaded() → {boolean}
Checks if Prebid is loaded
True if Prebid is loaded
- Type:
- boolean
loadScript(doc, url, name, typeopt) → {Promise}
Loads script or link asynchronously
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
doc |
Document | Document object |
||
url |
string | URL of file to load |
||
name |
string | Name for identification |
||
type |
string | <optional> |
'script'
|
Element type (script or link) |
Promise that resolves after loading
- Type:
- Promise
regexGetFirstComment(text) → {string|undefined}
Extracts first HTML comment from text using regex
| Name | Type | Description |
|---|---|---|
text |
string | Text to search |
Comment content or undefined
- Type:
-
string
|
undefined
regexGetValue(text, keyword) → {string|undefined}
Extracts keyword value from text using regex
| Name | Type | Description |
|---|---|---|
text |
string | Text to search |
keyword |
string | Keyword to search for |
Found value or undefined
- Type:
-
string
|
undefined
replaceTemplateLiteral(str, obj) → {string}
Manual template literal replacement
| Name | Type | Description |
|---|---|---|
str |
string | Template with variables ${var} |
obj |
Object | Object with variable values |
Filled template
- Type:
- string
setCookie(name, duration, valueopt, domainopt)
Sets a cookie
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name |
string | Cookie name |
||
duration |
number | Duration in seconds |
||
value |
string | <optional> |
'true'
|
Cookie value |
domain |
string | <optional> | Domain for cookie |
ssspCallback(ad, sssp)
Callback for SSSP ad server (Seznam.cz)
| Name | Type | Description |
|---|---|---|
ad |
Object | Ad object |
sssp |
Object | SSSP instance |
ssspInfoCallback(ad, sssp)
Info callback for SSSP ad server (Seznam.cz)
| Name | Type | Description |
|---|---|---|
ad |
Object | Ad object |
sssp |
Object | SSSP instance |
style() → {string}
Returns CSS styles for PayOkay modal
CSS code
- Type:
- string
triggerTracking(data)
Fires tracking pixels for given data
| Name | Type | Description |
|---|---|---|
data |
Object | Data with tracking URLs |