Skip to content

Commit

Permalink
User ID's (liveramp, britepool) and gdpr (prebid#5114)
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

Co-authored-by: Vladislav Isaiko <vladis@smartyads.com>
Co-authored-by: Aiholkin <artem.iholkin@smartyads.com>
  • Loading branch information
3 people authored Apr 17, 2020
1 parent af307f3 commit a213fa0
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 3 deletions.
30 changes: 28 additions & 2 deletions modules/colossussspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ function isBidResponseValid(bid) {
}
}

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],
Expand Down Expand Up @@ -60,13 +73,17 @@ export const spec = {
'secure': location.protocol === 'https:' ? 1 : 0,
'host': location.host,
'page': location.pathname,
'placements': placements
'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++) {
Expand All @@ -76,11 +93,20 @@ export const spec = {
placementId: bid.params.placement_id,
bidId: bid.bidId,
sizes: bid.mediaTypes[traff].sizes,
traffic: traff
traffic: traff,
eids: []
};
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'
});
}
placements.push(placement);
}
return {
Expand Down
31 changes: 30 additions & 1 deletion test/spec/modules/colossussspBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('ColossussspAdapter', function () {
let placements = data['placements'];
for (let i = 0; i < placements.length; i++) {
let placement = placements[i];
expect(placement).to.have.all.keys('placementId', 'bidId', 'traffic', 'sizes', 'schain');
expect(placement).to.have.all.keys('placementId', 'eids', 'bidId', 'traffic', 'sizes', 'schain');
expect(placement.schain).to.be.an('object')
expect(placement.placementId).to.be.a('number');
expect(placement.bidId).to.be.a('string');
Expand All @@ -102,6 +102,35 @@ describe('ColossussspAdapter', function () {
expect(data.placements).to.be.an('array').that.is.empty;
});
});

describe('buildRequests with user ids', function () {
bid.userId = {}
bid.userId.britepoolid = 'britepoolid123';
bid.userId.idl_env = 'idl_env123';
bid.userId.tdid = 'tdid123';
bid.userId.id5id = 'id5id123'
let serverRequest = spec.buildRequests([bid], bidderRequest);
it('Returns valid data if array of bids is valid', function () {
let data = serverRequest.data;
let placements = data['placements'];
expect(data).to.be.an('object');
for (let i = 0; i < placements.length; i++) {
let placement = placements[i];
expect(placement).to.have.property('eids')
expect(placement.eids).to.be.an('array')
expect(placement.eids.length).to.be.equal(4)
for (let v of placement.eids) {
expect(v).to.have.all.keys('source', 'uids')
expect(v.source).to.be.oneOf(['britepool.com', 'identityLink', 'adserver.org', 'id5-sync.com'])
expect(v.uids).to.be.an('array');
expect(v.uids.length).to.be.equal(1)
expect(v.uids[0]).to.have.property('id')
expect(v.uids[0].id).to.be.oneOf(['britepoolid123', 'idl_env123', 'tdid123', 'id5id123'])
}
}
});
});

describe('interpretResponse', function () {
let resObject = {
body: [ {
Expand Down

0 comments on commit a213fa0

Please sign in to comment.