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

sspBC Bid Adapter: add support for topicsFpdModule #10416

Merged
merged 1 commit into from
Sep 13, 2023
Merged
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
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 => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

the ortb2 object you get as input is meant to be usable as-is for your ORTB exchange, so I'm always curious to learn why the extra processing.

From what I see here you prefer to:

  • not get all the available user data segments, but only topics;
  • not get information about who provided the topics (data[].name).

Both choices seem odd to me, which is why I note them here, but of course you're free to make them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Our exchange is, unfortunately, not fully ortb-compliant - that's why we:
a) trim data in topics
b) custom-build other user segments (see applyClientHints etc)

The next major version of the adapter should use ortbConverter, but we're waiting for the changes on the backend (to eliminate the need for overrides on the adapter side).

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