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

Adkernel Bid Adapter: User ID module support #6964

Merged
merged 1 commit into from
Jun 8, 2021
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
11 changes: 11 additions & 0 deletions modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@ function buildRtbRequest(imps, bidderRequest, schain) {
if (schain) {
utils.deepSetValue(req, 'source.ext.schain', schain);
}
let eids = getExtendedUserIds(bidderRequest);
if (eids) {
utils.deepSetValue(req, 'user.ext.eids', eids);
}
return req;
}

Expand Down Expand Up @@ -435,6 +439,13 @@ function createSite(refInfo) {
return site;
}

function getExtendedUserIds(bidderRequest) {
let eids = utils.deepAccess(bidderRequest, 'bids.0.userIdAsEids');
if (utils.isArray(eids)) {
return eids;
}
}

/**
* Format creative with optional nurl call
* @param bid rtb Bid object
Expand Down
22 changes: 21 additions & 1 deletion test/spec/modules/adkernelBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ describe('Adkernel adapter', function () {
banner: {
sizes: [[728, 90]]
}
}
},
userIdAsEids: [
{
source: 'crwdcntrl.net',
uids: [
{atype: 1, id: '97d09fbba28542b7acbb6317c9534945a702b74c5993c352f332cfe83f40cdd9'}
]
}
]
}, bid3_host2 = {
bidder: 'adkernel',
params: {zoneId: 1, host: 'rtb-private.adkernel.com'},
Expand Down Expand Up @@ -251,6 +259,7 @@ describe('Adkernel adapter', function () {

function buildRequest(bidRequests, bidderRequest = DEFAULT_BIDDER_REQUEST, dnt = true) {
let dntmock = sandbox.stub(utils, 'getDNT').callsFake(() => dnt);
bidderRequest.bids = bidRequests;
let pbRequests = spec.buildRequests(bidRequests, bidderRequest);
dntmock.restore();
let rtbRequests = pbRequests.map(r => JSON.parse(r.data));
Expand Down Expand Up @@ -381,6 +390,17 @@ describe('Adkernel adapter', function () {
let [_, bidRequests] = buildRequest([bid]);
expect(bidRequests[0].imp[0]).to.have.property('bidfloor', 0.145);
});

it('should forward user ids if available', function() {
let bid = Object.assign({}, bid2_zone2);
let [_, bidRequests] = buildRequest([bid]);
expect(bidRequests[0]).to.have.property('user');
expect(bidRequests[0].user).to.have.property('ext');
expect(bidRequests[0].user.ext).to.have.property('eids');
expect(bidRequests[0].user.ext.eids).to.be.an('array').that.is.not.empty;
expect(bidRequests[0].user.ext.eids[0]).to.have.property('source');
expect(bidRequests[0].user.ext.eids[0]).to.have.property('uids');
});
});

describe('video request building', function () {
Expand Down