From efdee9c729450451ec053fa23dfd854eef6265a3 Mon Sep 17 00:00:00 2001 From: Mirko Feddern Date: Tue, 5 Mar 2019 21:47:57 +0100 Subject: [PATCH] Add support for External Id (#3594) The External Id is a dynamic reporting dimension, that can be passed through Yieldlab's adtag via the "id"-parameter. E.g. https://ad.yieldlab.net/d/1111/2222/728x90?ts=123456789&id=abc --- modules/yieldlabBidAdapter.js | 6 ++++-- modules/yieldlabBidAdapter.md | 3 ++- test/spec/modules/yieldlabBidAdapter_spec.js | 6 +++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/yieldlabBidAdapter.js b/modules/yieldlabBidAdapter.js index cb5535bb165..1bbb3f11a2e 100644 --- a/modules/yieldlabBidAdapter.js +++ b/modules/yieldlabBidAdapter.js @@ -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, @@ -88,11 +89,12 @@ export const spec = { netRevenue: false, ttl: BID_RESPONSE_TTL_SEC, referrer: '', - ad: `` + ad: `` } + 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) diff --git a/modules/yieldlabBidAdapter.md b/modules/yieldlabBidAdapter.md index 96b62f5cf8c..de93baf42ae 100644 --- a/modules/yieldlabBidAdapter.md +++ b/modules/yieldlabBidAdapter.md @@ -25,7 +25,8 @@ Module that connects to Yieldlab's demand sources targeting: { key1: "value1", key2: "value2" - } + }, + extId: "abc" } }] }, { diff --git a/test/spec/modules/yieldlabBidAdapter_spec.js b/test/spec/modules/yieldlabBidAdapter_spec.js index 497e9c7b894..c2e12408cdd 100644 --- a/test/spec/modules/yieldlabBidAdapter_spec.js +++ b/test/spec/modules/yieldlabBidAdapter_spec.js @@ -11,7 +11,8 @@ const REQUEST = { 'targeting': { 'key1': 'value1', 'key2': 'value2' - } + }, + 'extId': 'abc' }, 'bidderRequestId': '143346cf0f1731', 'auctionId': '2e41f65424c87c', @@ -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('