Skip to content

Commit

Permalink
Smartx Bid Adapter: Add Schain support (prebid#9244)
Browse files Browse the repository at this point in the history
* Add smartclipBidAdapter

* smartxBidAdapter.js - removed unused variables, removed debug, added window before the outstream related functions

* - made outstream player configurable

* remove wrong named files

* camelcase

* fix

* Out-Stream render update to SmartPlay 5.2

* ESlint fix

* ESlint fix

* ESlint fix

* adjust tests, fixes

* ESlint

* adjusted desired bitrate examples

* added bid.meta.advertiserDomains support

* bug fix for numeric elementID outstream render

* fix renderer url

* support for floors module

* bugfixes to be openRTB 2.5 compliant

* update internal renderer usage

* remove unused outstream_function logic

* bugfix outstream options for default outstream renderer configuration

* [PREB-10] fix empty title not configurable

* add pbjs version

* testing with outstream 5.3.0

* pbjs version into content.ext

* made visibilityThreshold configurable

* adjust position of pbjs version

* Merge branch 'master' of https://github.com/prebid/Prebid.js into HEAD

* update smartclip outstream player version to support outstream 6 release along with necessary config changes

* Add support for schain

* vacuuming

Co-authored-by: smartclip AdTechnology <adtech@smartclip.com>
Co-authored-by: Gino Cirlini <adtech@smartclip.tv>
Co-authored-by: smartclip-adtech <65160328+smartclip-adtech@users.noreply.github.com>
  • Loading branch information
4 people authored and JacobKlein26 committed Feb 8, 2023
1 parent e2267f8 commit 7ab9bab
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 7 deletions.
17 changes: 10 additions & 7 deletions modules/smartxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export const spec = {
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: function (bidRequests, bidderRequest) {
// TODO: does the fallback make sense here?
const page = bidderRequest.refererInfo.page || bidderRequest.refererInfo.topmostLocation;
const isPageSecure = !!page.match(/^https:/)

Expand Down Expand Up @@ -197,16 +196,23 @@ export const spec = {
userExt.fpc = pubcid;
}

// Add schain object if available
if (bid && bid.schain) {
requestPayload['source'] = {
ext: {
schain: bid.schain
}
};
}

// Only add the user object if it's not empty
if (!isEmpty(userExt)) {
requestPayload.user = {
ext: userExt
};
}

// requestPayload.user.ext.ver = pbjs.version;

// Targeting
// Add targeting
if (getBidIdParameter('data', bid.params.user)) {
var targetingarr = [];
for (var i = 0; i < bid.params.user.data.length; i++) {
Expand All @@ -225,8 +231,6 @@ export const spec = {
}
}

// Todo: USER ID MODULE

requestPayload.user = {
ext: userExt,
data: targetingarr
Expand Down Expand Up @@ -269,7 +273,6 @@ export const spec = {
}
/**
* Make sure currency and price are the right ones
* TODO: what about the pre_market_bid partners sizes?
*/
_each(currentBidRequest.params.pre_market_bids, function (pmb) {
if (pmb.deal_id == smartxBid.id) {
Expand Down
32 changes: 32 additions & 0 deletions test/spec/modules/smartxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,38 @@ describe('The smartx adapter', function () {
expect(request.data.imp[0].video.minduration).to.equal(3);
expect(request.data.imp[0].video.maxduration).to.equal(15);
});

it('should pass schain param', function () {
var request;

bid.schain = {
complete: 1,
nodes: [
{
asi: 'indirectseller.com',
sid: '00001',
hp: 1
}
]
}

request = spec.buildRequests([bid], bidRequestObj)[0];

expect(request.data.source).to.deep.equal({
ext: {
schain: {
complete: 1,
nodes: [
{
asi: 'indirectseller.com',
sid: '00001',
hp: 1
}
]
}
}
})
});
});

describe('interpretResponse', function () {
Expand Down

0 comments on commit 7ab9bab

Please sign in to comment.