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

beOp BidAdapter: FirstPartyData management and ingest Permutive segments #9947

Merged
merged 4 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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.psegs : undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these on user.ext.psegs? hopefully permutive isn't making up mainline ortb fields

Copy link
Collaborator

@patmmccann patmmccann May 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, it appears they are here

deepSetValue(ortbConfig, `ortb2.user.ext.data.${PERMUTIVE_STANDARD_KEYWORD}`, segmentIDs)

Where did you find location user.psegs?

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
20 changes: 20 additions & 0 deletions test/spec/modules/beopBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,26 @@ 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': {
'psegs': [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