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

TL: Add GVLID, update validation method, add unit tests #5904

Merged
merged 33 commits into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
86546e9
Add IdentityLink support and fix UnifiedId.
willchapin Sep 16, 2019
a98d3a4
change maintainer email to group
willchapin Sep 16, 2019
837612c
Merge remote-tracking branch 'upstream/master'
willchapin Oct 22, 2019
0f5ea8b
TripleLift: Sending schain (#1)
colbertk Oct 24, 2019
44993e1
Hardcode sync endpoint protocol
davidwoodsandersen Nov 25, 2019
b0adb54
Switch to EB2 sync endpoint
davidwoodsandersen Nov 25, 2019
0c6c295
Add support for image based user syncing
davidwoodsandersen Nov 25, 2019
3f55f32
Rename endpoint variable
davidwoodsandersen Nov 26, 2019
280404f
Add assertion
davidwoodsandersen Nov 26, 2019
180bf09
Merge pull request #2 from triplelift-internal/usersync-fallback
davidwoodsandersen Nov 27, 2019
14b324d
Merge remote-tracking branch 'upstream/master'
davidwoodsandersen Nov 27, 2019
a42eb5a
Merge remote-tracking branch 'upstream/master'
davidwoodsandersen Dec 17, 2019
cad32b7
Add CCPA query param
davidwoodsandersen Dec 17, 2019
941e262
Simplify check for usPrivacy argument
davidwoodsandersen Dec 17, 2019
db26e09
Merge pull request #3 from triplelift-internal/ccpa-update
davidwoodsandersen Dec 17, 2019
2a3d692
Merge remote-tracking branch 'upstream/master'
Aug 18, 2020
f20bce6
Merge branch 'master' of https://github.com/prebid/Prebid.js
colbertk Sep 1, 2020
176460c
put advertiser name in the bid.meta field if it exists
Sep 4, 2020
61ebc4b
update unit tests with meta.advertiserName field
Sep 4, 2020
e8c165e
Merge pull request #6 from triplelift-internal/TL-17254-expose-advert…
kzhouTL Sep 8, 2020
f0ba084
Triplelift: FPD key value pair support (#5)
colbertk Sep 10, 2020
373b4b4
adds coppa support back in
colbertk Sep 10, 2020
f56d626
Merge pull request #8 from triplelift-internal/add-coppa-support-back
colbertk Sep 10, 2020
8e854a9
Merge remote-tracking branch 'upstream/master'
Oct 26, 2020
feb4f62
add gvlid, update validation method, add unit tests
iam-sydao Oct 26, 2020
ce9845b
remove advertiserDomains logic
Oct 27, 2020
633ea11
typo
Oct 27, 2020
4ad7071
Merge pull request #9 from triplelift-internal/TL-18466-gvilid
sdao-tl Oct 28, 2020
c848956
Merge remote-tracking branch 'upstream/master'
Oct 30, 2020
c490963
Merge remote-tracking branch 'upstream/master'
Nov 2, 2020
a9c63ee
update _buildResponseObject to use new instream validation
iam-sydao Nov 2, 2020
fcbe5eb
Merge branch 'master' of github.com:triplelift-internal/Prebid.js int…
iam-sydao Nov 2, 2020
6b2e379
Merge pull request #10 from triplelift-internal/TL-18466-gvilid
sdao-tl Nov 2, 2020
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
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