Skip to content

Commit

Permalink
TL: Add GVLID, update validation method, add unit tests (prebid#5904)
Browse files Browse the repository at this point in the history
* Add IdentityLink support and fix UnifiedId.

It appears we've been looking for UnifiedId userIds
on the bidderRequest object, when they are found on bidRequests.
This commit fixes that error, and adds support for IdentityLink.

* change maintainer email to group

* TripleLift: Sending schain (#1)

* Sending schain

* null -> undefined

* Hardcode sync endpoint protocol

* Switch to EB2 sync endpoint

* Add support for image based user syncing

* Rename endpoint variable

* Add assertion

* Add CCPA query param

* Simplify check for usPrivacy argument

* put advertiser name in the bid.meta field if it exists

* update unit tests with meta.advertiserName field

* Triplelift: FPD key value pair support (#5)

* Triplelift: Add support for global fpd

* don't filter fpd

* adds coppa support back in

* add gvlid, update validation method, add unit tests

* remove advertiserDomains logic

* typo

* update _buildResponseObject to use new instream validation

Co-authored-by: Will Chapin <[email protected]>
Co-authored-by: colbertk <[email protected]>
Co-authored-by: David Andersen <[email protected]>
Co-authored-by: Brandon Ling <[email protected]>
Co-authored-by: colbertk <[email protected]>
Co-authored-by: Kevin Zhou <[email protected]>
Co-authored-by: kzhouTL <[email protected]>
Co-authored-by: Sy Dao <[email protected]>
  • Loading branch information
9 people authored Nov 3, 2020
1 parent 07ec2bc commit 84649e8
Show file tree
Hide file tree
Showing 2 changed files with 165 additions and 11 deletions.
9 changes: 3 additions & 6 deletions modules/tripleliftBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,17 @@ import { registerBidder } from '../src/adapters/bidderFactory.js';
import * as utils from '../src/utils.js';
import { config } from '../src/config.js';

const GVLID = 28;
const BIDDER_CODE = 'triplelift';
const STR_ENDPOINT = 'https://tlx.3lift.com/header/auction?';
let gdprApplies = true;
let consentString = null;

export const tripleliftAdapterSpec = {

gvlid: GVLID,
code: BIDDER_CODE,
supportedMediaTypes: [BANNER, VIDEO],
isBidRequestValid: function (bid) {
if (bid.mediaTypes.video) {
let video = _getORTBVideo(bid);
if (!video.w || !video.h) return false;
}
return typeof bid.params.inventoryCode !== 'undefined';
},

Expand Down Expand Up @@ -288,7 +285,7 @@ function _buildResponseObject(bidderRequest, bid) {
meta: {}
};

if (breq.mediaTypes.video) {
if (_isInstreamBidRequest(breq)) {
bidResponse.vastXml = bid.ad;
bidResponse.mediaType = 'video';
};
Expand Down
167 changes: 162 additions & 5 deletions test/spec/modules/tripleliftBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,21 @@ describe('triplelift adapter', function () {
expect(tripleliftAdapterSpec.isBidRequestValid(instreamBid)).to.equal(true);
});

it('should return true when required params found - instream - 2', function () {
delete instreamBid.mediaTypes.playerSize;
delete instreamBid.params.video.w;
delete instreamBid.params.video.h;
// the only required param is inventoryCode
expect(tripleliftAdapterSpec.isBidRequestValid(instreamBid)).to.equal(true);
});

it('should return false when required params are not passed', function () {
delete bid.params.inventoryCode;
expect(tripleliftAdapterSpec.isBidRequestValid(bid)).to.equal(false);
});

it('should return false when required params are not passed - instream', function () {
delete instreamBid.mediaTypes.playerSize;
delete instreamBid.params.video.w;
delete instreamBid.params.video.h;
delete instreamBid.params.inventoryCode;
expect(tripleliftAdapterSpec.isBidRequestValid(instreamBid)).to.equal(false);
});
});
Expand Down Expand Up @@ -165,6 +171,7 @@ describe('triplelift adapter', function () {
userId: {},
schain,
},
// banner and outstream video
{
bidder: 'triplelift',
params: {
Expand Down Expand Up @@ -197,6 +204,140 @@ describe('triplelift adapter', function () {
auctionId: '1d1a030790a475',
userId: {},
schain,
},
// banner and incomplete video
{
bidder: 'triplelift',
params: {
inventoryCode: 'outstream_test',
floor: 1.0,
video: {
mimes: ['video/mp4'],
maxduration: 30,
minduration: 6,
w: 640,
h: 480
}
},
mediaTypes: {
video: {

},
banner: {
sizes: [
[970, 250],
[1, 1]
]
}
},
adUnitCode: 'adunit-code-instream',
sizes: [[300, 250], [300, 600], [1, 1, 1], ['flex']],
bidId: '30b31c1838de1e',
bidderRequestId: '22edbae2733bf6',
auctionId: '1d1a030790a475',
userId: {},
schain,
},
// incomplete banner and incomplete video
{
bidder: 'triplelift',
params: {
inventoryCode: 'outstream_test',
floor: 1.0,
video: {
mimes: ['video/mp4'],
maxduration: 30,
minduration: 6,
w: 640,
h: 480
}
},
mediaTypes: {
video: {

},
banner: {

}
},
adUnitCode: 'adunit-code-instream',
sizes: [[300, 250], [300, 600], [1, 1, 1], ['flex']],
bidId: '30b31c1838de1e',
bidderRequestId: '22edbae2733bf6',
auctionId: '1d1a030790a475',
userId: {},
schain,
},
// banner and instream video
{
bidder: 'triplelift',
params: {
inventoryCode: 'outstream_test',
floor: 1.0,
video: {
mimes: ['video/mp4'],
maxduration: 30,
minduration: 6,
w: 640,
h: 480
}
},
mediaTypes: {
video: {
context: 'instream',
playerSize: [640, 480]
},
banner: {
sizes: [
[970, 250],
[1, 1]
]
}
},
adUnitCode: 'adunit-code-instream',
sizes: [[300, 250], [300, 600], [1, 1, 1], ['flex']],
bidId: '30b31c1838de1e',
bidderRequestId: '22edbae2733bf6',
auctionId: '1d1a030790a475',
userId: {},
schain,
},
// banner and outream video and native
{
bidder: 'triplelift',
params: {
inventoryCode: 'outstream_test',
floor: 1.0,
video: {
mimes: ['video/mp4'],
maxduration: 30,
minduration: 6,
w: 640,
h: 480
}
},
mediaTypes: {
video: {
context: 'outstream',
playerSize: [640, 480]
},
banner: {
sizes: [
[970, 250],
[1, 1]
]
},
native: {

}
},
adUnitCode: 'adunit-code-instream',
sizes: [[300, 250], [300, 600], [1, 1, 1], ['flex']],
bidId: '30b31c1838de1e',
bidderRequestId: '22edbae2733bf6',
auctionId: '1d1a030790a475',
userId: {},
schain,
}
];

Expand Down Expand Up @@ -261,10 +402,26 @@ describe('triplelift adapter', function () {
expect(payload.imp[1].tagid).to.equal('insteam_test');
expect(payload.imp[1].floor).to.equal(1.0);
expect(payload.imp[1].video).to.exist.and.to.be.a('object');

// banner and outstream video
expect(payload.imp[2]).to.not.have.property('video');
expect(payload.imp[2]).to.have.property('banner');
expect(payload.imp[2].banner.format).to.deep.equal([{w: 300, h: 250}, {w: 300, h: 600}]);
// banner and incomplete video
expect(payload.imp[3]).to.not.have.property('video');
expect(payload.imp[3]).to.have.property('banner');
expect(payload.imp[3].banner.format).to.deep.equal([{w: 300, h: 250}, {w: 300, h: 600}]);
// incomplete mediatypes.banner and incomplete video
expect(payload.imp[4]).to.not.have.property('video');
expect(payload.imp[4]).to.have.property('banner');
expect(payload.imp[4].banner.format).to.deep.equal([{w: 300, h: 250}, {w: 300, h: 600}]);
// banner and instream video
expect(payload.imp[5]).to.not.have.property('banner');
expect(payload.imp[5]).to.have.property('video');
expect(payload.imp[5].video).to.exist.and.to.be.a('object');
// banner and outream video and native
expect(payload.imp[6]).to.not.have.property('video');
expect(payload.imp[6]).to.have.property('banner');
expect(payload.imp[6].banner.format).to.deep.equal([{w: 300, h: 250}, {w: 300, h: 600}]);
});

it('should add tdid to the payload if included', function () {
Expand Down Expand Up @@ -587,7 +744,7 @@ describe('triplelift adapter', function () {

it('should include the advertiser name in the meta field if available', function () {
let result = tripleliftAdapterSpec.interpretResponse(response, {bidderRequest});
expect(result[0].meta.advertiserName).to.equal('fake advertiser name')
expect(result[0].meta.advertiserName).to.equal('fake advertiser name');
expect(result[1].meta).to.not.have.key('advertiserName');
});
});
Expand Down

0 comments on commit 84649e8

Please sign in to comment.