Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colossus Bid Adapter: add advertiserDomains and video params support #7245

Merged
merged 55 commits into from
Aug 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
b87237c
add video&native traffic colossus ssp
vladis-teqblaze Mar 26, 2018
1ca4e28
Native obj validation
vladis-teqblaze Apr 10, 2018
b5c1850
Native obj validation #2
vladis-teqblaze Apr 22, 2018
e969f27
Added size field in requests
vladis-teqblaze Apr 22, 2018
67693e1
fixed test
vladis-teqblaze Apr 22, 2018
e7ab418
fix merge conflicts
Nov 18, 2019
3320c68
fix merge conflicts
Nov 18, 2019
44e59b8
move to 3.0
Nov 18, 2019
7133a72
move to 3.0
Nov 18, 2019
3dba3ac
fix IE11 new URL issue
Nov 18, 2019
7f14e4d
fix IE11 new URL issue
Nov 18, 2019
78609ff
fix IE11 new URL issue
Nov 18, 2019
4c5d711
https for 3.0
Nov 20, 2019
1027b54
add https test
Nov 21, 2019
684639c
add ccp and schain features
Dec 5, 2019
1c6681c
fix test
Dec 5, 2019
436ff0f
sync with upstream, fix conflicts
Dec 5, 2019
2f9efee
sync with upstream, fix conflicts
Dec 5, 2019
c40dbe3
Update colossussspBidAdapter.js
Dec 9, 2019
7d2e9f3
Update colossussspBidAdapter.js
Dec 10, 2019
8055e57
Merge branch 'master' of https://github.com/prebid/Prebid.js
Feb 28, 2020
53bb18e
identity extensions
Feb 28, 2020
51faedc
identity extensions
Feb 28, 2020
6cee3e7
fix
Mar 6, 2020
461e4ff
fix
Mar 6, 2020
e78a9dc
fix
Mar 6, 2020
1547d0a
fix
Mar 6, 2020
803be44
fix
Mar 6, 2020
47a78af
add tests for user ids
Mar 10, 2020
9ff6f10
fix
Mar 10, 2020
b02455a
fix
Mar 10, 2020
a4b93a1
fix
Mar 10, 2020
1e74169
fix
Mar 10, 2020
74a42cd
fix
Mar 10, 2020
d65984e
fix
Mar 10, 2020
1595a00
fix
Mar 10, 2020
42c5e53
add gdpr support
Mar 10, 2020
480f127
add gdpr support
Mar 10, 2020
5d9299c
Merge branch 'master' of https://github.com/prebid/Prebid.js
Mar 30, 2020
3a4c32c
Merge remote-tracking branch 'upstream/master'
Apr 14, 2020
a51a3e1
id5id support
Apr 16, 2020
562a1e5
Update colossussspBidAdapter.js
Jan 15, 2021
3a99998
Update colossussspBidAdapter.js
Jan 15, 2021
ffdefbd
Merge branch 'master' into master
Jan 15, 2021
0cb39f1
Update colossussspBidAdapter.js
Jan 15, 2021
38182c0
Update colossussspBidAdapter.js
Jan 15, 2021
d2b3331
Update colossussspBidAdapter.js
Jan 15, 2021
6e2a64b
Update colossussspBidAdapter_spec.js
Jan 15, 2021
32c71f2
Merge remote-tracking branch 'upstream/master'
Jan 20, 2021
f0c5c24
use floor module
Jan 20, 2021
586367d
Revert "use floor module"
Jan 20, 2021
4fa75dd
use floor module
Jan 20, 2021
4e16010
update to 5v
Aug 2, 2021
3f62aa0
fix conflicts
Aug 2, 2021
d8e9722
fix
Aug 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 176 additions & 0 deletions modules/colossussspBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
import * as utils from '../src/utils.js';

const BIDDER_CODE = 'colossusssp';
const G_URL = 'https://colossusssp.com/?c=o&m=multi';
const G_URL_SYNC = 'https://colossusssp.com/?c=o&m=cookie';

function isBidResponseValid(bid) {
if (!bid.requestId || !bid.cpm || !bid.creativeId || !bid.ttl || !bid.currency) {
return false;
}

switch (bid.mediaType) {
case BANNER:
return Boolean(bid.width && bid.height && bid.ad);
case VIDEO:
return Boolean(bid.vastUrl);
case NATIVE:
return Boolean(bid.native);
default:
return false;
}
}

function getUserId(eids, id, source, uidExt) {
if (id) {
var uid = { id };
if (uidExt) {
uid.ext = uidExt;
}
eids.push({
source,
uids: [ uid ]
});
}
}

export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: [BANNER, VIDEO, NATIVE],
/**
* Determines whether or not the given bid request is valid.
*
* @param {object} bid The bid to validate.
* @return boolean True if this is a valid bid, and false otherwise.
*/
isBidRequestValid: (bid) => {
return Boolean(bid.bidId && bid.params && !isNaN(bid.params.placement_id));
},

/**
* Make a server request from the list of BidRequests.
*
* @param {BidRequest[]} validBidRequests A non-empty list of valid bid requests that should be sent to the Server.
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: (validBidRequests, bidderRequest) => {
const winTop = utils.getWindowTop();
const location = winTop.location;
let placements = [];
let request = {
'deviceWidth': winTop.screen.width,
'deviceHeight': winTop.screen.height,
'language': (navigator && navigator.language) ? navigator.language : '',
'secure': location.protocol === 'https:' ? 1 : 0,
'host': location.host,
'page': location.pathname,
'placements': placements,
};

if (bidderRequest) {
if (bidderRequest.uspConsent) {
request.ccpa = bidderRequest.uspConsent;
}
if (bidderRequest.gdprConsent) {
request.gdpr_consent = bidderRequest.gdprConsent.consentString || 'ALL'
request.gdpr_require = bidderRequest.gdprConsent.gdprApplies ? 1 : 0
}
}

for (let i = 0; i < validBidRequests.length; i++) {
let bid = validBidRequests[i];
let traff = bid.params.traffic || BANNER
let placement = {
placementId: bid.params.placement_id,
bidId: bid.bidId,
sizes: bid.mediaTypes[traff].sizes,
traffic: traff,
eids: [],
floor: {}
};
if (typeof bid.getFloor === 'function') {
let tmpFloor = {};
for (let size of placement.sizes) {
tmpFloor = bid.getFloor({
currency: 'USD',
mediaType: traff,
size: size
});
if (tmpFloor) {
placement.floor[`${size[0]}x${size[1]}`] = tmpFloor.floor;
}
}
}
if (bid.schain) {
placement.schain = bid.schain;
}
if (bid.userId) {
getUserId(placement.eids, bid.userId.britepoolid, 'britepool.com');
getUserId(placement.eids, bid.userId.idl_env, 'identityLink');
getUserId(placement.eids, bid.userId.id5id, 'id5-sync.com')
getUserId(placement.eids, bid.userId.tdid, 'adserver.org', {
rtiPartner: 'TDID'
});
}
if (traff === VIDEO) {
placement.playerSize = bid.mediaTypes[VIDEO].playerSize;
placement.minduration = bid.mediaTypes[VIDEO].minduration;
placement.maxduration = bid.mediaTypes[VIDEO].maxduration;
placement.mimes = bid.mediaTypes[VIDEO].mimes;
placement.protocols = bid.mediaTypes[VIDEO].protocols;
placement.startdelay = bid.mediaTypes[VIDEO].startdelay;
placement.placement = bid.mediaTypes[VIDEO].placement;
placement.skip = bid.mediaTypes[VIDEO].skip;
placement.skipafter = bid.mediaTypes[VIDEO].skipafter;
placement.minbitrate = bid.mediaTypes[VIDEO].minbitrate;
placement.maxbitrate = bid.mediaTypes[VIDEO].maxbitrate;
placement.delivery = bid.mediaTypes[VIDEO].delivery;
placement.playbackmethod = bid.mediaTypes[VIDEO].playbackmethod;
placement.api = bid.mediaTypes[VIDEO].api;
placement.linearity = bid.mediaTypes[VIDEO].linearity;
}
placements.push(placement);
}
return {
method: 'POST',
url: G_URL,
data: request
};
},

/**
* Unpack the response from the server into a list of bids.
*
* @param {*} serverResponse A successful response from the server.
* @return {Bid[]} An array of bids which were nested inside the server.
*/
interpretResponse: (serverResponse) => {
let response = [];
try {
serverResponse = serverResponse.body;
for (let i = 0; i < serverResponse.length; i++) {
let resItem = serverResponse[i];
if (isBidResponseValid(resItem)) {
const advertiserDomains = resItem.adomain && resItem.adomain.length ? resItem.adomain : [];
resItem.meta = { ...resItem.meta, advertiserDomains };

response.push(resItem);
}
}
} catch (e) {
utils.logMessage(e);
};
return response;
},

getUserSyncs: () => {
return [{
type: 'image',
url: G_URL_SYNC
}];
}
};

registerBidder(spec);
29 changes: 14 additions & 15 deletions modules/colossussspBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,18 @@ Module that connects to Colossus SSP demand sources
# Test Parameters
```
var adUnits = [{
code: 'placementid_0',
mediaTypes: {
banner: {
sizes: [[300, 250], [300,600]]
}
},
bids: [{
bidder: 'colossusssp',
params: {
placement_id: 0,
traffic: 'banner'
}
}]
}
];
code: 'placementid_0',
mediaTypes: {
banner: {
sizes: [[300, 250], [300,600]]
}
},
bids: [{
bidder: 'colossusssp',
params: {
placement_id: 0,
traffic: 'banner'
}
}]
];
```
Loading