AdServerSasTracker

SAStracker adapter for Smart AdServer


Constructor

new AdServerSasTracker(main)

Constructor of SAStracker adapter

Parameters
Name Type Description
main Object

Instance of the main CpexPackage class

Methods

(async) call(adUnitsopt) @public

Mandatory. Calls the adserver to get the final ads selected and rendered NOTE: Needs window.AdsObject (list of elementIds/adUnits) to be present in the page

Parameters
Name Type Attributes Description
adUnits Array.<string> <optional>

Optional array of adUnit names


(async) refresh(adUnitsopt) → {Promise.<boolean>} @public

Refreshes specific ad positions in sastracker

Parameters
Name Type Attributes Description
adUnits Array.<string> <optional>

Array of adUnit codes to refresh

Returns

True if successful

Type: 
Promise.<boolean>

render(elementId, creative, width, height) → {boolean} @public

Interface for sas-tracker library from Optimics

Parameters
Name Type Description
elementId string

Element ID

creative string

Ad HTML code

width number

Width

height number

Height

Returns

False = sas-tracker renders, true = we render

Type: 
boolean

(async) renderStandalone(elementId, adUnit, sasPos, sasSize) @public

Create a request to SAS for specified adUnit, with HB bids, render into a specified element

Parameters
Name Type Description
elementId string

Element ID to render the ad into

adUnit string

Ad unit name

sasPos string

SAS position

sasSize string

SAS size


updateReferences(elementIds) @public

Use in case when ids are dynamically moved in the DOM, to update the references

Parameters
Name Type Description
elementIds Array.<string>

Array of element IDs to update references for


adRenderDebug(domId, metaData) @internal

Runs after rendering, waits a bit for rendering and then draws debug tags

Parameters
Name Type Description
domId string

DOM element ID

metaData Object

Metadata about the ad


addBid(bid, entity) @internal

Adds winning bid to a specific entity in AdsObject, to send it to ad server

Parameters
Name Type Description
bid Object

Winning bid object from Prebid

entity Object

The specific ad unit entity in AdsObject to enrich with bid info


addBids() @internal

Add winning bids to AdsObject, to be sent to the ad server


(async) addConsent() @internal

Get GDPR consent string from CMP and add it to the AdsObject


(async) getAdUnitElementId(hbKey) → {Promise.<(string|null)>} @internal

Returns (as promise) DOM element ID for adUnit/hbKey

Parameters
Name Type Description
hbKey string

Header bidding key

Returns

Element ID or null

Type: 
Promise.<(string|null)>

(async) getAdsList() @internal

Mandatory. Returns (as a promise) an array of elementIds/adUnits for the page, to be used for headerbidding adUnits Has to be a promise to act the same way as GAM.


isFromHB(creative) → {boolean} @internal

Determines if creative is from header bidding

Parameters
Name Type Description
creative string

Ad HTML code

Returns

True if from HB

Type: 
boolean

load() @internal

Initializes ad server. Missing sas-tracker script loading, which is specific for each publisher


prepareMetaData(elementId, metaData, creative) @internal

Prepares an object with useful information for debubbing. Merges info from both adserver and prebid.

Parameters
Name Type Description
elementId string

Element ID

metaData Object

Metadata about the ad, including width, height, SSP ID, FCID, HB key, etc.

creative string

Ad HTML code


(async) requestPosition(adUnit, sasPos, sasSize) → {Promise.<(string|null)>} @internal

Returns (as promise) DOM element ID for adUnit/hbKey.

Parameters
Name Type Description
adUnit string

Ad unit name

sasPos string

SAS position

sasSize string

SAS size

Returns

Creative HTML code or null

Type: 
Promise.<(string|null)>