diff --git a/modules/gumgumBidAdapter.js b/modules/gumgumBidAdapter.js index fdcbbd8a0f3..9b4ec41049c 100644 --- a/modules/gumgumBidAdapter.js +++ b/modules/gumgumBidAdapter.js @@ -83,14 +83,6 @@ function getWrapperCode(wrapper, data) { return wrapper.replace('AD_JSON', window.btoa(JSON.stringify(data))) } -function _getTradeDeskIDParam(userId) { - const unifiedIdObj = {}; - if (userId.tdid) { - unifiedIdObj.tdid = userId.tdid; - } - return unifiedIdObj; -} - function _getDigiTrustQueryParams(userId) { let digiTrustId = userId.digitrustid && userId.digitrustid.data; // Verify there is an ID and this user has not opted out @@ -230,6 +222,29 @@ function _getFloor (mediaTypes, staticBidFloor, bid) { return bidFloor; } +function getEids (userId) { + const idProperties = [ + 'uid', + 'eid', + 'lipbid' + ]; + + return Object.keys(userId).reduce(function (eids, provider) { + const eid = userId[provider]; + switch (typeof eid) { + case 'string': + eids[provider] = eid; + break; + + case 'object': + const idProp = idProperties.filter(prop => eid.hasOwnProperty(prop)); + idProp.length && (eids[provider] = eid[idProp[0]]); + break; + } + return eids; + }, {}); +} + /** * Make a server request from the list of BidRequests. * @@ -253,10 +268,14 @@ function buildRequests (validBidRequests, bidderRequest) { ortb2Imp } = bidRequest; const { currency, floor } = _getFloor(mediaTypes, params.bidfloor, bidRequest); + const eids = getEids(userId); let sizes = [1, 1]; let data = {}; let gpid = ''; + // ADTS-134 Retrieve ID envelopes + for (const eid in eids) data[eid] = eids[eid]; + // ADJS-1024 if (utils.deepAccess(ortb2Imp, 'ext.data.adserver.name')) { gpid = ortb2Imp.ext.data.adserver.adslot @@ -328,7 +347,7 @@ function buildRequests (validBidRequests, bidderRequest) { url: BID_ENDPOINT, method: 'GET', gpid: gpid, - data: Object.assign(data, _getBrowserParams(topWindowUrl), _getDigiTrustQueryParams(userId), _getTradeDeskIDParam(userId)) + data: Object.assign(data, _getBrowserParams(topWindowUrl), _getDigiTrustQueryParams(userId)) }) }); return bids; diff --git a/test/spec/modules/gumgumBidAdapter_spec.js b/test/spec/modules/gumgumBidAdapter_spec.js index 19d3309e3ee..75a9c5c975a 100644 --- a/test/spec/modules/gumgumBidAdapter_spec.js +++ b/test/spec/modules/gumgumBidAdapter_spec.js @@ -447,6 +447,20 @@ describe('gumgumAdapter', function () { const request = spec.buildRequests(bidRequests)[0]; expect(request.data).to.not.include.any.keys('tdid'); }); + it('should send IDL envelope ID if available', function () { + const idl_env = 'abc123'; + const request = { ...bidRequests[0], userId: { idl_env } }; + const bidRequest = spec.buildRequests([request])[0]; + + expect(bidRequest.data).to.have.property('idl_env'); + expect(bidRequest.data.idl_env).to.equal(idl_env); + }); + it('should not send IDL envelope if not available', function () { + const request = { ...bidRequests[0] }; + const bidRequest = spec.buildRequests([request])[0]; + + expect(bidRequest.data).to.not.have.property('idl_env'); + }); it('should send schain parameter in serialized form', function () { const serializedForm = '1.0,1!exchange1.com,1234,1,bid-request-1,publisher,publisher.com!exchange2.com,abcd,1,bid-request-2,intermediary,intermediary.com' const request = spec.buildRequests(bidRequests)[0];