Skip to content

Commit

Permalink
Sspbc Bid Adapter : add support for dsa and pass non standard ids (pr…
Browse files Browse the repository at this point in the history
…ebid#11173)

* Update tests for sspBC adapter

Update tests for sspBC adapter:
- change userSync test (due to tcf param appended in v4.6)
- add tests for onBidWon and onTimeout

* [sspbc-adapter] 5.3 updates: content-type for notifications

* [sspbc-adapter] pass CTA to native bid

* [sspbc-5.3] keep pbsize for detected adunits

* [maintenance] - remove old test for sspBc bid adaptor

* [sspbc-5.3] increment adaptor ver

* [sspbc-adapter] maintenance update to sspBCBidAdapter

* remove yarn.lock

* Delete package-lock.json

* remove package-lock.jsonfrom pull request

* [sspbc-adapter] send pageViewId in request

* [sspbc-adapter] update pageViewId test

* [sspbc-adapter] add viewabiility tracker to native ads

* [sspbc-adapter] add support for bid.admNative property

* [sspbc-adapter] ensure that placement id length is always 3 (improves matching response to request)

* [sspbc-adapter] read publisher id and custom ad label, then send them to banner creative

* [sspbc-adapter] adlabel and pubid are set as empty strings, if not present in bid response

* [sspbc-adapter] jstracker data fix

* [sspbc-adapter] jstracker data fix

* [sspbc-adapter] send tagid in notifications

* [sspbc-adapter] add gvlid to spec; prepare getUserSyncs for iframe + image sync

* update remote repo

* cleanup of grupawp/prebid master branch

* update sspBC adapter to v 5.9

* update tests for sspBC bid adapter

* [sspbc-adapter] add support for topicsFPD module

* [sspbc-adapter] change topic segment ids to int

* [sspbc-adapter] update v5.93 - add suport for DSA and non-standard user id's

* [sspbc-adapter] update v5.93 - remove unnecessary gdpr data

* [sspbc-adapter] remove debug

* [sspbc-adapter] fix tests

---------

Co-authored-by: Wojciech Biały <wb@WojciechBialy.local>
  • Loading branch information
wojciech-bialy-wpm and Wojciech Biały committed Mar 11, 2024
1 parent a068355 commit 0756379
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
39 changes: 22 additions & 17 deletions 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.92';
const BIDDER_VERSION = '5.93';
const DEFAULT_CURRENCY = 'PLN';
const W = window;
const { navigator } = W;
Expand Down Expand Up @@ -77,7 +77,7 @@ const getContentLanguage = () => {

/**
* Get Bid parameters - returns bid params from Object, or 1el array
* @param {*} bidData - bid (bidWon), or array of bids (timeout)
* @param {*} bidParams - bid (bidWon), or array of bids (timeout)
* @returns {object} params object
*/
const unpackParams = (bidParams) => {
Expand Down Expand Up @@ -216,8 +216,11 @@ const applyTopics = (validBidRequest, ortbRequest) => {
};

const applyUserIds = (validBidRequest, ortbRequest) => {
const eids = validBidRequest.userIdAsEids
if (eids && eids.length) {
const { userIdAsEids: eidsVbr = [], ortb2 = {} } = validBidRequest;
const eidsOrtb = ortb2.user?.ext?.data?.eids || [];
const eids = [...eidsVbr, ...eidsOrtb];

if (eids.length) {
const ids = { eids };
ortbRequest.user = { ...ortbRequest.user, ...ids };
}
Expand All @@ -243,7 +246,7 @@ const applyGdpr = (bidderRequest, ortbRequest) => {
* returns floor = 0 if getFloor() is not defined
*
* @param {object} slot bid request adslot
* @returns {float} floorprice
* @returns {number} floorprice
*/
const getHighestFloor = (slot) => {
const currency = getCurrency();
Expand Down Expand Up @@ -570,6 +573,7 @@ const parseNative = (nativeData, adUnitCode) => {
}

const renderCreative = (site, auctionId, bid, seat, request) => {
const { adLabel, id, slot, sn, page, publisherId, ref } = site;
let gam;

const mcad = {
Expand Down Expand Up @@ -619,16 +623,16 @@ const renderCreative = (site, auctionId, bid, seat, request) => {
}
</style>
<script>
window.rekid = ${site.id};
window.slot = ${parseInt(site.slot, 10)};
window.rekid = ${id};
window.slot = ${parseInt(slot, 10)};
window.responseTimestamp = ${Date.now()};
window.wp_sn = "${site.sn}";
window.wp_sn = "${sn}";
window.mcad = JSON.parse(decodeURI(atob("${mcbase}")));
window.gdpr = ${JSON.stringify(request.gdprConsent)};
window.page = "${site.page}";
window.ref = "${site.ref}";
window.adlabel = "${site.adLabel ? site.adLabel : ''}";
window.pubid = "${site.publisherId ? site.publisherId : ''}";
window.tcString = "${request.gdprConsent?.consentString || ''}";
window.page = "${page}";
window.ref = "${ref}";
window.adlabel = "${adLabel || ''}";
window.pubid = "${publisherId || ''}";
window.requestPVID = "${pageView.id}";
`;

Expand All @@ -654,15 +658,14 @@ const spec = {
return true;
},
buildRequests(validBidRequests, bidderRequest) {
logWarn('DEBUG: buildRequests', bidderRequest.auctionId, bidderRequest.bidderRequestId);

// convert Native ORTB definition to old-style prebid native definition
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);

if ((!validBidRequests) || (validBidRequests.length < 1)) {
return false;
}

const ortb2 = setOnAny(validBidRequests, 'ortb2');
const siteId = setOnAny(validBidRequests, 'params.siteId');
const publisherId = setOnAny(validBidRequests, 'params.publisherId');
const page = setOnAny(validBidRequests, 'params.page') || bidderRequest.refererInfo.page;
Expand All @@ -671,6 +674,7 @@ const spec = {
const pbver = '$prebid.version$';
const testMode = setOnAny(validBidRequests, 'params.test') ? 1 : undefined;
const ref = bidderRequest.refererInfo.ref;
const { regs = {} } = ortb2 || {};

const payload = {
id: bidderRequest.bidderRequestId,
Expand All @@ -686,7 +690,7 @@ const spec = {
cur: [getCurrency()],
tmax,
user: {},
regs: {},
regs,
device: {
language: getBrowserLanguage(),
w: screen.width,
Expand Down Expand Up @@ -740,7 +744,7 @@ const spec = {
const { bidId } = bidRequest || {};

// get ext data from bid
const { siteid = site.id, slotid = site.slot, pubid, adlabel, cache: creativeCache, vurls = [] } = ext;
const { siteid = site.id, slotid = site.slot, pubid, adlabel, cache: creativeCache, vurls = [], dsa } = ext;

// update site data
site = {
Expand Down Expand Up @@ -772,6 +776,7 @@ const spec = {
advertiserDomains: adomain,
networkName: seat,
pricepl: ext && ext.pricepl,
dsa,
},
netRevenue: true,
vurls,
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/sspBCBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ describe('SSPBC adapter', function () {
expect(adcode).to.be.a('string');
expect(adcode).to.contain('window.rekid');
expect(adcode).to.contain('window.mcad');
expect(adcode).to.contain('window.gdpr');
expect(adcode).to.contain('window.tcString');
expect(adcode).to.contain('window.page');
expect(adcode).to.contain('window.requestPVID');
});
Expand Down

0 comments on commit 0756379

Please sign in to comment.