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

Jixie Bid adapter: support more userids #8314

Merged
merged 16 commits into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
29 changes: 29 additions & 0 deletions modules/jixieBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { BANNER, VIDEO } from '../src/mediaTypes.js';
import { ajax } from '../src/ajax.js';
import { getRefererInfo } from '../src/refererDetection.js';
import { Renderer } from '../src/Renderer.js';
import {createEidsArray} from './userId/eids.js';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dgirardi please note another location this is occurring

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, this does not need to happen - adapters can just take validBidRequest.userIdsAsEids.


const BIDDER_CODE = 'jixie';
export const storage = getStorageManager({bidderCode: BIDDER_CODE});
Expand Down Expand Up @@ -121,6 +122,17 @@ function getMiscDims_() {
return ret;
}

/* function addUserId(eids, id, source, rti) {
if (id) {
if (rti) {
eids.push({ source, id, rti_partner: rti });
} else {
eids.push({ source, id });
}
}
return eids;
} */

// easier for replacement in the unit test
export const internal = {
getDevice: getDevice_,
Expand Down Expand Up @@ -163,7 +175,22 @@ export const spec = {
}

let ids = fetchIds_();
let eids = [];
let miscDims = internal.getMiscDims();

// all available user ids are sent to our backend in the standard array layout:
if (validBidRequests[0].userId) {
let eids1 = createEidsArray(validBidRequests[0].userId);
if (eids1.length) {
eids = eids1;
}
}
// we want to send this blob of info to our backend:
let pg = config.getConfig('priceGranularity');
if (!pg) {
pg = {};
}

let transformedParams = Object.assign({}, {
auctionid: bidderRequest.auctionId,
timeout: bidderRequest.timeout,
Expand All @@ -174,6 +201,8 @@ export const spec = {
pageurl: miscDims.pageurl,
mkeywords: miscDims.mkeywords,
bids: bids,
eids: eids,
pricegranularity: pg,
cfg: jixieCfgBlob
}, ids);
return Object.assign({}, {
Expand Down
1 change: 1 addition & 0 deletions modules/jixieBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Maintainer: contact@jixie.io
# Description

Module that connects to Jixie demand source to fetch bids.
All prebid-supported user ids are sent to Jixie endpoint, if available.

# Test Parameters
```
Expand Down
96 changes: 96 additions & 0 deletions test/spec/modules/jixieBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,102 @@ describe('jixie Adapter', function () {
getLocalStorageStub.restore();
miscDimsStub.restore();
});// it

it('it should popular the pricegranularity when info is available', function () {
let content = {
'ranges': [{
'max': 12,
'increment': 0.5
},
{
'max': 5,
'increment': 0.1
}],
precision: 1
};
let getConfigStub = sinon.stub(config, 'getConfig');
getConfigStub.callsFake(function fakeFn(prop) {
if (prop == 'priceGranularity') {
return content;
}
return null;
});

const oneSpecialBidReq = Object.assign({}, bidRequests_[0]);
const request = spec.buildRequests([oneSpecialBidReq], bidderRequest_);
const payload = JSON.parse(request.data);
getConfigStub.restore();
expect(payload.pricegranularity).to.deep.include(content);
});

it('should populate eids when supported userIds are available', function () {
const oneSpecialBidReq = Object.assign({}, bidRequests_[0], {
userId: {
tdid: '11111111-2222-3333-4444-555555555555',
uid2: { id: 'AbCdEfGhIjKlMnO9qdQBW7qtMw8f1WTUvtkHe6u+fqLfhbtsqrJ697Z6YoI3IB9klGUv1wvlFIbwH7ELDlqQBGtj8AC1v7fMJ/Q45E7W90dts7UQLTDMLNmtHBRDXVb0Fpas4Vh3yN1jGVQNhzXC/RpGIVtZE8dCxcjfa7VfcTNcvxxxxx==' },
pubProvidedId: [{
source: 'puburl1.com',
uids: [{
id: 'pubid1',
atype: 1,
ext: {
stype: 'ppuid'
}
}]
}, {
source: 'puburl2.com',
uids: [{
id: 'pubid2'
}]
}]
}
});
const request = spec.buildRequests([oneSpecialBidReq], bidderRequest_);
const payload = JSON.parse(request.data);
expect(payload.eids).to.deep.include({
'source': 'adserver.org',
'uids': [
{
'id': '11111111-2222-3333-4444-555555555555',
'atype': 1,
'ext': {
'rtiPartner': 'TDID'
}
}
]
});
expect(payload.eids).to.deep.include({
'source': 'uidapi.com',
'uids': [
{
'id': 'AbCdEfGhIjKlMnO9qdQBW7qtMw8f1WTUvtkHe6u+fqLfhbtsqrJ697Z6YoI3IB9klGUv1wvlFIbwH7ELDlqQBGtj8AC1v7fMJ/Q45E7W90dts7UQLTDMLNmtHBRDXVb0Fpas4Vh3yN1jGVQNhzXC/RpGIVtZE8dCxcjfa7VfcTNcvxxxxx==',
'atype': 3
}
]
});

expect(payload.eids).to.deep.include({
'source': 'puburl1.com',
'uids': [
{
'id': 'pubid1',
'atype': 1,
'ext': {
'stype': 'ppuid'
}
}
]
});

expect(payload.eids).to.deep.include({
'source': 'puburl2.com',
'uids': [
{
'id': 'pubid2'
}
]
});
});
});// describe

/**
Expand Down