From 57a0658e6627519217acce1e16cb3b6a4c5d0de9 Mon Sep 17 00:00:00 2001 From: brittanyzellman Date: Fri, 28 Sep 2018 15:03:48 -0400 Subject: [PATCH 01/10] removed dependancy on getTopWindowUrl for referer --- modules/tripleliftBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tripleliftBidAdapter.js b/modules/tripleliftBidAdapter.js index 795c75ef9bc..a40acb0b422 100644 --- a/modules/tripleliftBidAdapter.js +++ b/modules/tripleliftBidAdapter.js @@ -17,7 +17,7 @@ export const tripleliftAdapterSpec = { buildRequests: function(bidRequests, bidderRequest) { let tlCall = STR_ENDPOINT; - let referrer = utils.getTopWindowUrl(); + let referrer = bidderRequest.refererInfo.referer; let data = _buildPostBody(bidRequests); tlCall = utils.tryAppendQueryString(tlCall, 'lib', 'prebid'); From 5af1dc336412b49d4e62ddd3956467995ed95705 Mon Sep 17 00:00:00 2001 From: brittanyzellman Date: Fri, 28 Sep 2018 16:25:35 -0400 Subject: [PATCH 02/10] protect against undefined obj and remove test on old dependency --- modules/tripleliftBidAdapter.js | 7 +++++-- test/spec/modules/tripleliftBidAdapter_spec.js | 2 -- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/tripleliftBidAdapter.js b/modules/tripleliftBidAdapter.js index a40acb0b422..5989d0c2fca 100644 --- a/modules/tripleliftBidAdapter.js +++ b/modules/tripleliftBidAdapter.js @@ -17,12 +17,15 @@ export const tripleliftAdapterSpec = { buildRequests: function(bidRequests, bidderRequest) { let tlCall = STR_ENDPOINT; - let referrer = bidderRequest.refererInfo.referer; let data = _buildPostBody(bidRequests); tlCall = utils.tryAppendQueryString(tlCall, 'lib', 'prebid'); tlCall = utils.tryAppendQueryString(tlCall, 'v', '$prebid.version$'); - tlCall = utils.tryAppendQueryString(tlCall, 'referrer', referrer); + + if (bidderRequest && bidderRequest.refererInfo) { + let referrer = bidderRequest.refererInfo.referer; + tlCall = utils.tryAppendQueryString(tlCall, 'referrer', referrer); + } if (bidderRequest && bidderRequest.timeout) { tlCall = utils.tryAppendQueryString(tlCall, 'tmax', bidderRequest.timeout); diff --git a/test/spec/modules/tripleliftBidAdapter_spec.js b/test/spec/modules/tripleliftBidAdapter_spec.js index d3013d9be22..9d21edfe915 100644 --- a/test/spec/modules/tripleliftBidAdapter_spec.js +++ b/test/spec/modules/tripleliftBidAdapter_spec.js @@ -96,8 +96,6 @@ describe('triplelift adapter', function () { expect(url).to.match(/(?:tlx.3lift.com\/header\/auction)/) expect(url).to.match(/(?:lib=prebid)/) expect(url).to.match(/(?:prebid.version)/) - // expect(url).to.match(/(?:fe=)/) // - expect(url).to.match(/(?:referrer)/) }) }); From e29e5b6fa1e78701127ec549988ce2fca6ed8239 Mon Sep 17 00:00:00 2001 From: brittanyzellman Date: Tue, 23 Oct 2018 14:48:37 -0400 Subject: [PATCH 03/10] added unit test for referer and gdpr in query string --- .../spec/modules/tripleliftBidAdapter_spec.js | 40 +++++++++++++++++-- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/test/spec/modules/tripleliftBidAdapter_spec.js b/test/spec/modules/tripleliftBidAdapter_spec.js index 9d21edfe915..ca7c0b5534e 100644 --- a/test/spec/modules/tripleliftBidAdapter_spec.js +++ b/test/spec/modules/tripleliftBidAdapter_spec.js @@ -68,19 +68,42 @@ describe('triplelift adapter', function () { } ]; + let bidderRequest = { + bidderCode: 'triplelift', + auctionId: 'a7ebcd1d-66ff-4b5c-a82c-6a21a6ee5a18', + bidderRequestId: '5c55612f99bc11', + bids: [ + { + imp_id: 0, + cpm: 1.062, + width: 300, + height: 250, + ad: 'ad-markup', + iurl: 'https://s.adroll.com/a/IYR/N36/IYRN366MFVDITBAGNNT5U6.jpg' + } + ], + gdprConsent: { + consentString: 'BOONm0NOONma-AAAARh7______b9_3__7_9uz_Kv_K7Vf7nnG072lPVOQ6gEaY', + gdprApplies: true + }, + refererInfo: { + referer: 'http://.examplereferer.com' + } + }; + it('exists and is an object', function () { - const request = tripleliftAdapterSpec.buildRequests(bidRequests); + const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); expect(request).to.exist.and.to.be.a('object'); }); it('should only parse sizes that are of the proper length and format', function () { - const request = tripleliftAdapterSpec.buildRequests(bidRequests); + const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); expect(request.data.imp[0].banner.format).to.have.length(2); expect(request.data.imp[0].banner.format).to.deep.equal([{w: 300, h: 250}, {w: 300, h: 600}]); }); it('should be a post request and populate the payload', function () { - const request = tripleliftAdapterSpec.buildRequests(bidRequests); + const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); const payload = request.data; expect(payload).to.exist; expect(payload.imp[0].tagid).to.equal('12345'); @@ -89,13 +112,16 @@ describe('triplelift adapter', function () { }); it('should return a query string for TL call', function () { - const request = tripleliftAdapterSpec.buildRequests(bidRequests); + const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); const url = request.url; expect(url).to.exist; expect(url).to.be.a('string'); expect(url).to.match(/(?:tlx.3lift.com\/header\/auction)/) expect(url).to.match(/(?:lib=prebid)/) expect(url).to.match(/(?:prebid.version)/) + expect(url).to.match(/(?:referrer)/); + expect(url).to.match(/(?:gdpr)/); + expect(url).to.match(/(?:cmp_cs)/); }) }); @@ -131,6 +157,9 @@ describe('triplelift adapter', function () { gdprConsent: { consentString: 'BOONm0NOONma-AAAARh7______b9_3__7_9uz_Kv_K7Vf7nnG072lPVOQ6gEaY', gdprApplies: true + }, + refererInfo: { + referer: 'http://.examplereferer.com' } }; @@ -202,6 +231,9 @@ describe('triplelift adapter', function () { gdprConsent: { consentString: 'BOONm0NOONm0NABABAENAa-AAAARh7______b9_3__7_9uz_Kv_K7Vf7nnG072lPVA9LTOQ6gEaY', gdprApplies: true + }, + refererInfo: { + referer: 'http://.examplereferer.com' } }; let result = tripleliftAdapterSpec.interpretResponse(response, {bidderRequest}); From af59596b7406b39d49fdbbf4c4f3f7d0612816b3 Mon Sep 17 00:00:00 2001 From: brittanyzellman Date: Tue, 23 Oct 2018 17:31:41 -0400 Subject: [PATCH 04/10] removed gdpr test --- test/spec/modules/tripleliftBidAdapter_spec.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/spec/modules/tripleliftBidAdapter_spec.js b/test/spec/modules/tripleliftBidAdapter_spec.js index ca7c0b5534e..04a424d03c3 100644 --- a/test/spec/modules/tripleliftBidAdapter_spec.js +++ b/test/spec/modules/tripleliftBidAdapter_spec.js @@ -120,9 +120,7 @@ describe('triplelift adapter', function () { expect(url).to.match(/(?:lib=prebid)/) expect(url).to.match(/(?:prebid.version)/) expect(url).to.match(/(?:referrer)/); - expect(url).to.match(/(?:gdpr)/); - expect(url).to.match(/(?:cmp_cs)/); - }) + }); }); describe('interpretResponse', function () { From f1dfed2ae6df4c1d5f68b9374b93ac2a1c81cf3a Mon Sep 17 00:00:00 2001 From: brittanyzellman Date: Tue, 23 Oct 2018 17:42:10 -0400 Subject: [PATCH 05/10] removed gdpr from bidderRequest obj --- test/spec/modules/tripleliftBidAdapter_spec.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/test/spec/modules/tripleliftBidAdapter_spec.js b/test/spec/modules/tripleliftBidAdapter_spec.js index 04a424d03c3..1e620945e37 100644 --- a/test/spec/modules/tripleliftBidAdapter_spec.js +++ b/test/spec/modules/tripleliftBidAdapter_spec.js @@ -82,10 +82,6 @@ describe('triplelift adapter', function () { iurl: 'https://s.adroll.com/a/IYR/N36/IYRN366MFVDITBAGNNT5U6.jpg' } ], - gdprConsent: { - consentString: 'BOONm0NOONma-AAAARh7______b9_3__7_9uz_Kv_K7Vf7nnG072lPVOQ6gEaY', - gdprApplies: true - }, refererInfo: { referer: 'http://.examplereferer.com' } @@ -152,10 +148,6 @@ describe('triplelift adapter', function () { iurl: 'https://s.adroll.com/a/IYR/N36/IYRN366MFVDITBAGNNT5U6.jpg' } ], - gdprConsent: { - consentString: 'BOONm0NOONma-AAAARh7______b9_3__7_9uz_Kv_K7Vf7nnG072lPVOQ6gEaY', - gdprApplies: true - }, refererInfo: { referer: 'http://.examplereferer.com' } @@ -226,10 +218,6 @@ describe('triplelift adapter', function () { iurl: 'https://s.adroll.com/a/IYR/N36/IYRN366MFVDITBAGNNT5U6.jpg' } ], - gdprConsent: { - consentString: 'BOONm0NOONm0NABABAENAa-AAAARh7______b9_3__7_9uz_Kv_K7Vf7nnG072lPVA9LTOQ6gEaY', - gdprApplies: true - }, refererInfo: { referer: 'http://.examplereferer.com' } From 5908387b8f266291630e5fad3342864e2125a776 Mon Sep 17 00:00:00 2001 From: brittanyzellman Date: Wed, 24 Oct 2018 15:04:35 -0400 Subject: [PATCH 06/10] decontructed bidder request obj in chai test --- test/spec/modules/tripleliftBidAdapter_spec.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/spec/modules/tripleliftBidAdapter_spec.js b/test/spec/modules/tripleliftBidAdapter_spec.js index 1e620945e37..1bd6b499871 100644 --- a/test/spec/modules/tripleliftBidAdapter_spec.js +++ b/test/spec/modules/tripleliftBidAdapter_spec.js @@ -83,23 +83,23 @@ describe('triplelift adapter', function () { } ], refererInfo: { - referer: 'http://.examplereferer.com' + referer: 'http://examplereferer.com' } }; it('exists and is an object', function () { - const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); + const request = tripleliftAdapterSpec.buildRequests(bidRequests, {bidderRequest}); expect(request).to.exist.and.to.be.a('object'); }); it('should only parse sizes that are of the proper length and format', function () { - const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); + const request = tripleliftAdapterSpec.buildRequests(bidRequests, {bidderRequest}); expect(request.data.imp[0].banner.format).to.have.length(2); expect(request.data.imp[0].banner.format).to.deep.equal([{w: 300, h: 250}, {w: 300, h: 600}]); }); it('should be a post request and populate the payload', function () { - const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); + const request = tripleliftAdapterSpec.buildRequests(bidRequests, {bidderRequest}); const payload = request.data; expect(payload).to.exist; expect(payload.imp[0].tagid).to.equal('12345'); @@ -108,7 +108,7 @@ describe('triplelift adapter', function () { }); it('should return a query string for TL call', function () { - const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); + const request = tripleliftAdapterSpec.buildRequests(bidRequests, {bidderRequest}); const url = request.url; expect(url).to.exist; expect(url).to.be.a('string'); @@ -149,7 +149,7 @@ describe('triplelift adapter', function () { } ], refererInfo: { - referer: 'http://.examplereferer.com' + referer: 'http://examplereferer.com' } }; @@ -219,7 +219,7 @@ describe('triplelift adapter', function () { } ], refererInfo: { - referer: 'http://.examplereferer.com' + referer: 'http://examplereferer.com' } }; let result = tripleliftAdapterSpec.interpretResponse(response, {bidderRequest}); From 91ad9d2b188469c10ec503009e8576a5b7abaf95 Mon Sep 17 00:00:00 2001 From: brittanyzellman Date: Wed, 24 Oct 2018 18:56:38 -0400 Subject: [PATCH 07/10] just need to run karma tests again --- test/spec/modules/tripleliftBidAdapter_spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/spec/modules/tripleliftBidAdapter_spec.js b/test/spec/modules/tripleliftBidAdapter_spec.js index 1bd6b499871..b72074991bd 100644 --- a/test/spec/modules/tripleliftBidAdapter_spec.js +++ b/test/spec/modules/tripleliftBidAdapter_spec.js @@ -115,7 +115,7 @@ describe('triplelift adapter', function () { expect(url).to.match(/(?:tlx.3lift.com\/header\/auction)/) expect(url).to.match(/(?:lib=prebid)/) expect(url).to.match(/(?:prebid.version)/) - expect(url).to.match(/(?:referrer)/); + // expect(url).to.match(/(?:referrer)/); }); }); From 16195df951e5caaf19f23bd0a745d2743285e4a4 Mon Sep 17 00:00:00 2001 From: brittanyzellman Date: Thu, 25 Oct 2018 09:51:58 -0400 Subject: [PATCH 08/10] added gdpr consent to all bidderRequest obj in chai tests --- .../spec/modules/tripleliftBidAdapter_spec.js | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/test/spec/modules/tripleliftBidAdapter_spec.js b/test/spec/modules/tripleliftBidAdapter_spec.js index b72074991bd..f614bdbd31a 100644 --- a/test/spec/modules/tripleliftBidAdapter_spec.js +++ b/test/spec/modules/tripleliftBidAdapter_spec.js @@ -84,22 +84,26 @@ describe('triplelift adapter', function () { ], refererInfo: { referer: 'http://examplereferer.com' + }, + gdprConsent: { + consentString: 'BOONm0NOONm0NABABAENAa-AAAARh7______b9_3__7_9uz_Kv_K7Vf7nnG072lPVA9LTOQ6gEaY', + gdprApplies: true } }; it('exists and is an object', function () { - const request = tripleliftAdapterSpec.buildRequests(bidRequests, {bidderRequest}); + const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); expect(request).to.exist.and.to.be.a('object'); }); it('should only parse sizes that are of the proper length and format', function () { - const request = tripleliftAdapterSpec.buildRequests(bidRequests, {bidderRequest}); + const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); expect(request.data.imp[0].banner.format).to.have.length(2); expect(request.data.imp[0].banner.format).to.deep.equal([{w: 300, h: 250}, {w: 300, h: 600}]); }); it('should be a post request and populate the payload', function () { - const request = tripleliftAdapterSpec.buildRequests(bidRequests, {bidderRequest}); + const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); const payload = request.data; expect(payload).to.exist; expect(payload.imp[0].tagid).to.equal('12345'); @@ -108,14 +112,14 @@ describe('triplelift adapter', function () { }); it('should return a query string for TL call', function () { - const request = tripleliftAdapterSpec.buildRequests(bidRequests, {bidderRequest}); + const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); const url = request.url; expect(url).to.exist; expect(url).to.be.a('string'); expect(url).to.match(/(?:tlx.3lift.com\/header\/auction)/) expect(url).to.match(/(?:lib=prebid)/) expect(url).to.match(/(?:prebid.version)/) - // expect(url).to.match(/(?:referrer)/); + expect(url).to.match(/(?:referrer)/); }); }); @@ -150,6 +154,10 @@ describe('triplelift adapter', function () { ], refererInfo: { referer: 'http://examplereferer.com' + }, + gdprConsent: { + consentString: 'BOONm0NOONm0NABABAENAa-AAAARh7______b9_3__7_9uz_Kv_K7Vf7nnG072lPVA9LTOQ6gEaY', + gdprApplies: true } }; @@ -220,6 +228,10 @@ describe('triplelift adapter', function () { ], refererInfo: { referer: 'http://examplereferer.com' + }, + gdprConsent: { + consentString: 'BOONm0NOONm0NABABAENAa-AAAARh7______b9_3__7_9uz_Kv_K7Vf7nnG072lPVA9LTOQ6gEaY', + gdprApplies: true } }; let result = tripleliftAdapterSpec.interpretResponse(response, {bidderRequest}); From 36f394188ac80e2623a11bb465d670fecd243e1a Mon Sep 17 00:00:00 2001 From: brittanyzellman Date: Thu, 15 Nov 2018 16:05:23 -0500 Subject: [PATCH 09/10] changed creativeId to be a Triplelift specific id rather than represent SRA impression --- modules/tripleliftBidAdapter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/tripleliftBidAdapter.js b/modules/tripleliftBidAdapter.js index 5989d0c2fca..5ab87b7de4a 100644 --- a/modules/tripleliftBidAdapter.js +++ b/modules/tripleliftBidAdapter.js @@ -113,11 +113,11 @@ function _buildResponseObject(bidderRequest, bid) { let width = bid.width || 1; let height = bid.height || 1; let dealId = bid.deal_id || ''; - let creativeId = bid.imp_id; + let creativeId = bid.crid; if (bid.cpm != 0 && bid.ad) { bidResponse = { - requestId: bidderRequest.bids[creativeId].bidId, + requestId: bidderRequest.bids[bid.imp_id].bidId, cpm: bid.cpm, width: width, height: height, From f18b93dca28e86999885cef34ac2c3ca4654b60d Mon Sep 17 00:00:00 2001 From: brittanyzellman Date: Thu, 15 Nov 2018 17:00:18 -0500 Subject: [PATCH 10/10] error-proofed creative id --- modules/tripleliftBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tripleliftBidAdapter.js b/modules/tripleliftBidAdapter.js index 5ab87b7de4a..fac6224d1dc 100644 --- a/modules/tripleliftBidAdapter.js +++ b/modules/tripleliftBidAdapter.js @@ -113,7 +113,7 @@ function _buildResponseObject(bidderRequest, bid) { let width = bid.width || 1; let height = bid.height || 1; let dealId = bid.deal_id || ''; - let creativeId = bid.crid; + let creativeId = bid.crid || ''; if (bid.cpm != 0 && bid.ad) { bidResponse = {