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 - removed unneeded query params #4735

Merged
merged 2 commits into from
Jan 16, 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
8 changes: 0 additions & 8 deletions modules/sonobiBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,6 @@ export const spec = {

if (deepAccess(validBidRequests[0], 'params.hfa')) {
payload.hfa = deepAccess(validBidRequests[0], 'params.hfa');
} else if (deepAccess(validBidRequests[0], 'userId.pubcid')) {
payload.hfa = `PRE-${validBidRequests[0].userId.pubcid}`;
} else if (deepAccess(validBidRequests[0], 'crumbs.pubcid')) {
payload.hfa = `PRE-${validBidRequests[0].crumbs.pubcid}`;
}

if (deepAccess(validBidRequests[0], 'userId.tdid')) {
payload.tdid = validBidRequests[0].userId.tdid;
}

if (validBidRequests[0].params.referrer) {
Expand Down
54 changes: 0 additions & 54 deletions test/spec/modules/sonobiBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,62 +436,8 @@ describe('SonobiBidAdapter', function () {
it('should return null if there is nothing to bid on', function () {
const bidRequests = spec.buildRequests([{params: {}}], bidderRequests)
expect(bidRequests).to.equal(null);
})

it('should return a properly formatted request with commonid as hfa', function () {
delete bidRequest[0].params.hfa;
delete bidRequest[1].params.hfa;
bidRequest[0].crumbs = {'pubcid': 'abcd-efg-0101'};
bidRequest[1].crumbs = {'pubcid': 'abcd-efg-0101'};
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.hfa).to.equal('PRE-abcd-efg-0101');
});

it('should return a properly formatted request with commonid from User ID as hfa', function () {
delete bidRequest[0].params.hfa;
delete bidRequest[1].params.hfa;
bidRequest[0].userId = {'pubcid': 'abcd-efg-0101'};
bidRequest[1].userId = {'pubcid': 'abcd-efg-0101'};
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.hfa).to.equal('PRE-abcd-efg-0101');
delete bidRequest[0].userId;
delete bidRequest[1].userId;
})

it('should return a properly formatted request with unified id from User ID as tdid', function () {
delete bidRequest[0].params.tdid;
delete bidRequest[1].params.tdid;
bidRequest[0].userId = {'tdid': 'td-abcd-efg-0101'};
bidRequest[1].userId = {'tdid': 'td-abcd-efg-0101'};
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.tdid).to.equal('td-abcd-efg-0101');
})

it('should return a properly formatted request with hfa preferred over commonid', function () {
bidRequest[0].params.hfa = 'hfakey';
bidRequest[1].params.hfa = 'hfakey';
bidRequest[0].crumbs = {'pubcid': 'abcd-efg-0101'};
bidRequest[1].crumbs = {'pubcid': 'abcd-efg-0101'};
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.hfa).to.equal('hfakey')
})

it('should set ius as 0 if Sonobi cannot drop iframe pixels', function () {
userSync.canBidderRegisterSync.returns(false);
const bidRequests = spec.buildRequests(bidRequest, bidderRequests);
Expand Down