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

[Triplelift] Fix FPD key-value pairs logic #6065

Merged
merged 47 commits into from
Dec 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 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
0a700ff
add advertiserDomains support
Nov 16, 2020
b9d8b91
Merge remote-tracking branch 'upstream/master'
Nov 17, 2020
16fe398
Merge pull request #11 from triplelift-internal/TL-18499-add-adomain-…
Nov 17, 2020
d4e9722
Merge remote-tracking branch 'upstream/master'
Nov 19, 2020
7096e4a
follow spec to parse fpd
Nov 24, 2020
f202f4c
ad unit support stub
Nov 24, 2020
4e417a2
adunit method
Nov 24, 2020
de66901
ad unit etc
Nov 25, 2020
f175839
typo
Nov 25, 2020
fe09847
fix test
Nov 25, 2020
9fe0ffc
typo
Nov 25, 2020
cf75aba
change to const
Dec 1, 2020
206dd2c
Merge remote-tracking branch 'upstream/master'
Dec 1, 2020
3e53da4
Merge pull request #12 from triplelift-internal/fpd-parsing-bug
Dec 1, 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
31 changes: 28 additions & 3 deletions modules/tripleliftBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ function _buildPostBody(bidRequests) {
} else if (bidRequest.mediaTypes.banner) {
imp.banner = { format: _sizes(bidRequest.sizes) };
};
if (!utils.isEmpty(bidRequest.fpd)) {
imp.fpd = _getAdUnitFpd(bidRequest.fpd);
}
return imp;
});

Expand Down Expand Up @@ -183,12 +186,34 @@ function _getFloor (bid) {
}

function _getGlobalFpd() {
let fpd = {};
const fpd = {};
const context = {}
const user = {};

const fpdContext = Object.assign({}, config.getConfig('fpd.context'));
const fpdUser = Object.assign({}, config.getConfig('fpd.user'));

_addEntries(fpd, fpdContext);
_addEntries(fpd, fpdUser);
_addEntries(context, fpdContext);
_addEntries(user, fpdUser);

if (!utils.isEmpty(context)) {
fpd.context = context;
}
if (!utils.isEmpty(user)) {
fpd.user = user;
}
return fpd;
}

function _getAdUnitFpd(adUnitFpd) {
const fpd = {};
const context = {};

_addEntries(context, adUnitFpd.context);

if (!utils.isEmpty(context)) {
fpd.context = context;
}

return fpd;
}
Expand Down
31 changes: 24 additions & 7 deletions test/spec/modules/tripleliftBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ describe('triplelift adapter', function () {
auctionId: '1d1a030790a475',
userId: {},
schain,
fpd: {
context: {
pbAdSlot: 'homepage-top-rect',
data: {
adUnitSpecificAttribute: 123
}
}
}
},
{
bidder: 'triplelift',
Expand Down Expand Up @@ -597,17 +605,19 @@ describe('triplelift adapter', function () {
const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
expect(request.data.imp[0].floor).to.equal(1.99);
});
it('should send fpd on root level ext if kvps are available', function() {
it('should send global config fpd if kvps are available', function() {
const sens = null;
const category = ['news', 'weather', 'hurricane'];
const pmp_elig = 'true';
const fpd = {
context: {
pmp_elig,
category,
pmp_elig: pmp_elig,
data: {
category: category
}
},
user: {
sens,
sens: sens,
}
}
sandbox.stub(config, 'getConfig').callsFake(key => {
Expand All @@ -618,9 +628,16 @@ describe('triplelift adapter', function () {
});
const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
const { data: payload } = request;
expect(payload.ext.fpd).to.not.haveOwnProperty('sens');
expect(payload.ext.fpd).to.haveOwnProperty('category');
expect(payload.ext.fpd).to.haveOwnProperty('pmp_elig');
expect(payload.ext.fpd.user).to.not.exist;
expect(payload.ext.fpd.context.data).to.haveOwnProperty('category');
expect(payload.ext.fpd.context).to.haveOwnProperty('pmp_elig');
});
it('should send ad unit fpd if kvps are available', function() {
const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
expect(request.data.imp[0].fpd.context).to.haveOwnProperty('pbAdSlot');
expect(request.data.imp[0].fpd.context).to.haveOwnProperty('data');
expect(request.data.imp[0].fpd.context.data).to.haveOwnProperty('adUnitSpecificAttribute');
expect(request.data.imp[1].fpd).to.not.exist;
});
});

Expand Down