Constructor
new AdServerSasTracker(main)
Constructor of SAStracker adapter
| Name | Type | Description |
|---|---|---|
main |
Object | Instance of the main CpexPackage class |
Methods
(async) call(adUnitsopt)
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
| Name | Type | Attributes | Description |
|---|---|---|---|
adUnits |
Array. |
<optional> | Optional array of adUnit names |
(async) refresh(adUnitsopt) → {Promise.<boolean>}
Refreshes specific ad positions in sastracker
| Name | Type | Attributes | Description |
|---|---|---|---|
adUnits |
Array. |
<optional> | Array of adUnit codes to refresh |
True if successful
- Type:
-
Promise.
<boolean>
render(elementId, creative, width, height) → {boolean}
Interface for sas-tracker library from Optimics
| Name | Type | Description |
|---|---|---|
elementId |
string | Element ID |
creative |
string | Ad HTML code |
width |
number | Width |
height |
number | Height |
False = sas-tracker renders, true = we render
- Type:
- boolean
(async) renderStandalone(elementId, adUnit, sasPos, sasSize)
Create a request to SAS for specified adUnit, with HB bids, render into a specified element
| 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)
Use in case when ids are dynamically moved in the DOM, to update the references
| Name | Type | Description |
|---|---|---|
elementIds |
Array. |
Array of element IDs to update references for |
adRenderDebug(domId, metaData)
Runs after rendering, waits a bit for rendering and then draws debug tags
| Name | Type | Description |
|---|---|---|
domId |
string | DOM element ID |
metaData |
Object | Metadata about the ad |
addBid(bid, entity)
Adds winning bid to a specific entity in AdsObject, to send it to ad server
| 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()
Add winning bids to AdsObject, to be sent to the ad server
(async) addConsent()
Get GDPR consent string from CMP and add it to the AdsObject
(async) getAdUnitElementId(hbKey) → {Promise.<(string|null)>}
Returns (as promise) DOM element ID for adUnit/hbKey
| Name | Type | Description |
|---|---|---|
hbKey |
string | Header bidding key |
Element ID or null
- Type:
-
Promise.
<(string| null)>
(async) getAdsList()
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}
Determines if creative is from header bidding
| Name | Type | Description |
|---|---|---|
creative |
string | Ad HTML code |
True if from HB
- Type:
- boolean
load()
Initializes ad server. Missing sas-tracker script loading, which is specific for each publisher
prepareMetaData(elementId, metaData, creative)
Prepares an object with useful information for debubbing. Merges info from both adserver and prebid.
| 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)>}
Returns (as promise) DOM element ID for adUnit/hbKey.
| Name | Type | Description |
|---|---|---|
adUnit |
string | Ad unit name |
sasPos |
string | SAS position |
sasSize |
string | SAS size |
Creative HTML code or null
- Type:
-
Promise.
<(string| null)>