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

PAAPI: parallel contextual and IG auctions #12205

Merged
merged 14 commits into from
Oct 23, 2024
1 change: 1 addition & 0 deletions integrationExamples/top-level-paapi/gam-contextual.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
debug: true,
paapi: {
enabled: true,
parallel: true,
gpt: {
autoconfig: false
},
Expand Down
1 change: 1 addition & 0 deletions integrationExamples/top-level-paapi/no_adserver.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
debug: true,
paapi: {
enabled: true,
parallel: true,
gpt: {
autoconfig: false
},
Expand Down
33 changes: 29 additions & 4 deletions modules/optableBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,42 @@ const BIDDER_CODE = 'optable';
const DEFAULT_REGION = 'ca'
const DEFAULT_ORIGIN = 'https://ads.optable.co'

function getOrigin() {
return config.getConfig('optable.origin') ?? DEFAULT_ORIGIN;
}

function getBaseUrl() {
const region = config.getConfig('optable.region') ?? DEFAULT_REGION;
return `${getOrigin()}/${region}`
}

export const spec = {
code: BIDDER_CODE,
isBidRequestValid: function(bid) { return !!bid.params?.site },
buildRequests: function(bidRequests, bidderRequest) {
const region = config.getConfig('optable.region') ?? DEFAULT_REGION
const origin = config.getConfig('optable.origin') ?? DEFAULT_ORIGIN
const requestURL = `${origin}/${region}/ortb2/v1/ssp/bid`
const requestURL = `${getBaseUrl()}/ortb2/v1/ssp/bid`
const data = converter.toORTB({ bidRequests, bidderRequest, context: { mediaType: BANNER } });

return { method: 'POST', url: requestURL, data }
},
buildPAAPIConfigs: function(bidRequests) {
const origin = getOrigin();
return bidRequests
.filter(req => req.ortb2Imp?.ext?.ae)
.map(bid => ({
bidId: bid.bidId,
config: {
seller: origin,
decisionLogicURL: `${getBaseUrl()}/paapi/v1/ssp/decision-logic.js?origin=${bid.params.site}`,
interestGroupBuyers: [origin],
Copy link
Member

Choose a reason for hiding this comment

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

Is there any consideration to have the PAAPI configs be dynamically configured, possibly from storing into localstorage from a previous auction result. I'm thinking about origins specifically but could be other things we might want to be dynamic. As a SSP the buyer origin is not a hardcoded value as we have multiple buyers depending on context.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is there any consideration to have the PAAPI configs be dynamically configured, possibly from storing into localstorage from a previous auction result.

The interface should be general enough to allow this from an adapter. If it becomes a common pattern we can consider extracting it to a shared library - right now I don't know how that would look like (I expect SSP will still want to get in the first auction, which requires hardcoded buyers).

As a SSP the buyer origin is not a hardcoded value as we have multiple buyers depending on context.

Yes, and IMO this will quickly devolve into every prebid bundle containing every buyer that exists - but alas we decided that's what we want.

perBuyerMultiBidLimits: {
[origin]: 100
},
perBuyerCurrencies: {
[origin]: 'USD'
}
}
}))
},
Comment on lines +37 to +55
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@zapo this "freezes" part of the auction configs into the adapter, meaning that updates would need a code change to be deployed, to enable parallel (faster) IG auctions. I got the values by looking at what your endpoint returns - but I don't know if they're universal (and I don't know if your endpoint respects the ae flag like I do here).

auctionSignals is still picked up from the endpoint through interpretResponse (as would a few other signals that I don't see populated in your case), but everything in here must be provided synchronously.

Copy link
Contributor

Choose a reason for hiding this comment

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

@dgirardi Looks good, yes they are universal for now. The endpoint does respect ae but only when set at top level (initial proposal) imp.ext.ae, I need to fix it to also look for imp.ext.igs.ae.

interpretResponse: function(response, request) {
const bids = converter.fromORTB({ response: response.body, request: request.data }).bids
const auctionConfigs = (response.body.ext?.optable?.fledge?.auctionconfigs ?? []).map((cfg) => {
Expand Down
Loading