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

pbsBidAdapter: change order of client syncs #6248

Merged
merged 3 commits into from
Feb 2, 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
10 changes: 5 additions & 5 deletions modules/prebidServerBidAdapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,6 @@ function queueSync(bidderCodes, gdprConsent, uspConsent, s2sConfig) {
payload.us_privacy = uspConsent;
}

if (typeof _s2sConfig.coopSync === 'boolean') {
payload.coopSync = _s2sConfig.coopSync;
}

const jsonPayload = JSON.stringify(payload);
ajax(s2sConfig.syncEndpoint,
(response) => {
Expand All @@ -227,10 +223,14 @@ function doAllSyncs(bidders, s2sConfig) {
return;
}

const thisSync = bidders.pop();
// pull the syncs off the list in the order that prebid server sends them
const thisSync = bidders.shift();

// if PBS reports this bidder doesn't have an ID, then call the sync and recurse to the next sync entry
if (thisSync.no_cookie) {
doPreBidderSync(thisSync.usersync.type, thisSync.usersync.url, thisSync.bidder, utils.bind.call(doAllSyncs, null, bidders, s2sConfig), s2sConfig);
} else {
// bidder already has an ID, so just recurse to the next sync entry
doAllSyncs(bidders, s2sConfig);
}
}
Expand Down
31 changes: 0 additions & 31 deletions test/spec/modules/prebidServerBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2434,36 +2434,5 @@ describe('S2S Adapter', function () {
const requestBid = JSON.parse(server.requests[0].requestBody);
expect(requestBid.bidders).to.deep.equal(['appnexus', 'rubicon']);
});

it('should add cooperative sync flag to cookie_sync request if property is present', function () {
let cookieSyncConfig = utils.deepClone(CONFIG);
cookieSyncConfig.coopSync = false;
cookieSyncConfig.syncEndpoint = 'https://prebid.adnxs.com/pbs/v1/cookie_sync';

let consentConfig = { s2sConfig: cookieSyncConfig };
config.setConfig(consentConfig);

let bidRequest = utils.deepClone(BID_REQUESTS);

adapter.callBids(REQUEST, bidRequest, addBidResponse, done, ajax);
let requestBid = JSON.parse(server.requests[0].requestBody);

expect(requestBid.coopSync).to.equal(false);
});

it('should not add cooperative sync flag to cookie_sync request if property is not present', function () {
let cookieSyncConfig = utils.deepClone(CONFIG);
cookieSyncConfig.syncEndpoint = 'https://prebid.adnxs.com/pbs/v1/cookie_sync';

let consentConfig = { s2sConfig: cookieSyncConfig };
config.setConfig(consentConfig);

let bidRequest = utils.deepClone(BID_REQUESTS);

adapter.callBids(REQUEST, bidRequest, addBidResponse, done, ajax);
let requestBid = JSON.parse(server.requests[0].requestBody);

expect(requestBid.coopSync).to.be.undefined;
});
});
});