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

Sonobi Bid Adapter: remove userid query param #9496

Merged
merged 6 commits into from
Feb 9, 2023
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: 1 addition & 10 deletions modules/sonobiBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { parseSizesInput, logError, generateUUID, isEmpty, deepAccess, logWarn, logMessage, deepClone, getGptSlotInfoForAdUnitCode, isFn, isPlainObject } from '../src/utils.js';
import { parseSizesInput, logError, generateUUID, isEmpty, deepAccess, logWarn, logMessage, getGptSlotInfoForAdUnitCode, isFn, isPlainObject } from '../src/utils.js';
import { BANNER, VIDEO } from '../src/mediaTypes.js';
import { config } from '../src/config.js';
import { Renderer } from '../src/Renderer.js';
Expand Down Expand Up @@ -132,15 +132,6 @@ export const spec = {
if (validBidRequests[0].schain) {
payload.schain = JSON.stringify(validBidRequests[0].schain);
}
if (deepAccess(validBidRequests[0], 'userId') && Object.keys(validBidRequests[0].userId).length > 0) {
const userIds = deepClone(validBidRequests[0].userId);

if (userIds.id5id) {
userIds.id5id = deepAccess(userIds, 'id5id.uid');
}

payload.userid = JSON.stringify(userIds);
}

const eids = deepAccess(validBidRequests[0], 'userIdAsEids');
if (Array.isArray(eids) && eids.length > 0) {
Expand Down
28 changes: 3 additions & 25 deletions test/spec/modules/sonobiBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ describe('SonobiBidAdapter', function () {
}
}
};
const bidRequests = spec.buildRequests(bidRequest, {...bidderRequests, ortb2});
const bidRequests = spec.buildRequests(bidRequest, { ...bidderRequests, ortb2 });
expect(bidRequests.data.fpd).to.equal(JSON.stringify(ortb2));
});

Expand Down Expand Up @@ -539,37 +539,15 @@ describe('SonobiBidAdapter', function () {
]);
});

it('should return a properly formatted request with userid as a JSON-encoded set of User ID results', function () {
Copy link
Collaborator

@patmmccann patmmccann Feb 1, 2023

Choose a reason for hiding this comment

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

can you keep this test and have it say basically, it doesnt choke if a publisher specifies this, even though it doesnt do anything. basically changing lines 548 and 549 below to be empty and delete line 550

Copy link
Contributor Author

@JonGoSonobi JonGoSonobi Feb 2, 2023

Choose a reason for hiding this comment

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

Ya we can do that. I restored the test and changed the check on line 550 to assert that userid is empty.

The other 2 checks for data.ref and data.s should stay the same. These are additional checks for other values the buildRequest function sets but should not be effected by the presence of a userid.

it('should return a properly formatted request with the userid value omitted when the userId object is present on the bidRequest. ', function () {
bidRequest[0].userId = { 'pubcid': 'abcd-efg-0101', 'tdid': 'td-abcd-efg-0101', 'id5id': { 'uid': 'ID5-ZHMOrVeUVTUKgrZ-a2YGxeh5eS_pLzHCQGYOEAiTBQ', 'ext': { 'linkType': 2 } } };
bidRequest[1].userId = { 'pubcid': 'abcd-efg-0101', 'tdid': 'td-abcd-efg-0101', 'id5id': { 'uid': 'ID5-ZHMOrVeUVTUKgrZ-a2YGxeh5eS_pLzHCQGYOEAiTBQ', 'ext': { 'linkType': 2 } } };
const bidRequests = spec.buildRequests(bidRequest, bidderRequests);
expect(bidRequests.url).to.equal('https://apex.go.sonobi.com/trinity.json');
expect(bidRequests.method).to.equal('GET');
expect(bidRequests.data.ref).not.to.be.empty;
expect(bidRequests.data.s).not.to.be.empty;
expect(JSON.parse(bidRequests.data.userid)).to.eql({ 'pubcid': 'abcd-efg-0101', 'tdid': 'td-abcd-efg-0101', 'id5id': 'ID5-ZHMOrVeUVTUKgrZ-a2YGxeh5eS_pLzHCQGYOEAiTBQ' });
});

it('should return a properly formatted request with userid omitted if there are no userIds', function () {
bidRequest[0].userId = {};
bidRequest[1].userId = {};
const bidRequests = spec.buildRequests(bidRequest, bidderRequests);
expect(bidRequests.url).to.equal('https://apex.go.sonobi.com/trinity.json');
expect(bidRequests.method).to.equal('GET');
expect(bidRequests.data.ref).not.to.be.empty;
expect(bidRequests.data.s).not.to.be.empty;
expect(bidRequests.data.userid).to.equal(undefined);
});

it('should return a properly formatted request with userid omitted', function () {
bidRequest[0].userId = undefined;
bidRequest[1].userId = undefined;
const bidRequests = spec.buildRequests(bidRequest, bidderRequests);
expect(bidRequests.url).to.equal('https://apex.go.sonobi.com/trinity.json');
expect(bidRequests.method).to.equal('GET');
expect(bidRequests.data.ref).not.to.be.empty;
expect(bidRequests.data.s).not.to.be.empty;
expect(bidRequests.data.userid).to.equal(undefined);
expect(bidRequests.data.userid).to.be.undefined;
});

it('should return a properly formatted request with keywrods included as a csv of strings', function () {
Expand Down