Skip to content

beOp BidAdapter: FirstPartyData management and ingest Permutive segments #9947

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

Merged
merged 4 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions modules/beopBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export const spec = {
*/
buildRequests: function(validBidRequests, bidderRequest) {
const slots = validBidRequests.map(beOpRequestSlotsMaker);
const firstPartyData = bidderRequest.ortb2;
const psegs = (firstPartyData && firstPartyData.user && firstPartyData.user.ext && firstPartyData.user.ext.data) ? firstPartyData.user.ext.data.permutive : undefined;
const pageUrl = getPageUrl(bidderRequest.refererInfo, window);
const gdpr = bidderRequest.gdprConsent;
const firstSlot = slots[0];
Expand Down Expand Up @@ -67,6 +69,10 @@ export const spec = {
tc_string: (gdpr && gdpr.gdprApplies) ? gdpr.consentString : null,
};

if (psegs) {
Object.assign(payloadObject, {psegs: psegs});
}

const payloadString = JSON.stringify(payloadObject);
return {
method: 'POST',
Expand Down
24 changes: 24 additions & 0 deletions test/spec/modules/beopBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,30 @@ describe('BeOp Bid Adapter tests', () => {
expect(payload.url).to.exist;
// check that the protocol is added correctly
expect(payload.url).to.equal('http://test.te');
expect(payload.psegs).to.not.exist;
});

it('should call the endpoint with psegs data if any', function () {
let bidderRequest =
{
'ortb2': {
'user': {
'ext': {
'data': {
'permutive': [1234, 5678, 910]
}
}
}
}
};

const request = spec.buildRequests(bidRequests, bidderRequest);
const payload = JSON.parse(request.data);
expect(payload.psegs).to.exist;
expect(payload.psegs).to.include(1234);
expect(payload.psegs).to.include(5678);
expect(payload.psegs).to.include(910);
expect(payload.psegs).to.not.include(1);
});

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