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

Weborama RTD Module : start Bidder specific handling removal #10005

Merged
merged 15 commits into from
Jun 8, 2023
120 changes: 25 additions & 95 deletions modules/weboramaRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -689,19 +689,8 @@ class WeboramaRtdProvider {
/** @type {string} */
const bidder = bidderAliasRegistry[bid.bidder] || bid.bidder;

switch (bidder) {
case 'appnexus':
this.#handleAppnexusBid(bid, profile);
break;
case 'pubmatic':
this.#handlePubmaticBid(bid, profile);
break;
case 'smartadserver':
this.#handleSmartadserverBid(bid, profile);
break;
case 'rubicon':
this.#handleRubiconBid(bid, profile, metadata);
break;
if (bidder == 'appnexus') {
this.#handleAppnexusBid(reqBidsConfigObj, bid, profile);
Copy link
Collaborator

Choose a reason for hiding this comment

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

would you prefer to remove this line, move the handling into the appnexus adapter, or just not be in 8 until this is resolved?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@peczenyj update here! Appnexus pr should make this much easier, we're delaying prebid 8 to accommodate

}
}

Expand All @@ -719,92 +708,19 @@ class WeboramaRtdProvider {
/** handle appnexus/xandr bid
* @method
* @private
* @param {Object} reqBidsConfigObj
* @param {Object} reqBidsConfigObj.ortb2Fragments
* @param {Object} reqBidsConfigObj.ortb2Fragments.bidder
* @param {Object} bid
* @param {Object} bid.params
* @param {Object} bid.params.keyword
* @param {Object} bid.parameters
* @param {Profile} profile
* @returns {void}
*/
// eslint-disable-next-line no-dupe-class-members
#handleAppnexusBid(bid, profile) {
#handleAppnexusBid(reqBidsConfigObj, bid, profile) {
const base = 'params.keywords';
this.#assignProfileToObject(bid, base, profile);
}

/** handle pubmatic bid
* @method
* @private
* @param {Object} bid
* @param {Object} bid.params
* @param {string} bid.params.dctr
* @param {Profile} profile
* @returns {void}
*/
// eslint-disable-next-line no-dupe-class-members
#handlePubmaticBid(bid, profile) {
const sep = '|';
const subsep = ',';

bid.params ||= {};

const data = bid.params.dctr || '';
const target = new Set(data.split(sep).filter((x) => x.length > 0));

Object.entries(profile).forEach(([key, values]) => {
const value = values.join(subsep);
const keyword = `${key}=${value}`;
target.add(keyword);
});

bid.params.dctr = Array.from(target).join(sep);
}

/** handle smartadserver bid
* @method
* @private
* @param {Object} bid
* @param {Object} bid.params
* @param {string} bid.params.target
* @param {Profile} profile
* @returns {void}
*/
// eslint-disable-next-line no-dupe-class-members
#handleSmartadserverBid(bid, profile) {
const sep = ';';

bid.params ||= {};

const data = bid.params.target || '';
const target = new Set(data.split(sep).filter((x) => x.length > 0));

Object.entries(profile).forEach(([key, values]) => {
values.forEach(value => {
const keyword = `${key}=${value}`;
target.add(keyword);
})
});

bid.params.target = Array.from(target).join(sep);
}

/** handle rubicon bid
* @method
* @private
* @param {Object} bid
* @param {string} bid.bidder
* @param {Profile} profile
* @param {dataCallbackMetadata} metadata
* @returns {void}
*/
// eslint-disable-next-line no-dupe-class-members
#handleRubiconBid(bid, profile, metadata) {
if (isBoolean(metadata.user)) {
const section = metadata.user ? 'visitor' : 'inventory';
const base = `params.${section}`;
this.#assignProfileToObject(bid, base, profile);
} else {
logMessage(`SKIP bidder '${bid.bidder}', data from '${metadata.source}' is not defined as user or site-centric`);
}
// this.#setBidderOrtb2(reqBidsConfigObj.ortb2Fragments?.bidder, bid.bidder, base, profile);
Copy link
Collaborator

Choose a reason for hiding this comment

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

So just to clarify for appnexus - we can read data from the various ortb2 keyword fields (we'll pass the data into our existing keywords fields), but we can't read from the segment related ortb data fields at this time. I have checked with our product team and there's no current home for all of the related ortb segment fields of data in our current endpoint (note - there is some ongoing discussions on this topic, so there might be different news at some point down the road).

I hope this helps clarify what type of code you could change or leave in place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hey, I try to handle it better in the last next two commits

Copy link
Collaborator

@patmmccann patmmccann Jun 8, 2023

Choose a reason for hiding this comment

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

we can't read from the segment related ortb data fields at this time.

@astephensxandr if this is indeed true for the foreseeable future, Microsoft should expect disruption in its ongoing compatibility with RTD modules. Are you saying you guys are comfortable with this? The current situation is in order to avoid a small amount of work by microsoft -- specifically figuring out some translation of fields in user.ext.data into your keywords object -- you are pushing quite difficult work onto many of your partners, not all of which have been able to achieve it.

}

/** handle generic bid via ortb2 arbitrary data
Expand All @@ -823,14 +739,28 @@ class WeboramaRtdProvider {
if (isBoolean(metadata.user)) {
logMessage(`bidder '${bidder}' is not directly supported, trying set data via bidder ortb2 fpd`);
const section = metadata.user ? 'user' : 'site';
const base = `${bidder}.${section}.ext.data`;
const path = `${section}.ext.data`;

this.#assignProfileToObject(reqBidsConfigObj.ortb2Fragments?.bidder, base, profile);
this.#setBidderOrtb2(reqBidsConfigObj.ortb2Fragments?.bidder, bidder, path, profile)
} else {
logMessage(`SKIP unsupported bidder '${bidder}', data from '${metadata.source}' is not defined as user or site-centric`);
}
}

/**
* set bidder ortb2 data
* @method
* @private
* @param {Object} bidderOrtb2Fragments
* @param {string} bidder
* @param {string} path
* @param {Profile} profile
* @returns {void}
*/
// eslint-disable-next-line no-dupe-class-members
#setBidderOrtb2(bidderOrtb2Fragments, bidder, path, profile) {
const base = `${bidder}.${path}`;
this.#assignProfileToObject(bidderOrtb2Fragments, base, profile)
}
/**
* assign profile to object
* @method
Expand Down
8 changes: 4 additions & 4 deletions modules/weboramaRtdProvider.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,12 +575,9 @@ pbjs.que.push(function () {

### Supported Bidders

We currently support the following bidder adapters:
We currently support the following bidder adapters with dedicated code:

* SmartADServer SSP
* PubMatic SSP
* AppNexus SSP
* Rubicon SSP

We also set the bidder (and global, if no specific bidders are set on `sendToBidders`) ortb2 `site.ext.data` and `user.ext.data` sections (as arbitrary data). The following bidders may support it, to be sure, check the `First Party Data Support` on the feature list for the particular bidder from [here](https://docs.prebid.org/dev-docs/bidders).

Expand All @@ -605,8 +602,11 @@ We also set the bidder (and global, if no specific bidders are set on `sendToBid
* Opt Out Advertising
* Ozone Project
* Proxistore
* PubMatic SSP
* Rise
* Rubicon SSP
* Smaato
* Smart ADServer SSP
* Sonobi
* TheMediaGrid
* TripleLift
Expand Down
Loading