Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add External Id support to the Yieldlab bidder #3594

Merged
merged 1 commit into from
Mar 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions modules/yieldlabBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export const spec = {
if (matchedBid) {
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 extId = bidRequest.params.extId !== undefined ? '&id=' + bidRequest.params.extId : ''
const bidResponse = {
requestId: bidRequest.bidId,
cpm: matchedBid.price / 100,
Expand All @@ -88,11 +89,12 @@ export const spec = {
netRevenue: false,
ttl: BID_RESPONSE_TTL_SEC,
referrer: '',
ad: `<script src="${ENDPOINT}/d/${matchedBid.id}/${bidRequest.params.supplyId}/${customsize[0]}x${customsize[1]}?ts=${timestamp}"></script>`
ad: `<script src="${ENDPOINT}/d/${matchedBid.id}/${bidRequest.params.supplyId}/${customsize[0]}x${customsize[1]}?ts=${timestamp}${extId}"></script>`
}

if (isVideo(bidRequest)) {
bidResponse.mediaType = VIDEO
bidResponse.vastUrl = `${ENDPOINT}/d/${matchedBid.id}/${bidRequest.params.supplyId}/${customsize[0]}x${customsize[1]}?ts=${timestamp}`
bidResponse.vastUrl = `${ENDPOINT}/d/${matchedBid.id}/${bidRequest.params.supplyId}/${customsize[0]}x${customsize[1]}?ts=${timestamp}${extId}`
}

bidResponses.push(bidResponse)
Expand Down
3 changes: 2 additions & 1 deletion modules/yieldlabBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ Module that connects to Yieldlab's demand sources
targeting: {
key1: "value1",
key2: "value2"
}
},
extId: "abc"
}
}]
}, {
Expand Down
6 changes: 5 additions & 1 deletion test/spec/modules/yieldlabBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const REQUEST = {
'targeting': {
'key1': 'value1',
'key2': 'value2'
}
},
'extId': 'abc'
},
'bidderRequestId': '143346cf0f1731',
'auctionId': '2e41f65424c87c',
Expand Down Expand Up @@ -104,6 +105,7 @@ describe('yieldlabBidAdapter', function () {
expect(result[0].ttl).to.equal(300)
expect(result[0].referrer).to.equal('')
expect(result[0].ad).to.include('<script src="https://ad.yieldlab.net/d/1111/2222/728x90?ts=')
expect(result[0].ad).to.include('&id=abc')
})

it('should get correct bid response when passing more than one size', function () {
Expand All @@ -127,6 +129,7 @@ describe('yieldlabBidAdapter', function () {
expect(result[0].ttl).to.equal(300)
expect(result[0].referrer).to.equal('')
expect(result[0].ad).to.include('<script src="https://ad.yieldlab.net/d/1111/2222/728x90?ts=')
expect(result[0].ad).to.include('&id=abc')
})

it('should add vastUrl when type is video', function () {
Expand All @@ -143,6 +146,7 @@ describe('yieldlabBidAdapter', function () {
expect(result[0].cpm).to.equal(0.01)
expect(result[0].mediaType).to.equal('video')
expect(result[0].vastUrl).to.include('https://ad.yieldlab.net/d/1111/2222/728x90?ts=')
expect(result[0].vastUrl).to.include('&id=abc')
})
})
})