From ebc6ceac406b47fabca671818e40bf6b6d24ffe2 Mon Sep 17 00:00:00 2001 From: Ryan McNierney Date: Wed, 3 Jul 2019 11:18:44 -0400 Subject: [PATCH 1/4] Add user support in _buildPostBody --- modules/tripleliftBidAdapter.js | 30 +++++++++++++++++++++-- package-lock.json | 43 ++++++++++++++++++++++++--------- 2 files changed, 59 insertions(+), 14 deletions(-) diff --git a/modules/tripleliftBidAdapter.js b/modules/tripleliftBidAdapter.js index 748c5087201..207ef1c27f0 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 data = _buildPostBody(bidRequests); + let data = _buildPostBody(bidRequests, bidderRequest); tlCall = utils.tryAppendQueryString(tlCall, 'lib', 'prebid'); tlCall = utils.tryAppendQueryString(tlCall, 'v', '$prebid.version$'); @@ -78,7 +78,7 @@ export const tripleliftAdapterSpec = { } } -function _buildPostBody(bidRequests) { +function _buildPostBody(bidRequests, bidderRequest) { let data = {}; data.imp = bidRequests.map(function(bid, index) { return { @@ -91,6 +91,14 @@ function _buildPostBody(bidRequests) { } }); + // Handle consortia user ids. Eids will be an array of consortia user ids + let eids = handleConsortiaUserIds(bidderRequest) + if (eids.length > 0) { + data.user = { + ext: {eids} + } + } + return data; } @@ -108,6 +116,24 @@ function _isValidSize(size) { return (size.length === 2 && typeof size[0] === 'number' && typeof size[1] === 'number'); } +function handleConsortiaUserIds(bidderRequest) { + let eids = []; + // TDID + if (bidderRequest.userId && bidderRequest.userId.tdid) { + eids.push({ + source: 'adserver.org', + uids: [{ + id: bidderRequest.userId.tdid, + ext: { + rtiPartner: 'TDID' + } + }] + }) + } + + return eids; +} + function _buildResponseObject(bidderRequest, bid) { let bidResponse = {}; let width = bid.width || 1; diff --git a/package-lock.json b/package-lock.json index 1d224cebc76..7595386f02c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "prebid.js", - "version": "2.21.0-pre", + "version": "2.22.0-pre", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -6401,7 +6401,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -6422,12 +6423,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6442,17 +6445,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -6569,7 +6575,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -6581,6 +6588,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6595,6 +6603,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -6602,12 +6611,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -6626,6 +6637,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -6706,7 +6718,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -6718,6 +6731,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -6803,7 +6817,8 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -6839,6 +6854,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -6858,6 +6874,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -6901,12 +6918,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, From b3edfb38f485adac2b91144f612211aa9ebb0979 Mon Sep 17 00:00:00 2001 From: Ryan McNierney Date: Wed, 3 Jul 2019 11:51:16 -0400 Subject: [PATCH 2/4] Add tdid check to test spec --- test/spec/modules/tripleliftBidAdapter_spec.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/spec/modules/tripleliftBidAdapter_spec.js b/test/spec/modules/tripleliftBidAdapter_spec.js index 171a97bafd9..dbae392f941 100644 --- a/test/spec/modules/tripleliftBidAdapter_spec.js +++ b/test/spec/modules/tripleliftBidAdapter_spec.js @@ -89,6 +89,9 @@ describe('triplelift adapter', function () { gdprConsent: { consentString: 'BOONm0NOONm0NABABAENAa-AAAARh7______b9_3__7_9uz_Kv_K7Vf7nnG072lPVA9LTOQ6gEaY', gdprApplies: true + }, + userId: { + tdid: '6bca7f6b-a98a-46c0-be05-6020f7604598' } }; @@ -112,6 +115,13 @@ describe('triplelift adapter', function () { expect(payload.imp[0].banner.format).to.deep.equal([{w: 300, h: 250}, {w: 300, h: 600}]); }); + it('should add tdid to the payload if included', function () { + const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); + const payload = request.data; + expect(payload).to.exist; + expect(payload.user).to.deep.equal({ext: {eids: [{source: 'adserver.org', uids: [{id: '6bca7f6b-a98a-46c0-be05-6020f7604598', ext: {rtiPartner: 'TDID'}}]}]}}); + }); + it('should return a query string for TL call', function () { const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); const url = request.url; From 521aa4a52f6bf2267020777bbc7b8980be07fb2f Mon Sep 17 00:00:00 2001 From: Ryan McNierney Date: Wed, 10 Jul 2019 10:20:41 -0400 Subject: [PATCH 3/4] Remove comments --- modules/tripleliftBidAdapter.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/tripleliftBidAdapter.js b/modules/tripleliftBidAdapter.js index 207ef1c27f0..ab6180cf45d 100644 --- a/modules/tripleliftBidAdapter.js +++ b/modules/tripleliftBidAdapter.js @@ -91,7 +91,6 @@ function _buildPostBody(bidRequests, bidderRequest) { } }); - // Handle consortia user ids. Eids will be an array of consortia user ids let eids = handleConsortiaUserIds(bidderRequest) if (eids.length > 0) { data.user = { @@ -118,7 +117,6 @@ function _isValidSize(size) { function handleConsortiaUserIds(bidderRequest) { let eids = []; - // TDID if (bidderRequest.userId && bidderRequest.userId.tdid) { eids.push({ source: 'adserver.org', From 39d74eee26204d633fae5a8ba8472443043d5cc5 Mon Sep 17 00:00:00 2001 From: Ryan McNierney Date: Tue, 16 Jul 2019 11:46:53 -0400 Subject: [PATCH 4/4] Removing package-lock.json changes --- package-lock.json | 43 ++++++++++++------------------------------- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7595386f02c..1d224cebc76 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "prebid.js", - "version": "2.22.0-pre", + "version": "2.21.0-pre", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -6401,8 +6401,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -6423,14 +6422,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6445,20 +6442,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -6575,8 +6569,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -6588,7 +6581,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6603,7 +6595,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -6611,14 +6602,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -6637,7 +6626,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -6718,8 +6706,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -6731,7 +6718,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -6817,8 +6803,7 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -6854,7 +6839,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -6874,7 +6858,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -6918,14 +6901,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true } } },