Skip to content

Commit

Permalink
Changes on AdSize + gdpr (#3035)
Browse files Browse the repository at this point in the history
* Changes on AdSize + gdpr

- Primary adsize is now the prebid slot adsize
- On bidder.params you can now overwrite the prebid slot size (Not primary size anymore)
- gdpr string will be only attached if "gdprApplies=true"

* Update yieldlabBidAdapter.js
  • Loading branch information
phtechno authored and bretg committed Sep 6, 2018
1 parent 0f401ee commit 55669ac
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions modules/yieldlabBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const spec = {
supportedMediaTypes: [VIDEO, BANNER],

isBidRequestValid: function (bid) {
if (bid && bid.params && bid.params.adslotId && bid.params.adSize) {
if (bid && bid.params && bid.params.adslotId && bid.params.supplyId) {
return true
}
return false
Expand All @@ -40,8 +40,10 @@ export const spec = {
})

if (bidderRequest && bidderRequest.gdprConsent) {
query.consent = bidderRequest.gdprConsent.consentString
query.gdpr = (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') ? bidderRequest.gdprConsent.gdprApplies : true
if (query.gdpr) {
query.consent = bidderRequest.gdprConsent.consentString
}
}

const adslots = adslotIds.join(',')
Expand Down Expand Up @@ -73,23 +75,24 @@ export const spec = {
})

if (matchedBid) {
const sizes = parseSize(bidRequest.params.adSize)
const primarysize = bidRequest.sizes.length === 2 && !utils.isArray(bidRequest.sizes[0]) ? bidRequest.sizes : bidRequest.sizes[0]
const customsize = bidRequest.params.adSize !== undefined ? parseSize(bidRequest.params.adSize) : primarysize
const bidResponse = {
requestId: bidRequest.bidId,
cpm: matchedBid.price / 100,
width: sizes[0],
height: sizes[1],
width: primarysize[0],
height: primarysize[1],
creativeId: '' + matchedBid.id,
dealId: matchedBid.pid,
currency: CURRENCY_CODE,
netRevenue: false,
ttl: BID_RESPONSE_TTL_SEC,
referrer: '',
ad: `<script src="${ENDPOINT}/d/${matchedBid.id}/${bidRequest.params.supplyId}/${sizes[0]}x${sizes[1]}?ts=${timestamp}"></script>`
ad: `<script src="${ENDPOINT}/d/${matchedBid.id}/${bidRequest.params.supplyId}/${customsize[0]}x${customsize[1]}?ts=${timestamp}"></script>`
}
if (isVideo(bidRequest)) {
bidResponse.mediaType = VIDEO
bidResponse.vastUrl = `${ENDPOINT}/d/${matchedBid.id}/${bidRequest.params.supplyId}/${sizes[0]}x${sizes[1]}?ts=${timestamp}`
bidResponse.vastUrl = `${ENDPOINT}/d/${matchedBid.id}/${bidRequest.params.supplyId}/${customsize[0]}x${customsize[1]}?ts=${timestamp}`
}

bidResponses.push(bidResponse)
Expand Down

0 comments on commit 55669ac

Please sign in to comment.