Skip to content

Commit f46494d

Browse files
sebrobertMichele Nasti
authored and
Michele Nasti
committed
beOp BidAdapter: FirstPartyData management and ingest Permutive segments (prebid#9947)
* Add psegs compatibility for permutive * Add tests for FirstPartyData and Permutive * Rearrange permutive segments ids location from ortb2 * Use permutive keywords instead of p_standard
1 parent 6b7fe6a commit f46494d

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

modules/beopBidAdapter.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ export const spec = {
3737
*/
3838
buildRequests: function(validBidRequests, bidderRequest) {
3939
const slots = validBidRequests.map(beOpRequestSlotsMaker);
40+
const firstPartyData = bidderRequest.ortb2;
41+
const psegs = (firstPartyData && firstPartyData.user && firstPartyData.user.ext && firstPartyData.user.ext.data) ? firstPartyData.user.ext.data.permutive : undefined;
4042
const pageUrl = getPageUrl(bidderRequest.refererInfo, window);
4143
const gdpr = bidderRequest.gdprConsent;
4244
const firstSlot = slots[0];
@@ -68,6 +70,10 @@ export const spec = {
6870
tc_string: (gdpr && gdpr.gdprApplies) ? gdpr.consentString : null,
6971
};
7072

73+
if (psegs) {
74+
Object.assign(payloadObject, {psegs: psegs});
75+
}
76+
7177
const payloadString = JSON.stringify(payloadObject);
7278
return {
7379
method: 'POST',

test/spec/modules/beopBidAdapter_spec.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,30 @@ describe('BeOp Bid Adapter tests', () => {
130130
expect(payload.url).to.exist;
131131
// check that the protocol is added correctly
132132
expect(payload.url).to.equal('http://test.te');
133+
expect(payload.psegs).to.not.exist;
134+
});
135+
136+
it('should call the endpoint with psegs data if any', function () {
137+
let bidderRequest =
138+
{
139+
'ortb2': {
140+
'user': {
141+
'ext': {
142+
'data': {
143+
'permutive': [1234, 5678, 910]
144+
}
145+
}
146+
}
147+
}
148+
};
149+
150+
const request = spec.buildRequests(bidRequests, bidderRequest);
151+
const payload = JSON.parse(request.data);
152+
expect(payload.psegs).to.exist;
153+
expect(payload.psegs).to.include(1234);
154+
expect(payload.psegs).to.include(5678);
155+
expect(payload.psegs).to.include(910);
156+
expect(payload.psegs).to.not.include(1);
133157
});
134158

135159
it('should not prepend the protocol in page url if already present', function () {

0 commit comments

Comments
 (0)