Skip to content

Commit

Permalink
PAAPI: parallel contextual and IG auctions (#12205)
Browse files Browse the repository at this point in the history
* WIP parallel paapi

* Parallel auction configs

* revert optable changes

* trigger onAuctionConfigs depending on parallel settings

* attach parallel paapi processing handlers

* handle TIDs for buildPAAPIConfigs

* turn on parallel flag in integ example

* Support parallel igb

* improve comment

* fix lint

* surrender to the Linter

* convert optable

* improve signal handling

* Do not provide deprecatedRenderURLReplacements in parallel auctions
  • Loading branch information
dgirardi authored Oct 23, 2024
1 parent ac44557 commit d7c8547
Show file tree
Hide file tree
Showing 10 changed files with 925 additions and 62 deletions.
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],
perBuyerMultiBidLimits: {
[origin]: 100
},
perBuyerCurrencies: {
[origin]: 'USD'
}
}
}))
},
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

0 comments on commit d7c8547

Please sign in to comment.