Skip to content

Commit c762a8b

Browse files
bjorn-lwChrisHuie
andauthored
LiveWrapper Bid Adapter: use userIdAsEids to handle all user ids (#6445)
* Livewrapped bid and analytics adapter * Fixed some tests for browser compatibility * Fixed some tests for browser compatibility * Changed analytics adapter code name * Fix double quote in debug message * modified how gdpr is being passed * Added support for Publisher Common ID Module * Corrections for ttr in analytics * ANalytics updates * Auction start time stamp changed * Detect recovered ad blocked requests Make it possible to pass dynamic parameters to adapter * Collect info on ad units receiving any valid bid * Support for ID5 Pass metadata from adapter * Typo in test + eids on wrong level * Fix for Prebid 3.0 * Fix get referer * http -> https in tests * Native support * Read sizes from mediatype.banner * Revert accidental commit * Support native data collection + minor refactorings * Set analytics endpoint * Support for app parameters * Fix issue where adunits with bids were not counted on reload * Send debug info from adapter to external debugger * SChain support * Send GDPR data in analytics request * video support Video support * Report back floor via analytic * Send auction id and adunit/bidder connection id * Criteo id support * Updated example * livewrapped Analytics Adapter info file * Livewrapped gvlid * Handle all User Ids * kick off tests manually Co-authored-by: Chris Huie <[email protected]>
1 parent e266393 commit c762a8b

File tree

2 files changed

+33
-73
lines changed

2 files changed

+33
-73
lines changed

modules/livewrappedBidAdapter.js

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -259,34 +259,10 @@ function getAdblockerRecovered() {
259259
} catch (e) {}
260260
}
261261

262-
function AddExternalUserId(eids, value, source, atype, rtiPartner) {
263-
if (utils.isStr(value)) {
264-
var eid = {
265-
source,
266-
uids: [{
267-
id: value,
268-
atype
269-
}]
270-
};
271-
272-
if (rtiPartner) {
273-
eid.uids[0] = {ext: {rtiPartner}};
274-
}
275-
276-
eids.push(eid);
277-
}
278-
}
279-
280262
function handleEids(bidRequests) {
281-
let eids = [];
282263
const bidRequest = bidRequests[0];
283-
if (bidRequest && bidRequest.userId) {
284-
AddExternalUserId(eids, utils.deepAccess(bidRequest, `userId.pubcid`), 'pubcid.org', 1); // Also add this to eids
285-
AddExternalUserId(eids, utils.deepAccess(bidRequest, `userId.id5id.uid`), 'id5-sync.com', 1);
286-
AddExternalUserId(eids, utils.deepAccess(bidRequest, `userId.criteoId`), 'criteo.com', 1);
287-
}
288-
if (eids.length > 0) {
289-
return {user: {ext: {eids}}};
264+
if (bidRequest && bidRequest.userIdAsEids) {
265+
return {user: {ext: {eids: bidRequest.userIdAsEids}}};
290266
}
291267

292268
return undefined;

test/spec/modules/livewrappedBidAdapter_spec.js

Lines changed: 31 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -781,61 +781,45 @@ describe('Livewrapped adapter tests', function () {
781781
});
782782
});
783783

784-
it('should make use of Id5-Id if available', function() {
784+
it('should make use of user ids if available', function() {
785785
sandbox.stub(utils, 'isSafariBrowser').callsFake(() => false);
786786
sandbox.stub(storage, 'cookiesAreEnabled').callsFake(() => true);
787787
let testbidRequest = clone(bidderRequest);
788788
delete testbidRequest.bids[0].params.userId;
789-
testbidRequest.bids[0].userId = {};
790-
testbidRequest.bids[0].userId.id5id = { uid: 'id5-user-id' };
791-
let result = spec.buildRequests(testbidRequest.bids, testbidRequest);
792-
let data = JSON.parse(result.data);
793-
794-
expect(data.rtbData.user.ext.eids).to.deep.equal([{
795-
'source': 'id5-sync.com',
796-
'uids': [{
797-
'id': 'id5-user-id',
798-
'atype': 1
799-
}]
800-
}]);
801-
});
802-
803-
it('should make use of publisher common Id if available', function() {
804-
sandbox.stub(utils, 'isSafariBrowser').callsFake(() => false);
805-
sandbox.stub(storage, 'cookiesAreEnabled').callsFake(() => true);
806-
let testbidRequest = clone(bidderRequest);
807-
delete testbidRequest.bids[0].params.userId;
808-
testbidRequest.bids[0].userId = {};
809-
testbidRequest.bids[0].userId.pubcid = 'publisher-common-id';
810-
let result = spec.buildRequests(testbidRequest.bids, testbidRequest);
811-
let data = JSON.parse(result.data);
812-
813-
expect(data.rtbData.user.ext.eids).to.deep.equal([{
814-
'source': 'pubcid.org',
815-
'uids': [{
816-
'id': 'publisher-common-id',
817-
'atype': 1
818-
}]
819-
}]);
820-
});
789+
testbidRequest.bids[0].userIdAsEids = [
790+
{
791+
'source': 'id5-sync.com',
792+
'uids': [{
793+
'id': 'ID5-id',
794+
'atype': 1,
795+
'ext': {
796+
'linkType': 2
797+
}
798+
}]
799+
},
800+
{
801+
'source': 'pubcid.org',
802+
'uids': [{
803+
'id': 'publisher-common-id',
804+
'atype': 1
805+
}]
806+
},
807+
{
808+
'source': 'sharedid.org',
809+
'uids': [{
810+
'id': 'sharedid',
811+
'atype': 1,
812+
'ext': {
813+
'third': 'sharedid'
814+
}
815+
}]
816+
}
817+
];
821818

822-
it('should make use of criteoId if available', function() {
823-
sandbox.stub(utils, 'isSafariBrowser').callsFake(() => false);
824-
sandbox.stub(storage, 'cookiesAreEnabled').callsFake(() => true);
825-
let testbidRequest = clone(bidderRequest);
826-
delete testbidRequest.bids[0].params.userId;
827-
testbidRequest.bids[0].userId = {};
828-
testbidRequest.bids[0].userId.criteoId = 'criteo-id';
829819
let result = spec.buildRequests(testbidRequest.bids, testbidRequest);
830820
let data = JSON.parse(result.data);
831821

832-
expect(data.rtbData.user.ext.eids).to.deep.equal([{
833-
'source': 'criteo.com',
834-
'uids': [{
835-
'id': 'criteo-id',
836-
'atype': 1
837-
}]
838-
}]);
822+
expect(data.rtbData.user.ext.eids).to.deep.equal(testbidRequest.bids[0].userIdAsEids);
839823
});
840824

841825
it('should send schain object if available', function() {

0 commit comments

Comments
 (0)