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

Ozone Project Bid Adapter: Support for auctionId and transactionId when a publisher opts in #12267

Merged
merged 5 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
47 changes: 26 additions & 21 deletions modules/ozoneBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const AUCTIONURI = '/openrtb2/auction';
const OZONECOOKIESYNC = '/static/load-cookie.html';
const OZONE_RENDERER_URL = 'https://prebid.the-ozone-project.com/ozone-renderer.js';
const ORIGIN_DEV = 'https://test.ozpr.net';
const OZONEVERSION = '2.9.3';
const OZONEVERSION = '2.9.4';
export const spec = {
gvlid: 524,
aliases: [{code: 'lmc', gvlid: 524}, {code: 'venatus', gvlid: 524}],
Expand Down Expand Up @@ -230,6 +230,10 @@ export const spec = {
ozoneRequest.device = {'w': window.innerWidth, 'h': window.innerHeight};
let placementIdOverrideFromGetParam = this.getPlacementIdOverrideFromGetParam(); // null or string
let schain = null;
var auctionId = deepAccess(validBidRequests, '0.ortb2.source.tid');
if (auctionId === '0') {
auctionId = null;
}
let tosendtags = validBidRequests.map(ozoneBidRequest => {
var obj = {};
let placementId = placementIdOverrideFromGetParam || this.getPlacementId(ozoneBidRequest); // prefer to use a valid override param, else the bidRequest placement Id
Expand Down Expand Up @@ -329,6 +333,13 @@ export const spec = {
if (gpid) {
deepSetValue(obj, 'ext.gpid', gpid);
}
let transactionId = deepAccess(ozoneBidRequest, 'ortb2Imp.ext.tid');
if (transactionId) {
obj.ext[whitelabelBidder].transactionId = transactionId; // this is the transactionId PER adUnit, common across bidders for this unit
}
if (auctionId) {
obj.ext[whitelabelBidder].auctionId = auctionId; // we were sent a valid auctionId to use - this will also be used as the root id value for the request
}
if (fledgeEnabled) { // fledge is enabled at some config level - pbjs.setBidderConfig or pbjs.setConfig
const auctionEnvironment = deepAccess(ozoneBidRequest, 'ortb2Imp.ext.ae'); // this will be set for one of 3 reasons; adunit, setBidderConfig, setConfig
if (isInteger(auctionEnvironment)) {
Expand Down Expand Up @@ -407,22 +418,16 @@ export const spec = {
}
extObj[whitelabelBidder].cookieDeprecationLabel = deepAccess(bidderRequest, 'ortb2.device.ext.cdep', 'none');
logInfo('cookieDeprecationLabel from bidderRequest object = ' + extObj[whitelabelBidder].cookieDeprecationLabel);
let ozUuid = generateUUID();
let batchRequestsVal = this.getBatchRequests(); // false|numeric
if (typeof batchRequestsVal === 'number') {
logInfo('going to batch the requests');
let arrRet = []; // return an array of objects containing data describing max 10 bids
for (let i = 0; i < tosendtags.length; i += batchRequestsVal) {
if (bidderRequest.auctionId) {
logInfo('Found bidderRequest.auctionId - will pass these values through & not generate our own id');
ozoneRequest.id = bidderRequest.auctionId;
ozoneRequest.auctionId = bidderRequest.auctionId;
deepSetValue(ozoneRequest, 'source.tid', deepAccess(bidderRequest, 'ortb2.source.tid'));
} else {
logInfo('Did not find bidderRequest.auctionId - will generate our own id');
ozoneRequest.id = ozUuid; // Unique ID of the bid request, provided by the exchange. (REQUIRED)
}
ozoneRequest.id = generateUUID(); // Unique ID of the bid request, provided by the exchange. (REQUIRED)
deepSetValue(ozoneRequest, 'user.ext.eids', userExtEids);
if (auctionId) {
deepSetValue(ozoneRequest, 'source.tid', auctionId);
}
ozoneRequest.imp = tosendtags.slice(i, i + batchRequestsVal);
ozoneRequest.ext = extObj;
if (ozoneRequest.imp.length > 0) {
Expand All @@ -440,18 +445,13 @@ export const spec = {
logInfo('requests will not be batched.');
if (singleRequest) {
logInfo('buildRequests starting to generate response for a single request');
if (bidderRequest.auctionId) {
logInfo('Found bidderRequest.auctionId - will pass these values through & not generate our own id');
ozoneRequest.id = bidderRequest.auctionId;
ozoneRequest.auctionId = bidderRequest.auctionId;
deepSetValue(ozoneRequest, 'source.tid', deepAccess(bidderRequest, 'ortb2.source.tid'));
} else {
logInfo('Did not find bidderRequest.auctionId - will generate our own id');
ozoneRequest.id = ozUuid; // Unique ID of the bid request, provided by the exchange. (REQUIRED)
}
ozoneRequest.id = generateUUID(); // Unique ID of the bid request, provided by the exchange. (REQUIRED)
ozoneRequest.imp = tosendtags;
ozoneRequest.ext = extObj;
deepSetValue(ozoneRequest, 'user.ext.eids', userExtEids);
if (auctionId) {
deepSetValue(ozoneRequest, 'source.tid', auctionId);
}
var ret = {
method: 'POST',
url: this.getAuctionUrl(),
Expand All @@ -470,6 +470,9 @@ export const spec = {
ozoneRequestSingle.imp = [imp];
ozoneRequestSingle.ext = extObj;
deepSetValue(ozoneRequestSingle, 'user.ext.eids', userExtEids);
if (auctionId) {
deepSetValue(ozoneRequestSingle, 'source.tid', auctionId);
}
logInfo('buildRequests RequestSingle (for non-single) = ', ozoneRequestSingle);
return {
method: 'POST',
Expand Down Expand Up @@ -891,7 +894,9 @@ export const spec = {
params: bid.params,
price: bid.price,
transactionId: bid.transactionId,
ttl: bid.ttl
ttl: bid.ttl,
ortb2: deepAccess(bid, 'ortb2'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

You're going to end up with enormous redundancy within your payload

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is purely for logging purposes as opposed to payload that is sent.

ortb2Imp: deepAccess(bid, 'ortb2Imp'),
};
if (bid.hasOwnProperty('floorData')) {
logObj.floorData = bid.floorData;
Expand Down
Loading