Skip to content

Commit

Permalink
Colossus Bid Adapter: fix buildRequests (prebid#8236)
Browse files Browse the repository at this point in the history
* add video&native traffic colossus ssp

* Native obj validation

* Native obj validation #2

* Added size field in requests

* fixed test

* fix merge conflicts

* move to 3.0

* move to 3.0

* fix IE11 new URL issue

* fix IE11 new URL issue

* fix IE11 new URL issue

* https for 3.0

* add https test

* add ccp and schain features

* fix test

* sync with upstream, fix conflicts

* Update colossussspBidAdapter.js

remove commented code

* Update colossussspBidAdapter.js

lint fix

* identity extensions

* identity extensions

* fix

* fix

* fix

* fix

* fix

* add tests for user ids

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* add gdpr support

* add gdpr support

* id5id support

* Update colossussspBidAdapter.js

add bidfloor parameter

* Update colossussspBidAdapter.js

check bidfloor

* Update colossussspBidAdapter.js

* Update colossussspBidAdapter.js

* Update colossussspBidAdapter.js

* Update colossussspBidAdapter_spec.js

* use floor module

* Revert "use floor module"

This reverts commit f0c5c24.

* use floor module

* update to 5v

* fix

* add uid2 and bidFloor support

* fix

* add pbadslot support

* fix conflicts

* add onBidWon

* refactor

* add test for onBidWon()

* fix

* add group_id

* Trigger circleci

* fix

* update user sync

* fix window.location

* fix test

Co-authored-by: Vladislav Isaiko <vladis@smartyads.com>
Co-authored-by: Aiholkin <artem.iholkin@smartyads.com>
Co-authored-by: Mykhailo Yaremchuk <m.yaremchuk@smartyads.com>
  • Loading branch information
4 people authored Apr 2, 2022
1 parent dfac4ee commit 2cf1896
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
29 changes: 25 additions & 4 deletions modules/colossussspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,33 @@ export const spec = {
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: (validBidRequests, bidderRequest) => {
const winTop = getWindowTop();
const location = winTop.location;
let deviceWidth = 0;
let deviceHeight = 0;
let winLocation;

try {
const winTop = getWindowTop();
deviceWidth = winTop.screen.width;
deviceHeight = winTop.screen.height;
winLocation = winTop.location;
} catch (e) {
logMessage(e);
winLocation = window.location;
}

const refferUrl = bidderRequest.refererInfo && bidderRequest.refererInfo.referer;
let refferLocation;
try {
refferLocation = refferUrl && new URL(refferUrl);
} catch (e) {
logMessage(e);
}

const location = refferLocation || winLocation;
let placements = [];
let request = {
deviceWidth: winTop.screen.width,
deviceHeight: winTop.screen.height,
deviceWidth,
deviceHeight,
language: (navigator && navigator.language) ? navigator.language : '',
secure: location.protocol === 'https:' ? 1 : 0,
host: location.host,
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/colossussspBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe('ColossussspAdapter', function () {
}
});
it('Returns empty data if no valid requests are passed', function () {
serverRequest = spec.buildRequests([]);
serverRequest = spec.buildRequests([], bidderRequest);
let data = serverRequest.data;
expect(data.placements).to.be.an('array').that.is.empty;
});
Expand Down

0 comments on commit 2cf1896

Please sign in to comment.