Skip to content

Commit

Permalink
sspBC Bid Adapter : added support for transactionID and update tests (#…
Browse files Browse the repository at this point in the history
…12547)

* 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 to v6

* [sspbc-adapter] update to v6.1 - add image sync, transactionId & schain support, improve test coverage

* [sspbc-adapter] fix typos

---------

Co-authored-by: Wojciech Biały <[email protected]>
Co-authored-by: decemberWP <[email protected]>
  • Loading branch information
3 people authored Dec 6, 2024
1 parent 06024e8 commit 80364ce
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 13 deletions.
41 changes: 33 additions & 8 deletions modules/sspBCBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import { getCurrencyFromBidderRequest } from '../libraries/ortb2Utils/currency.j

const BIDDER_CODE = 'sspBC';
const BIDDER_URL = 'https://ssp.wp.pl/bidder/';
const SYNC_URL = 'https://ssp.wp.pl/bidder/usersync';
const SYNC_URL_IFRAME = 'https://ssp.wp.pl/bidder/usersync';
const SYNC_URL_IMAGE = 'https://ssp.wp.pl/v1/sync/pixel';
const NOTIFY_URL = 'https://ssp.wp.pl/bidder/notify';
const GVLID = 676;
const TMAX = 450;
const BIDDER_VERSION = '6.00';
const BIDDER_VERSION = '6.10';
const DEFAULT_CURRENCY = 'PLN';
const W = window;
const { navigator } = W;
Expand Down Expand Up @@ -70,7 +71,20 @@ const getContentLanguage = () => {
const topWindow = getWindowTop();
return topWindow.document.body.parentNode.lang;
} catch (err) {
logWarn('Could not read language form top-level html', err);
logWarn('Could not read language from top-level html', err);
}
};

/**
* Get host name of the top level html object
* @returns {string} host name
*/
const getTopHost = () => {
try {
const topWindow = getWindowTop();
return topWindow.location.host;
} catch (err) {
logWarn('Could not read host from top-level window', err);
}
};

Expand Down Expand Up @@ -604,7 +618,9 @@ const spec = {
const pbver = '$prebid.version$';
const testMode = setOnAny(validBidRequests, 'params.test') ? 1 : undefined;
const ref = bidderRequest.refererInfo.ref;
const { regs = {} } = ortb2 || {};
const { source = {}, regs = {} } = ortb2 || {};

source.schain = setOnAny(validBidRequests, 'schain');

const payload = {
id: bidderRequest.bidderRequestId,
Expand All @@ -621,6 +637,7 @@ const spec = {
tmax,
user: {},
regs,
source,
device: {
language: getBrowserLanguage(),
w: screen.width,
Expand Down Expand Up @@ -764,14 +781,22 @@ const spec = {

return fledgeAuctionConfigs.length ? { bids, fledgeAuctionConfigs } : bids;
},
getUserSyncs(syncOptions) {

getUserSyncs(syncOptions, _, gdprConsent = {}) {
const {iframeEnabled, pixelEnabled} = syncOptions;
const {gdprApplies, consentString = ''} = gdprConsent;
let mySyncs = [];
if (syncOptions.iframeEnabled) {
if (iframeEnabled) {
mySyncs.push({
type: 'iframe',
url: `${SYNC_URL}?tcf=2&pvid=${pageView.id}&sn=${pageView.sn}`,
url: `${SYNC_URL_IFRAME}?tcf=2&pvid=${pageView.id}&sn=${pageView.sn}`,
});
};
} else if (pixelEnabled) {
mySyncs.push({
type: 'image',
url: `${SYNC_URL_IMAGE}?inver=0&platform=wpartner&host=${getTopHost() || ''}&gdpr=${gdprApplies ? 1 : 0}&gdpr_consent=${consentString}`,
});
}
return mySyncs;
},

Expand Down
35 changes: 30 additions & 5 deletions test/spec/modules/sspBCBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import * as utils from 'src/utils.js';

const BIDDER_CODE = 'sspBC';
const BIDDER_URL = 'https://ssp.wp.pl/bidder/';
const SYNC_URL = 'https://ssp.wp.pl/bidder/usersync';
const SYNC_URL_IFRAME = 'https://ssp.wp.pl/bidder/usersync';
const SYNC_URL_IMAGE = 'https://ssp.wp.pl/v1/sync/pixel';

describe('SSPBC adapter', function () {
function prepareTestData() {
Expand Down Expand Up @@ -649,6 +650,25 @@ describe('SSPBC adapter', function () {
expect(extAssets1).to.have.property('pbsize').that.equals('750x200_1')
expect(extAssets2).to.have.property('pbsize').that.equals('750x200_1')
});

it('should send supply chain data', function () {
const supplyChain = {
ver: '1.0',
complete: 1,
nodes: [
{
asi: 'first-seller.com',
sid: '00001',
hp: 1
},
]
}
const bidWithSupplyChain = Object.assign(bids[0], { schain: supplyChain });
const requestWithSupplyChain = spec.buildRequests([bidWithSupplyChain], bidRequest);
const payloadWithSupplyChain = requestWithSupplyChain ? JSON.parse(requestWithSupplyChain.data) : { site: false, imp: false };

expect(payloadWithSupplyChain.source).to.have.property('schain').that.has.keys('ver', 'complete', 'nodes');
});
});

describe('interpretResponse', function () {
Expand Down Expand Up @@ -741,13 +761,18 @@ describe('SSPBC adapter', function () {
let syncResultImage = spec.getUserSyncs({ iframeEnabled: false, pixelEnabled: true });
let syncResultNone = spec.getUserSyncs({ iframeEnabled: false, pixelEnabled: false });

it('should provide correct url, if frame sync is allowed', function () {
it('should provide correct iframe url, if frame sync is allowed', function () {
expect(syncResultAll).to.have.length(1);
expect(syncResultAll[0].url).to.have.string(SYNC_URL);
expect(syncResultAll[0].url).to.have.string(SYNC_URL_IFRAME);
});

it('should provide correct image url, if image sync is allowed', function () {
expect(syncResultImage).to.have.length(1);
expect(syncResultImage[0].url).to.have.string(SYNC_URL_IMAGE);
});

it('should send no syncs, if frame sync is not allowed', function () {
expect(syncResultImage).to.have.length(0);
it('should send no syncs, if no sync is allowed', function () {
expect(syncResultNone).to.have.length(0);
expect(syncResultNone).to.have.length(0);
});
});
Expand Down

0 comments on commit 80364ce

Please sign in to comment.