Skip to content

Commit

Permalink
[sspbc-adapter] add support for topicsFPD module (#10416)
Browse files Browse the repository at this point in the history
  • Loading branch information
wojciech-bialy-wpm authored Sep 13, 2023
1 parent 4c2902f commit 550a7cb
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion modules/sspBCBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const SYNC_URL = 'https://ssp.wp.pl/bidder/usersync';
const NOTIFY_URL = 'https://ssp.wp.pl/bidder/notify';
const GVLID = 676;
const TMAX = 450;
const BIDDER_VERSION = '5.9';
const BIDDER_VERSION = '5.91';
const DEFAULT_CURRENCY = 'PLN';
const W = window;
const { navigator } = W;
Expand Down Expand Up @@ -199,6 +199,22 @@ const applyClientHints = ortbRequest => {
ortbRequest.user = { ...ortbRequest.user, ...ch };
};

const applyTopics = (validBidRequest, ortbRequest) => {
const userData = validBidRequest.ortb2?.user?.data || [];
const topicsData = userData.filter(dataObj => {
const segtax = dataObj.ext?.segtax;
return segtax >= 600 && segtax <= 609;
})[0];

// format topics obj for exchange
if (topicsData) {
topicsData.id = `${topicsData.ext.segtax}`;
topicsData.name = 'topics';
delete (topicsData.ext);
ortbRequest.user.data.push(topicsData);
}
};

const applyUserIds = (validBidRequest, ortbRequest) => {
const eids = validBidRequest.userIdAsEids
if (eids && eids.length) {
Expand Down Expand Up @@ -682,6 +698,7 @@ const spec = {
applyGdpr(bidderRequest, payload);
applyClientHints(payload);
applyUserIds(validBidRequests[0], payload);
applyTopics(bidderRequest, payload);

return {
method: 'POST',
Expand Down

0 comments on commit 550a7cb

Please sign in to comment.