Skip to content

Commit

Permalink
TripleLift: Sending schain (prebid#4375)
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
  • Loading branch information
colbertk authored and tadam75 committed Jan 9, 2020
1 parent fd4c49f commit 0d7d070
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
6 changes: 6 additions & 0 deletions modules/tripleliftBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const tripleliftAdapterSpec = {

function _buildPostBody(bidRequests) {
let data = {};
let { schain } = bidRequests[0];
data.imp = bidRequests.map(function(bid, index) {
return {
id: index,
Expand All @@ -102,6 +103,11 @@ function _buildPostBody(bidRequests) {
};
}

if (schain) {
data.ext = {
schain
}
}
return data;
}

Expand Down
28 changes: 27 additions & 1 deletion test/spec/modules/tripleliftBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ describe('triplelift adapter', function () {
describe('buildRequests', function () {
let bidRequests;
let bidderRequest;
const schain = {
validation: 'strict',
config: {
ver: '1.0',
complete: 1,
nodes: [
{
asi: 'indirectseller.com',
sid: '00001',
hp: 1,
}
]
}
};

this.beforeEach(() => {
bidRequests = [
Expand All @@ -71,6 +85,7 @@ describe('triplelift adapter', function () {
bidderRequestId: '22edbae2733bf6',
auctionId: '1d1a030790a475',
userId: {},
schain,
}
];

Expand Down Expand Up @@ -220,6 +235,17 @@ describe('triplelift adapter', function () {
expect(url).to.match(new RegExp('(?:' + prebid.version + ')'))
expect(url).to.match(/(?:referrer)/);
});
it('should return schain when present', function() {
const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
const { data: payload } = request;
expect(payload.ext.schain).to.deep.equal(schain);
});
it('should not create root level ext when schain is not present', function() {
bidRequests[0].schain = undefined;
const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
const { data: payload } = request;
expect(payload.ext).to.deep.equal(undefined);
});
});

describe('interpretResponse', function () {
Expand Down Expand Up @@ -280,7 +306,7 @@ describe('triplelift adapter', function () {
expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0]));
});

it('should return multile responses to support SRA', function () {
it('should return multiple responses to support SRA', function () {
let response = {
body: {
bids: [
Expand Down

0 comments on commit 0d7d070

Please sign in to comment.