Mile Bid Adapter: Initial release#14388
Conversation
|
Tread carefully! This PR adds 98 linter errors (possibly disabled through directives):
|
79f53cf to
4544783
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4544783d98
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
modules/mileBidAdapter.ts
Outdated
| const sizes = deepAccess(bid, 'mediaTypes.banner.sizes'); | ||
| sizes.forEach((size: string | number[]) => { |
There was a problem hiding this comment.
Guard banner sizes before iterating floors
When an ad unit uses the legacy sizes field instead of mediaTypes.banner.sizes (still supported in Prebid), deepAccess returns undefined and sizes.forEach(...) throws, aborting buildRequests and preventing any bids from being sent. This should defensively fall back to bid.sizes or an empty array before iterating so auctions with older configs don’t crash.
Useful? React with 👍 / 👎.
| if (siteIdTracker === undefined) { | ||
| siteIdTracker = params.siteId; | ||
| } else if (siteIdTracker !== params.siteId) { | ||
| logError(`${BIDDER_CODE}: Site ID mismatch: ${siteIdTracker} !== ${params.siteId}`); | ||
| return false; |
There was a problem hiding this comment.
Avoid persisting site/publisher IDs across auctions
The module-scoped siteIdTracker/publisherIdTracker are set on the first valid bid and then used to reject later bids with different IDs; because these variables are never reset per auction, any SPA navigation or reconfiguration that changes siteId/publisherId will cause all subsequent Mile bids to be rejected. This silently drops demand in multi-tenant or multi-site setups and should be scoped to a single bidderRequest instead of global state.
Useful? React with 👍 / 👎.
modules/mileBidAdapter.ts
Outdated
| ajax(MILE_ANALYTICS_ENDPOINT, null, JSON.stringify([winNotificationData]), { method: 'POST'}); | ||
|
|
||
| // @ts-expect-error - bid.nurl is not defined | ||
| ajax(bid.nurl, null, null, { method: 'GET' }); |
There was a problem hiding this comment.
bid.nurl is optional and only added when the server response includes it, but onBidWon calls ajax(bid.nurl, ...) unconditionally. If a winning bid lacks nurl, this passes undefined into ajax and will throw during request construction, breaking the win notification path. Check for bid.nurl before making the GET request.
Useful? React with 👍 / 👎.
|
Tread carefully! This PR adds 3 linter errors (possibly disabled through directives):
|
1 similar comment
|
Tread carefully! This PR adds 3 linter errors (possibly disabled through directives):
|
Pull Request Test Coverage Report for Build 21853777053Details
💛 - Coveralls |
6096069 to
a8f1479
Compare
|
Tread carefully! This PR adds 1 linter error (possibly disabled through directives):
|
1 similar comment
|
Tread carefully! This PR adds 1 linter error (possibly disabled through directives):
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ccc6d330a2
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const sizes = deepAccess(bid, 'mediaTypes.banner.sizes') || []; | ||
| const floorPrice = getLowestFloorPrice(bid); | ||
|
|
||
| const imp: any = { | ||
| id: bid.bidId, |
There was a problem hiding this comment.
Populate banner format from legacy sizes
When an ad unit uses the legacy bid.sizes field (still supported in Prebid), deepAccess(bid, 'mediaTypes.banner.sizes') is undefined, so sizes becomes [] and the imp.banner.format array is empty. That yields an OpenRTB impression without any size information, which can cause Mile to reject the request or return no bids for legacy configs. Consider falling back to bid.sizes (or parseSizesInput) when mediaTypes.banner.sizes is absent.
Useful? React with 👍 / 👎.
| // OpenRTB 2.5 response format: seatbid[] contains bid[] | ||
| const seatbids = response.bids || []; | ||
|
|
There was a problem hiding this comment.
Parse standard OpenRTB seatbid responses
The response parser is labeled as “OpenRTB 2.5”, but it reads bids from response.bids and iterates that directly. Standard OpenRTB uses seatbid[].bid[]; if the Mile endpoint returns a compliant OpenRTB response, this code will ignore all bids and yield an empty bidResponses array. To avoid silently dropping bids, parse response.seatbid (and the nested bid arrays) before building bid responses.
Useful? React with 👍 / 👎.
jsnellbaker
left a comment
There was a problem hiding this comment.
@shashankatd do you have any test params for your bidder that would return a test bid, so I can verify the adapter's e2e workflow?
|
@jsnellbaker I've updated the test parameters in mileBidAdapter.md. I've also added it below. |
|
Hi @shashankatd When I tried to use the test params on the hello_world test page, I saw the endpoint was returning a 404 error. Can you please take a look? Below is a copy of the URL and it's payload. Payload: |
|
instead of test-site-id and test-placement-id , set test-site and test-placement in request-body.
|
|
@jsnellbaker I have updated the test parameters in the mileBidderAdapter markdown file. |
jsnellbaker
left a comment
There was a problem hiding this comment.
Thanks for the clarification, the other params did return a bid response.
Type of change
Bugfix
Feature
New bidder adapter
Updated bidder adapter
Code style update (formatting, local variables)
Refactoring (no functional changes, no api changes)
Build related changes
CI related changes
Does this change affect user-facing APIs or examples documented on http://prebid.org?
Other
Description of change
This PR introduces a new Mile bid adapter for Prebid.js, enabling publishers to access Mile demand sources.
Other information
Prebid Dev Docs PR