Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to rubiconBidAdapter to include criteoId support #5806

Merged
merged 1 commit into from
Oct 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export const spec = {
const eids = utils.deepAccess(bidderRequest, 'bids.0.userIdAsEids');
if (eids && eids.length) {
// filter out unsupported id systems
utils.deepSetValue(data, 'user.ext.eids', eids.filter(eid => ['adserver.org', 'pubcid.org', 'liveintent.com', 'liveramp.com', 'sharedid.org'].indexOf(eid.source) !== -1));
utils.deepSetValue(data, 'user.ext.eids', eids.filter(eid => ['adserver.org', 'pubcid.org', 'liveintent.com', 'liveramp.com', 'sharedid.org', 'criteo.com'].indexOf(eid.source) !== -1));

// liveintent requires additional props to be set
const liveIntentEid = find(data.user.ext.eids, eid => eid.source === 'liveintent.com');
Expand Down Expand Up @@ -538,6 +538,10 @@ export const spec = {
if (sharedId) {
data['eid_sharedid.org'] = `${sharedId.uids[0].id}^${sharedId.uids[0].atype}^${sharedId.uids[0].ext.third}`;
}
const criteoId = find(bidRequest.userIdAsEids, eid => eid.source === 'criteo.com');
if (criteoId) {
data['eid_criteo.com'] = `${criteoId.uids[0].id}^${criteoId.uids[0].atype}`;
}
}

// set ppuid value from config value
Expand Down
21 changes: 20 additions & 1 deletion test/spec/modules/rubiconBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ describe('the rubicon adapter', function () {
uids: [{
id: '4444444'
}]
}]
}],
criteoId: '1111'
};
bid.userIdAsEids = createEidsArray(bid.userId);
bid.storedAuctionResponse = 11111;
Expand Down Expand Up @@ -1371,6 +1372,20 @@ describe('the rubicon adapter', function () {
});
});

describe('Criteo support', function () {
it('should send eid_criteo.com when userIdAsEids contains criteo', function () {
const clonedBid = utils.deepClone(bidderRequest.bids[0]);
clonedBid.userId = {
criteoId: '1111'
};
clonedBid.userIdAsEids = createEidsArray(clonedBid.userId);
let [request] = spec.buildRequests([clonedBid], bidderRequest);
let data = parseQuery(request.data);

expect(data['eid_criteo.com']).to.equal('1111^1');
});
});

describe('SharedID support', function () {
it('should send sharedid when userIdAsEids contains sharedId', function () {
const clonedBid = utils.deepClone(bidderRequest.bids[0]);
Expand Down Expand Up @@ -1654,6 +1669,10 @@ describe('the rubicon adapter', function () {
expect(post.user.ext.eids[4].source).to.equal('pubcid.org');
expect(post.user.ext.eids[4].uids[0].atype).to.equal(1);
expect(post.user.ext.eids[4].uids[0].id).to.equal('4000');
// CriteoId should exist
expect(post.user.ext.eids[5].source).to.equal('criteo.com');
expect(post.user.ext.eids[5].uids[0].id).to.equal('1111');
expect(post.user.ext.eids[5].uids[0].atype).to.equal(1);

expect(post.regs.ext.gdpr).to.equal(1);
expect(post.regs.ext.us_privacy).to.equal('1NYN');
Expand Down