Skip to content

Commit

Permalink
Merge branch 'master' into browi-rtd-new-features
Browse files Browse the repository at this point in the history
  • Loading branch information
omerDotan committed Oct 17, 2021
2 parents c2abb48 + 6a2293e commit 88fc84f
Show file tree
Hide file tree
Showing 44 changed files with 4,820 additions and 13,307 deletions.
1 change: 1 addition & 0 deletions modules/.submodules.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"akamaiDAPIdSystem",
"amxIdSystem",
"britepoolIdSystem",
"connectIdSystem",
"criteoIdSystem",
"deepintentDpesIdSystem",
"dmdIdSystem",
Expand Down
3 changes: 2 additions & 1 deletion modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ export const spec = {
{code: 'denakop'},
{code: 'rtbanalytica'},
{code: 'unibots'},
{code: 'ergadx'}
{code: 'ergadx'},
{code: 'turktelekom'}
],
supportedMediaTypes: [BANNER, VIDEO, NATIVE],

Expand Down
11 changes: 11 additions & 0 deletions modules/admixerBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,20 @@ export const spec = {
* Make a server request from the list of BidRequests.
*/
buildRequests: function (validRequest, bidderRequest) {
let w;
let docRef;
do {
w = w ? w.parent : window;
try {
docRef = w.document.referrer;
} catch (e) {
break;
}
} while (w !== window.top);
const payload = {
imps: [],
ortb2: config.getConfig('ortb2'),
docReferrer: docRef,
};
let endpointUrl;
if (bidderRequest) {
Expand Down
3 changes: 2 additions & 1 deletion modules/aolBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ const SUPPORTED_USER_ID_SOURCES = [
'liveintent.com',
'quantcast.com',
'verizonmedia.com',
'liveramp.com'
'liveramp.com',
'yahoo.com'
];

const pubapiTemplate = template`${'host'}/pubapi/3.0/${'network'}/${'placement'}/${'pageid'}/${'sizeid'}/ADTECH;v=2;cmd=bid;cors=yes;alias=${'alias'};misc=${'misc'};${'dynamicParams'}`;
Expand Down
90 changes: 58 additions & 32 deletions modules/bliinkBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ export const META_KEYWORDS = 'keywords'
export const META_DESCRIPTION = 'description'

const VIDEO = 'video'
const NATIVE = 'native'
const BANNER = 'banner'

const supportedMediaTypes = [BANNER, VIDEO, NATIVE]
const supportedMediaTypes = [BANNER, VIDEO]
const aliasBidderCode = ['bk']

export function getMetaList(name) {
Expand Down Expand Up @@ -90,7 +89,11 @@ export const parseXML = (content) => {
if (typeof content !== 'string' || content.length === 0) return null

const parser = new DOMParser()
const xml = parser.parseFromString(content, 'text/xml')
let xml;

try {
xml = parser.parseFromString(content, 'text/xml')
} catch (e) {}

if (xml &&
xml.getElementsByTagName('VAST')[0] &&
Expand All @@ -104,19 +107,19 @@ export const parseXML = (content) => {
/**
* @param bidRequest
* @param bliinkCreative
* @return {{cpm, netRevenue: boolean, ad: string, requestId, width: number, currency: string, mediaType: string, vastXml, ttl: number, height: number}|null}
* @return {{cpm, netRevenue: boolean, requestId, width: (*|number), currency, ttl: number, creativeId, height: (*|number)} & {mediaType: string, vastXml}}
*/
export const buildBid = (bidRequest, bliinkCreative) => {
if (!bidRequest && !bliinkCreative) return null

const body = {
requestId: bidRequest.bidId,
currency: bliinkCreative.currency,
cpm: bliinkCreative.price,
creativeId: bliinkCreative.creativeId,
currency: 'EUR',
width: (bidRequest.sizes && bidRequest.sizes[0][0]) || 1,
height: (bidRequest.sizes && bidRequest.sizes[0][1]) || 1,
netRevenue: false,
width: 1,
height: 1,
ttl: 3600,
}

Expand All @@ -131,14 +134,20 @@ export const buildBid = (bidRequest, bliinkCreative) => {

delete bidRequest['bids']

return Object.assign(body, {
currency: bliinkCreative.currency,
width: 1,
height: 1,
mediaType: VIDEO,
ad: '<html lang="en"></html>',
vastXml: bliinkCreative.content,
})
switch (bliinkCreative.media_type) {
case VIDEO:
return Object.assign(body, {
mediaType: VIDEO,
vastXml: bliinkCreative.content,
})
case BANNER:
return Object.assign(body, {
mediaType: BANNER,
ad: (bliinkCreative && bliinkCreative.content && bliinkCreative.content.creative && bliinkCreative.content.creative.adm) || '',
})
default:
break;
}
}

/**
Expand Down Expand Up @@ -209,7 +218,7 @@ export const buildRequests = (_, bidderRequest) => {
* @return
*/
const interpretResponse = (serverResponse, request) => {
if ((serverResponse && serverResponse.mode === 'no-ad') && (!request.params)) {
if ((serverResponse && serverResponse.mode === 'no-ad')) {
return []
}

Expand All @@ -218,23 +227,40 @@ const interpretResponse = (serverResponse, request) => {

const xml = parseXML(body)

if (xml) {
const price = xml.getElementsByTagName('Price') && xml.getElementsByTagName('Price')[0]
const currency = xml.getElementsByTagName('Currency') && xml.getElementsByTagName('Currency')[0]
const creativeId = xml.getElementsByTagName('CreativeId') && xml.getElementsByTagName('CreativeId')[0]

const creative = {
content: body,
price: (price && price.textContent) || 0,
currency: (currency && currency.textContent) || 'EUR',
creativeId: creativeId || 0,
media_type: 'video',
}

return buildBid(serverBody.bids[0], creative);
let creative;

switch (serverBody.bids[0].params.placement) {
case xml && VIDEO:
const price = xml.getElementsByTagName('Price') && xml.getElementsByTagName('Price')[0]
const currency = xml.getElementsByTagName('Currency') && xml.getElementsByTagName('Currency')[0]
const creativeId = xml.getElementsByTagName('CreativeId') && xml.getElementsByTagName('CreativeId')[0]

creative = {
content: body,
price: (price && price.textContent) || 0,
currency: (currency && currency.textContent) || 'EUR',
creativeId: creativeId || 0,
media_type: 'video',
}

return buildBid(serverBody.bids[0], creative)
case BANNER:
if (body) {
creative = {
content: body,
price: body.price,
currency: body.currency,
creativeId: 0,
media_type: 'banner',
}

return buildBid(serverBody.bids[0], creative)
}

break
default:
break
}

return []
}

/**
Expand Down
35 changes: 29 additions & 6 deletions modules/bliinkBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const adUnits = [
bidder: 'bliink',
params: {
placement: 'banner',
tagId: '14f30eca-85d2-11e8-9eed-0242ac120007'
tagId: '41'
}
}
]
Expand All @@ -50,11 +50,34 @@ const adUnits = [
mediaTypes: {
video: {
context: 'instream',
playerSize: [640, 480],
mimes: ['video/mp4'],
protocols: [1, 2, 3, 4, 5, 6, 7, 8],
playbackmethod: [2],
skip: 1
playerSize: [[640,480]],
}
},
bids: [
{
bidder: 'bliink',
params: {
tagId: '41',
placement: 'video',
}
}
]
}
]
```

## Sample outstream Video Ad Unit

```js
const adUnits = [
{
code: '/19968336/prebid_cache_video_adunit',
sizes: [[640,480]],
mediaType: 'video',
mediaTypes: {
video: {
context: 'outstream',
playerSize: [[640,480]],
}
},
bids: [
Expand Down
Loading

0 comments on commit 88fc84f

Please sign in to comment.