From 5ac61b971099064a2508eab9f6ba818b33dfdd0f Mon Sep 17 00:00:00 2001 From: "elber@yieldmo.com" Date: Thu, 24 Mar 2022 15:48:27 -0400 Subject: [PATCH 1/9] Add stage bidder service --- modules/yieldmoBidAdapter.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/yieldmoBidAdapter.js b/modules/yieldmoBidAdapter.js index bc29f4822c8..e399254a7ba 100644 --- a/modules/yieldmoBidAdapter.js +++ b/modules/yieldmoBidAdapter.js @@ -24,6 +24,7 @@ const CURRENCY = 'USD'; const TIME_TO_LIVE = 300; const NET_REVENUE = true; const BANNER_SERVER_ENDPOINT = 'https://ads.yieldmo.com/exchange/prebid'; +const BANNER_STG_SERVER_ENDPOINT = 'http://qa-test-01.aws.in.yieldmo.com:8080/bidder?bidderId=1&placementId=2438568554933461939'; const VIDEO_SERVER_ENDPOINT = 'https://ads.yieldmo.com/exchange/prebidvideo'; const OUTSTREAM_VIDEO_PLAYER_URL = 'https://prebid-outstream.yieldmo.com/bundle.js'; const OPENRTB_VIDEO_BIDPARAMS = ['mimes', 'startdelay', 'placement', 'startdelay', 'skipafter', 'protocols', 'api', From 744d914c9f1bc99b8d7b7e3c54b95db0aa2cd882 Mon Sep 17 00:00:00 2001 From: "elber@yieldmo.com" Date: Mon, 28 Mar 2022 11:50:11 -0400 Subject: [PATCH 2/9] add stage url --- modules/yieldmoBidAdapter.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/modules/yieldmoBidAdapter.js b/modules/yieldmoBidAdapter.js index 3d305910077..b1cb3b9617b 100644 --- a/modules/yieldmoBidAdapter.js +++ b/modules/yieldmoBidAdapter.js @@ -60,6 +60,7 @@ export const spec = { * @return ServerRequest Info describing the request to the server. */ buildRequests: function (bidRequests, bidderRequest) { + const stage = isStage(bidderRequest); const bannerBidRequests = bidRequests.filter(request => hasBannerMediaType(request)); const videoBidRequests = bidRequests.filter(request => hasVideoMediaType(request)); let serverRequests = []; @@ -123,8 +124,8 @@ export const spec = { serverRequest.eids = JSON.stringify(eids); }; // check if url exceeded max length - const url = `${BANNER_SERVER_ENDPOINT}?${parseQueryStringParameters(serverRequest)}`; - let extraCharacters = url.length - MAX_BANNER_REQUEST_URL_LENGTH; + const fullUrl = `${BANNER_SERVER_ENDPOINT}?${parseQueryStringParameters(serverRequest)}`; + let extraCharacters = fullUrl.length - MAX_BANNER_REQUEST_URL_LENGTH; if (extraCharacters > 0) { for (let i = 0; i < BANNER_REQUEST_PROPERTIES_TO_REDUCE.length; i++) { extraCharacters = shortcutProperty(extraCharacters, serverRequest, BANNER_REQUEST_PROPERTIES_TO_REDUCE[i]); @@ -137,7 +138,7 @@ export const spec = { serverRequests.push({ method: 'GET', - url: BANNER_SERVER_ENDPOINT, + url: getBannerUrl(stage), data: serverRequest }); } @@ -662,3 +663,14 @@ function canAccessTopWindow() { return false; } } + +function isStage(bidderRequest) { + return bidderRequest.refererInfo?.referer?.contains('pb_force_a'); +} + +function getBannerUrl(isStage) { + if (isStage) { + return BANNER_STG_SERVER_ENDPOINT; + } + return BANNER_SERVER_ENDPOINT; +} From 84c2fb01b98f677763ca5c87b7c8641259bb65a7 Mon Sep 17 00:00:00 2001 From: "elber@yieldmo.com" Date: Mon, 28 Mar 2022 14:35:31 -0400 Subject: [PATCH 3/9] fix url --- modules/yieldmoBidAdapter.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/modules/yieldmoBidAdapter.js b/modules/yieldmoBidAdapter.js index b1cb3b9617b..7cf1433ad8c 100644 --- a/modules/yieldmoBidAdapter.js +++ b/modules/yieldmoBidAdapter.js @@ -23,10 +23,13 @@ const BIDDER_CODE = 'yieldmo'; const CURRENCY = 'USD'; const TIME_TO_LIVE = 300; const NET_REVENUE = true; -const BANNER_SERVER_ENDPOINT = 'https://ads.yieldmo.com/exchange/prebid'; const BANNER_STG_SERVER_ENDPOINT = 'http://qa-test-01.aws.in.yieldmo.com:8080/bidder?bidderId=1&placementId=2438568554933461939'; const VIDEO_SERVER_ENDPOINT = 'https://ads.yieldmo.com/exchange/prebidvideo'; const PB_COOKIE_ASSIST_SYNC_ENDPOINT = `https://ads.yieldmo.com/pbcas`; +const BANNER_PATH = '/exchange/prebid'; +const VIDEO_PATH = '/exchange/prebidvideo'; +const STAGE_DOMAIN = 'https://ads-stg.yieldmo.com'; +const PROD_DOMAIN = 'https://ads.yieldmo.com'; const OUTSTREAM_VIDEO_PLAYER_URL = 'https://prebid-outstream.yieldmo.com/bundle.js'; const OPENRTB_VIDEO_BIDPARAMS = ['mimes', 'startdelay', 'placement', 'startdelay', 'skipafter', 'protocols', 'api', 'playbackmethod', 'maxduration', 'minduration', 'pos', 'skip', 'skippable']; @@ -61,6 +64,8 @@ export const spec = { */ buildRequests: function (bidRequests, bidderRequest) { const stage = isStage(bidderRequest); + const bannerUrl = getAdserverUrl(BANNER_PATH, stage); + const videoUrl = getAdserverUrl(VIDEO_PATH, stage); const bannerBidRequests = bidRequests.filter(request => hasBannerMediaType(request)); const videoBidRequests = bidRequests.filter(request => hasVideoMediaType(request)); let serverRequests = []; @@ -124,7 +129,7 @@ export const spec = { serverRequest.eids = JSON.stringify(eids); }; // check if url exceeded max length - const fullUrl = `${BANNER_SERVER_ENDPOINT}?${parseQueryStringParameters(serverRequest)}`; + const fullUrl = `${bannerUrl}?${parseQueryStringParameters(serverRequest)}`; let extraCharacters = fullUrl.length - MAX_BANNER_REQUEST_URL_LENGTH; if (extraCharacters > 0) { for (let i = 0; i < BANNER_REQUEST_PROPERTIES_TO_REDUCE.length; i++) { @@ -138,7 +143,7 @@ export const spec = { serverRequests.push({ method: 'GET', - url: getBannerUrl(stage), + url: bannerUrl, data: serverRequest }); } @@ -150,7 +155,7 @@ export const spec = { }; serverRequests.push({ method: 'POST', - url: VIDEO_SERVER_ENDPOINT, + url: videoUrl, data: serverRequest }); } @@ -668,9 +673,7 @@ function isStage(bidderRequest) { return bidderRequest.refererInfo?.referer?.contains('pb_force_a'); } -function getBannerUrl(isStage) { - if (isStage) { - return BANNER_STG_SERVER_ENDPOINT; - } - return BANNER_SERVER_ENDPOINT; +function getAdserverUrl(path, stage) { + const domain = stage ? STAGE_DOMAIN : PROD_DOMAIN; + return `${domain}${path}`; } From 66eb6e40890956a1bc7862994a2776996b36d309 Mon Sep 17 00:00:00 2001 From: "elber@yieldmo.com" Date: Mon, 28 Mar 2022 15:18:10 -0400 Subject: [PATCH 4/9] fix string method --- modules/yieldmoBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/yieldmoBidAdapter.js b/modules/yieldmoBidAdapter.js index 7cf1433ad8c..a06239b6d15 100644 --- a/modules/yieldmoBidAdapter.js +++ b/modules/yieldmoBidAdapter.js @@ -670,7 +670,7 @@ function canAccessTopWindow() { } function isStage(bidderRequest) { - return bidderRequest.refererInfo?.referer?.contains('pb_force_a'); + return !!bidderRequest.refererInfo?.referer?.includes('pb_force_a'); } function getAdserverUrl(path, stage) { From 7c4658f29b2dddb90dd6706f2539bfe5f705608c Mon Sep 17 00:00:00 2001 From: "elber@yieldmo.com" Date: Tue, 19 Jul 2022 07:41:22 -0400 Subject: [PATCH 5/9] clean up rebase --- modules/yieldmoBidAdapter.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/yieldmoBidAdapter.js b/modules/yieldmoBidAdapter.js index a06239b6d15..bcc0c0a9570 100644 --- a/modules/yieldmoBidAdapter.js +++ b/modules/yieldmoBidAdapter.js @@ -23,8 +23,6 @@ const BIDDER_CODE = 'yieldmo'; const CURRENCY = 'USD'; const TIME_TO_LIVE = 300; const NET_REVENUE = true; -const BANNER_STG_SERVER_ENDPOINT = 'http://qa-test-01.aws.in.yieldmo.com:8080/bidder?bidderId=1&placementId=2438568554933461939'; -const VIDEO_SERVER_ENDPOINT = 'https://ads.yieldmo.com/exchange/prebidvideo'; const PB_COOKIE_ASSIST_SYNC_ENDPOINT = `https://ads.yieldmo.com/pbcas`; const BANNER_PATH = '/exchange/prebid'; const VIDEO_PATH = '/exchange/prebidvideo'; From dcad2e1a8399f1e609dac8cdec22f858d8748415 Mon Sep 17 00:00:00 2001 From: Nayan Date: Wed, 24 Aug 2022 14:58:59 -0700 Subject: [PATCH 6/9] Adding transaction id and auction id. --- modules/yieldmoBidAdapter.js | 13 ++++++- test/spec/modules/yieldmoBidAdapter_spec.js | 40 ++++++++++++++++++--- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/modules/yieldmoBidAdapter.js b/modules/yieldmoBidAdapter.js index 614e19b24ea..480b8e39439 100644 --- a/modules/yieldmoBidAdapter.js +++ b/modules/yieldmoBidAdapter.js @@ -247,6 +247,12 @@ function addPlacement(request) { if (gpid) { placementInfo.gpid = gpid; } + if (request.transactionId) { + placementInfo.tid = request.transactionId; + } + if (request.auctionId) { + placementInfo.auctionId = request.auctionId; + } return JSON.stringify(placementInfo); } @@ -386,7 +392,12 @@ function openRtbRequest(bidRequests, bidderRequest) { if (schain) { openRtbRequest.schain = schain; } - + if (bidRequests[0].transactionId) { + openRtbRequest.tid = bidRequests[0].transactionId; + } + if (bidRequests[0].auctionId) { + openRtbRequest.auctionId = bidRequests[0].auctionId; + } populateOpenRtbGdpr(openRtbRequest, bidderRequest); return openRtbRequest; diff --git a/test/spec/modules/yieldmoBidAdapter_spec.js b/test/spec/modules/yieldmoBidAdapter_spec.js index f36c804a18b..b964f5eaf55 100644 --- a/test/spec/modules/yieldmoBidAdapter_spec.js +++ b/test/spec/modules/yieldmoBidAdapter_spec.js @@ -2,6 +2,9 @@ import { expect } from 'chai'; import { spec } from 'modules/yieldmoBidAdapter.js'; import * as utils from 'src/utils.js'; +/* eslint no-console: ["error", { allow: ["log", "warn", "error"] }] */ +// above is used for debugging purposes only + describe('YieldmoAdapter', function () { const BANNER_ENDPOINT = 'https://ads.yieldmo.com/exchange/prebid'; const VIDEO_ENDPOINT = 'https://ads.yieldmo.com/exchange/prebidvideo'; @@ -31,6 +34,7 @@ describe('YieldmoAdapter', function () { userId: { tdid: '8d146286-91d4-4958-aff4-7e489dd1abd6' }, + transactionId: '54a58774-7a41-494e-9aaf-fa7b79164f0c', ...rootParams }); @@ -38,6 +42,7 @@ describe('YieldmoAdapter', function () { bidder: 'yieldmo', adUnitCode: 'adunit-code-video', bidId: '321video123', + auctionId: '1d1a03073455', mediaTypes: { video: { playerSize: [640, 480], @@ -59,6 +64,7 @@ describe('YieldmoAdapter', function () { ...videoParams } }, + transactionId: '54a58774-7a41-494e-8cbc-fa7b79164f0c', ...rootParams }); @@ -172,15 +178,15 @@ describe('YieldmoAdapter', function () { it('should place bid information into the p parameter of data', function () { let bidArray = [mockBannerBid()]; expect(buildAndGetPlacementInfo(bidArray)).to.equal( - '[{"placement_id":"adunit-code","callback_id":"30b31c1838de1e","sizes":[[300,250],[300,600]],"bidFloor":0.1}]' + '[{"placement_id":"adunit-code","callback_id":"30b31c1838de1e","sizes":[[300,250],[300,600]],"bidFloor":0.1,"tid":"54a58774-7a41-494e-9aaf-fa7b79164f0c","auctionId":"1d1a030790a475"}]' ); // multiple placements bidArray.push(mockBannerBid( - {adUnitCode: 'adunit-2', bidId: '123a', bidderRequestId: '321', auctionId: '222'}, {bidFloor: 0.2})); + {adUnitCode: 'adunit-2', bidId: '123a', bidderRequestId: '321', auctionId: '222', transactionId: '444'}, {bidFloor: 0.2})); expect(buildAndGetPlacementInfo(bidArray)).to.equal( - '[{"placement_id":"adunit-code","callback_id":"30b31c1838de1e","sizes":[[300,250],[300,600]],"bidFloor":0.1},' + - '{"placement_id":"adunit-2","callback_id":"123a","sizes":[[300,250],[300,600]],"bidFloor":0.2}]' + '[{"placement_id":"adunit-code","callback_id":"30b31c1838de1e","sizes":[[300,250],[300,600]],"bidFloor":0.1,"tid":"54a58774-7a41-494e-9aaf-fa7b79164f0c","auctionId":"1d1a030790a475"},' + + '{"placement_id":"adunit-2","callback_id":"123a","sizes":[[300,250],[300,600]],"bidFloor":0.2,"tid":"444","auctionId":"222"}]' ); }); @@ -218,6 +224,20 @@ describe('YieldmoAdapter', function () { expect(buildAndGetData([pubcidBid]).pubcid).to.deep.equal(pubcid); }); + it('should add transaction id as parameter of request', function () { + const transactionId = '54a58774-7a41-494e-9aaf-fa7b79164f0c'; + const pubcidBid = mockBannerBid({}); + const bidRequest = buildAndGetData([pubcidBid]); + expect(bidRequest.p).to.contain(transactionId); + }); + + it('should add auction id as parameter of request', function () { + const auctionId = '1d1a030790a475'; + const pubcidBid = mockBannerBid({}); + const bidRequest = buildAndGetData([pubcidBid]); + expect(bidRequest.p).to.contain(auctionId); + }); + it('should add unified id as parameter of request', function () { const unifiedIdBid = mockBannerBid({crumbs: undefined}); expect(buildAndGetData([unifiedIdBid]).tdid).to.deep.equal(mockBannerBid().userId.tdid); @@ -471,6 +491,18 @@ describe('YieldmoAdapter', function () { expect(requests[0].data.ats_envelope).to.equal(envelope); }); + it('should add transaction id to video bid request', function() { + const transactionId = '54a58774-7a41-494e-8cbc-fa7b79164f0c'; + const requests = build([mockVideoBid({})]); + expect(buildAndGetData([mockVideoBid({})]).tid).to.deep.equal(transactionId); + }); + + it('should add auction id to video bid request', function() { + const auctionId = '1d1a03073455'; + const requests = build([mockVideoBid({})]); + expect(buildAndGetData([mockVideoBid({})]).auctionId).to.deep.equal(auctionId); + }); + it('should add schain if it is in the bidRequest', () => { const schain = { ver: '1.0', From cb935989625ee12bc00db5606da0c3eda4a2410f Mon Sep 17 00:00:00 2001 From: Nayan Date: Wed, 2 Nov 2022 10:00:43 -0700 Subject: [PATCH 7/9] Adding gvlid to Yieldmo Adapter --- modules/yieldmoBidAdapter.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/yieldmoBidAdapter.js b/modules/yieldmoBidAdapter.js index 480b8e39439..43f86a5a3a5 100644 --- a/modules/yieldmoBidAdapter.js +++ b/modules/yieldmoBidAdapter.js @@ -20,6 +20,7 @@ import {find, includes} from '../src/polyfill.js'; import {createEidsArray} from './userId/eids.js'; const BIDDER_CODE = 'yieldmo'; +const GVLID = 173; const CURRENCY = 'USD'; const TIME_TO_LIVE = 300; const NET_REVENUE = true; @@ -42,7 +43,7 @@ const BANNER_REQUEST_PROPERTIES_TO_REDUCE = ['description', 'title', 'pr', 'page export const spec = { code: BIDDER_CODE, supportedMediaTypes: [BANNER, VIDEO], - + gvlid: GVLID, /** * Determines whether or not the given bid request is valid. * @param {object} bid, bid to validate From d7e1690cfc19f52f98bd39b0b06d0a0ab7878f04 Mon Sep 17 00:00:00 2001 From: Nayan Date: Wed, 2 Nov 2022 10:25:09 -0700 Subject: [PATCH 8/9] Resolving linting errors --- test/spec/modules/yieldmoBidAdapter_spec.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/test/spec/modules/yieldmoBidAdapter_spec.js b/test/spec/modules/yieldmoBidAdapter_spec.js index 85bc8847f66..1f24561ac4d 100644 --- a/test/spec/modules/yieldmoBidAdapter_spec.js +++ b/test/spec/modules/yieldmoBidAdapter_spec.js @@ -178,19 +178,14 @@ describe('YieldmoAdapter', function () { it('should place bid information into the p parameter of data', function () { let bidArray = [mockBannerBid()]; expect(buildAndGetPlacementInfo(bidArray)).to.equal( - '[{"placement_id":"adunit-code","callback_id":"30b31c1838de1e","sizes":[[300,250],[300,600]],"bidFloor":0.1,"auctionId":"1d1a030790a475"}]' - ); - // multiple placements bidArray.push(mockBannerBid( {adUnitCode: 'adunit-2', bidId: '123a', bidderRequestId: '321', auctionId: '222', transactionId: '444'}, {bidFloor: 0.2})); expect(buildAndGetPlacementInfo(bidArray)).to.equal( - '[{"placement_id":"adunit-code","callback_id":"30b31c1838de1e","sizes":[[300,250],[300,600]],"bidFloor":0.1,"auctionId":"1d1a030790a475"},' + '{"placement_id":"adunit-2","callback_id":"123a","sizes":[[300,250],[300,600]],"bidFloor":0.2,"auctionId":"222"}]' - ); }); @@ -199,7 +194,6 @@ describe('YieldmoAdapter', function () { let placementInfo = buildAndGetPlacementInfo(bidArray); expect(placementInfo).to.include('"ym_placement_id":"ym_1293871298"'); expect(placementInfo).not.to.include('"ym_placement_id":"ym_0987654321"'); - bidArray.push(mockBannerBid({}, {placementId: 'ym_0987654321'})); placementInfo = buildAndGetPlacementInfo(bidArray); expect(placementInfo).to.include('"ym_placement_id":"ym_1293871298"'); @@ -502,7 +496,6 @@ describe('YieldmoAdapter', function () { it('should add transaction id to video bid request', function() { const transactionId = '54a58774-7a41-494e-8cbc-fa7b79164f0c'; - const requestData = { ortb2Imp: { ext: { @@ -511,7 +504,6 @@ describe('YieldmoAdapter', function () { } }; expect(buildAndGetData([mockVideoBid({...requestData})]).imp[0].ext.tid).to.equal(transactionId); - }); it('should add auction id to video bid request', function() { From eacb4dc2b48d62f2632fe887d8a45f0135bf3d32 Mon Sep 17 00:00:00 2001 From: Nayan Date: Wed, 2 Nov 2022 10:25:36 -0700 Subject: [PATCH 9/9] Update yieldmoBidAdapter_spec.js --- test/spec/modules/yieldmoBidAdapter_spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/spec/modules/yieldmoBidAdapter_spec.js b/test/spec/modules/yieldmoBidAdapter_spec.js index 1f24561ac4d..8a0ebf863dd 100644 --- a/test/spec/modules/yieldmoBidAdapter_spec.js +++ b/test/spec/modules/yieldmoBidAdapter_spec.js @@ -224,7 +224,6 @@ describe('YieldmoAdapter', function () { it('should add transaction id as parameter of request', function () { const transactionId = '54a58774-7a41-494e-9aaf-fa7b79164f0c'; - const pubcidBid = mockBannerBid({ ortb2Imp: { ext: { tid: '54a58774-7a41-494e-9aaf-fa7b79164f0c',