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

Adagio Bid Adapter : enrich bid params #10346

Merged
merged 1 commit into from
Aug 10, 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
14 changes: 11 additions & 3 deletions modules/adagioBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ export const spec = {
const aucId = generateUUID()

const adUnits = _map(validBidRequests, (rawBidRequest) => {
const bidRequest = {...rawBidRequest}
const bidRequest = deepClone(rawBidRequest);

// Fix https://github.com/prebid/Prebid.js/issues/9781
bidRequest.auctionId = aucId
Expand Down Expand Up @@ -1118,15 +1118,23 @@ export const spec = {
// remove useless props
delete adUnitCopy.floorData;
delete adUnitCopy.params.siteId;
delete adUnitCopy.userId
delete adUnitCopy.userIdAsEids
delete adUnitCopy.userId;
delete adUnitCopy.userIdAsEids;

groupedAdUnits[adUnitCopy.params.organizationId] = groupedAdUnits[adUnitCopy.params.organizationId] || [];
groupedAdUnits[adUnitCopy.params.organizationId].push(adUnitCopy);

return groupedAdUnits;
}, {});

// Adding more params on the original bid object.
// Those params are not sent to the server.
// They are used for further operations on analytics adapter.
validBidRequests.forEach(rawBidRequest => {
rawBidRequest.params.adagioAuctionId = aucId
rawBidRequest.params.pageviewId = pageviewId
});

// Build one request per organizationId
const requests = _map(Object.keys(groupedAdUnits), organizationId => {
return {
Expand Down
15 changes: 15 additions & 0 deletions test/spec/modules/adagioBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,21 @@ describe('Adagio bid adapter', () => {
expect(requests[0].data.adUnits[0].transactionId).to.not.exist;
});

it('should enrich prebid bid requests params', function() {
const expectedAuctionId = '373bcda7-9794-4f1c-be2c-0d223d11d579'
const expectedPageviewId = '56befc26-8cf0-472d-b105-73896df8eb89';
sandbox.stub(utils, 'generateUUID').returns(expectedAuctionId);
sandbox.stub(adagio, 'getPageviewId').returns(expectedPageviewId);

const bid01 = new BidRequestBuilder().withParams().build();
const bidderRequest = new BidderRequestBuilder().build();

spec.buildRequests([bid01], bidderRequest);

expect(bid01.params.adagioAuctionId).eq(expectedAuctionId);
expect(bid01.params.pageviewId).eq(expectedPageviewId);
});

it('should enqueue computed features for collect usage', function() {
sandbox.stub(Date, 'now').returns(12345);

Expand Down