Skip to content

Commit

Permalink
add ortb2 user.keywords on appnexs
Browse files Browse the repository at this point in the history
  • Loading branch information
peczenyj committed May 26, 2023
1 parent a457dc6 commit e2c5747
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 9 deletions.
12 changes: 7 additions & 5 deletions modules/weboramaRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ class WeboramaRtdProvider {
const bidder = bidderAliasRegistry[bid.bidder] || bid.bidder;

if (bidder == 'appnexus') {
this.#handleAppnexusBid(reqBidsConfigObj, bid, profile);
this.#handleAppnexusBid(reqBidsConfigObj, bid, profile, metadata);
}
}

Expand All @@ -714,13 +714,15 @@ class WeboramaRtdProvider {
* @param {Object} bid
* @param {Object} bid.parameters
* @param {Profile} profile
* @param {dataCallbackMetadata} metadata
* @returns {void}
*/
// eslint-disable-next-line no-dupe-class-members
#handleAppnexusBid(reqBidsConfigObj, bid, profile) {
const base = 'params.keywords';
this.#assignProfileToObject(bid, base, profile);
// this.#setBidderOrtb2(reqBidsConfigObj.ortb2Fragments?.bidder, bid.bidder, base, profile);
#handleAppnexusBid(reqBidsConfigObj, bid, profile, metadata) {
this.#assignProfileToObject(bid, 'params.keywords', profile);
if (metadata.user) {
this.#setBidderOrtb2(reqBidsConfigObj.ortb2Fragments?.bidder, bid.bidder, 'user.keywords', profile);
}
}

/** handle generic bid via ortb2 arbitrary data
Expand Down
6 changes: 3 additions & 3 deletions modules/weboramaRtdProvider.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,11 +575,11 @@ pbjs.que.push(function () {
### Supported Bidders
We currently support the following bidder adapters with dedicated code:
We 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).
* AppNexus SSP
For `Appnexus SSP` we also set the user data into `users.keywords` fragment.
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).
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).
* Adagio
* AdformOpenRTB
Expand Down
61 changes: 60 additions & 1 deletion test/spec/modules/weboramaRtdProvider_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1449,6 +1449,19 @@ describe('weboramaRtdProvider', function() {
expect(reqBidsConfigObj.adUnits[0].bids[2].params.keywords).to.deep.equal(data);
expect(reqBidsConfigObj.adUnits[0].bids[3].params).to.be.undefined;
['smartadserver', 'pubmatic', 'appnexus', 'rubicon', 'other'].forEach((v) => {
if (v == 'appnexus') {
expect(reqBidsConfigObj.ortb2Fragments.bidder[v]).to.deep.equal({
user: {
ext: {
data: data
},
keywords: data,
}
});

return
}

expect(reqBidsConfigObj.ortb2Fragments.bidder[v]).to.deep.equal({
user: {
ext: {
Expand Down Expand Up @@ -1582,6 +1595,7 @@ describe('weboramaRtdProvider', function() {
ext: {
data: data
},
keywords: data,
}
});

Expand Down Expand Up @@ -1707,6 +1721,7 @@ describe('weboramaRtdProvider', function() {
ext: {
data: data
},
keywords: data
}
});

Expand Down Expand Up @@ -2186,6 +2201,19 @@ describe('weboramaRtdProvider', function() {
}
});
['smartadserver', 'pubmatic', 'appnexus', 'rubicon', 'other'].forEach((v) => {
if (v == 'appnexus') {
expect(reqBidsConfigObj.ortb2Fragments.bidder[v]).to.deep.equal({
user: {
ext: {
data: data
},
keywords: data,
}
});

return
}

expect(reqBidsConfigObj.ortb2Fragments.bidder[v]).to.deep.equal({
user: {
ext: {
Expand Down Expand Up @@ -2253,6 +2281,19 @@ describe('weboramaRtdProvider', function() {
expect(reqBidsConfigObj.adUnits[0].bids[2].params.keywords).to.deep.equal(defaultProfile);
expect(reqBidsConfigObj.adUnits[0].bids[3].params).to.be.undefined;
['smartadserver', 'pubmatic', 'appnexus', 'rubicon', 'other'].forEach((v) => {
if (v == 'appnexus') {
expect(reqBidsConfigObj.ortb2Fragments.bidder[v]).to.deep.equal({
user: {
ext: {
data: defaultProfile
},
keywords: defaultProfile,
}
});

return
}

expect(reqBidsConfigObj.ortb2Fragments.bidder[v]).to.deep.equal({
user: {
ext: {
Expand Down Expand Up @@ -2327,6 +2368,19 @@ describe('weboramaRtdProvider', function() {
expect(reqBidsConfigObj.adUnits[0].bids[2].params.keywords).to.deep.equal(defaultProfile);
expect(reqBidsConfigObj.adUnits[0].bids[3].params).to.be.undefined;
['smartadserver', 'pubmatic', 'appnexus', 'rubicon', 'other'].forEach((v) => {
if (v == 'appnexus') {
expect(reqBidsConfigObj.ortb2Fragments.bidder[v]).to.deep.equal({
user: {
ext: {
data: defaultProfile
},
keywords: defaultProfile,
}
});

return
}

expect(reqBidsConfigObj.ortb2Fragments.bidder[v]).to.deep.equal({
user: {
ext: {
Expand Down Expand Up @@ -2457,7 +2511,12 @@ describe('weboramaRtdProvider', function() {
webo_cs: ['foo', 'bar'],
webo_audiences: ['baz'],
webo_bar: ['baz'],
}
},
},
keywords: {
webo_cs: ['foo', 'bar'],
webo_audiences: ['baz'],
webo_bar: ['baz'],
},
}
});
Expand Down

0 comments on commit e2c5747

Please sign in to comment.