-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Start.io Bid Adapter : initial release #13048
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
Merged
patmmccann
merged 3 commits into
prebid:master
from
startappdev:implement-start-io-adapter
May 29, 2025
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| import { registerBidder } from '../src/adapters/bidderFactory.js'; | ||
| import { BANNER, VIDEO, NATIVE } from '../src/mediaTypes.js'; | ||
| import { logError } from '../src/utils.js'; | ||
| import { ortbConverter } from '../libraries/ortbConverter/converter.js' | ||
| import { ortb25Translator } from '../libraries/ortb2.5Translator/translator.js'; | ||
|
|
||
| const BIDDER_CODE = 'startio'; | ||
| const METHOD = 'POST'; | ||
| const GVLID = 1216; | ||
| const ENDPOINT_URL = `http://pbc-rtb.startappnetwork.com/1.3/2.5/getbid?account=pbc`; | ||
|
|
||
| const converter = ortbConverter({ | ||
| imp(buildImp, bidRequest, context) { | ||
| const imp = buildImp(bidRequest, context); | ||
|
|
||
| if (imp?.banner?.format?.[0]) { | ||
| imp.banner.w ??= imp.banner.format[0]?.w; | ||
| imp.banner.h ??= imp.banner.format[0]?.h; | ||
| } | ||
|
|
||
| return imp; | ||
| }, | ||
| request(buildRequest, imps, bidderRequest, context) { | ||
| const request = buildRequest(imps, bidderRequest, context); | ||
| const publisherId = bidderRequest?.bids?.[0]?.params?.publisherId; | ||
| if (request?.site) { | ||
| request.site.publisher = request.site.publisher || {}; | ||
| request.site.publisher.id = publisherId; | ||
| } else if (request?.app) { | ||
| request.app.publisher = request.app.publisher || {}; | ||
| request.app.publisher.id = publisherId; | ||
| } | ||
| request.ext = request.ext || {}; | ||
| request.ext.prebid = request.ext.prebid || {}; | ||
|
|
||
| return request; | ||
| }, | ||
| bidResponse(buildBidResponse, bid, context) { | ||
| const isValidBidType = bid?.ext?.prebid?.type === context?.mediaType; | ||
|
|
||
| if (context.mediaType === NATIVE) { | ||
| const ortb = JSON.parse(bid.adm); | ||
| bid.adm = ortb.native; | ||
| } | ||
|
|
||
| if (isValidBidType) { | ||
| return buildBidResponse(bid, context); | ||
| } | ||
|
|
||
| logError('Bid type is incorrect for bid: ', bid['id']) | ||
| }, | ||
| context: { | ||
| netRevenue: true, | ||
| ttl: 30 | ||
| }, | ||
| translator: ortb25Translator() | ||
| }); | ||
|
|
||
| export const spec = { | ||
| code: BIDDER_CODE, | ||
| supportedMediaTypes: [VIDEO, BANNER, NATIVE], | ||
| gvlid: GVLID, | ||
| isBidRequestValid: (bid) => !!bid, | ||
|
|
||
| buildRequests: (bidRequests, bidderRequest) => { | ||
| return bidRequests.map((bidRequest) => { | ||
| const mediaType = Object.keys(bidRequest.mediaTypes || {})[0] || BANNER; | ||
| const data = converter.toORTB({ bidRequests: [bidRequest], bidderRequest, context: { mediaType } }); | ||
|
|
||
| return { | ||
| method: METHOD, | ||
| url: ENDPOINT_URL, | ||
| options: { | ||
| contentType: 'text/plain', | ||
| withCredentials: false, | ||
| crossOrigin: true | ||
| }, | ||
| data: data, | ||
| }; | ||
| }); | ||
| }, | ||
|
|
||
| interpretResponse: ({ body }, req) => { | ||
| if (!body || !body.seatbid || body.seatbid.length === 0) { | ||
| return []; | ||
| } | ||
| return converter.fromORTB({ | ||
| response: body, | ||
| request: req.data | ||
| }); | ||
| }, | ||
|
|
||
| onTimeout: (data) => { }, | ||
|
|
||
| onBidWon: (bid) => { | ||
| if (bid.nurl) { | ||
| const url = new URL(bid.nurl); | ||
| url.searchParams.set('cpm', bid.cpm); | ||
| fetch(url.toString(), { method: 'GET', keepalive: true }).catch(err => | ||
| logError('Error triggering win notification', err) | ||
| ); | ||
| } | ||
| }, | ||
|
|
||
| onSetTargeting: (bid) => { }, | ||
| }; | ||
|
|
||
| registerBidder(spec); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| # Overview | ||
|
|
||
| ``` | ||
| Module Name: Start.io Bidder Adapter | ||
| Module Type: Bidder Adapter | ||
| Maintainer: prebid@start.io | ||
| ``` | ||
|
|
||
| # Description | ||
|
|
||
| The Start.io Bid Adapter enables publishers to integrate with Start.io's demand sources for banner, video and native ad formats. The adapter supports OpenRTB standards and processes bid requests efficiently using the Prebid.js framework. | ||
|
|
||
| # Test Parameters | ||
| ``` | ||
| var adUnits = [ | ||
| { | ||
| code: 'test-div', | ||
| mediaTypes: { | ||
| banner: { | ||
| sizes: [[300,250], [728,90]] | ||
| } | ||
| }, | ||
| bids: [ | ||
| { | ||
| bidder: 'startio', | ||
| params: { | ||
| // REQUIRED - Publisher Account ID | ||
| accountId: 'your-account-id', | ||
|
|
||
| // OPTIONAL - Enable test ads | ||
| testAdsEnabled: true | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ]; | ||
| ``` | ||
|
|
||
| # Sample Instream Video Ad Unit: For Publishers | ||
| ``` | ||
| var videoAdUnits = [ | ||
| { | ||
| code: 'test-div-video', | ||
| mediaTypes: { | ||
| video: { | ||
| context: 'instream', | ||
| placement: 1, | ||
| playerSize: [640, 360], | ||
| mimes: ['video/mp4'], | ||
| protocols: [2, 3, 5, 6], | ||
| api: [2], | ||
| maxduration: 30, | ||
| linearity: 1, | ||
| playbackmethod: [2] | ||
| } | ||
| }, | ||
| bids: [ | ||
| { | ||
| bidder: 'startio', | ||
| params: { | ||
| accountId: 'your-account-id', | ||
| testAdsEnabled: true | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ]; | ||
| ``` | ||
|
|
||
| # Sample Native Ad Unit: For Publishers | ||
| ``` | ||
| var nativeAdUnits = [ | ||
| { | ||
| code: 'test-div-native', | ||
| mediaTypes: { | ||
| native: { | ||
| title: { required: true, len: 80 }, | ||
| body: { required: true }, | ||
| image: { required: true, sizes: [150, 150] }, | ||
| icon: { required: false, sizes: [50, 50] }, | ||
| sponsoredBy: { required: true } | ||
| } | ||
| }, | ||
| bids: [ | ||
| { | ||
| bidder: 'startio', | ||
| params: { | ||
| accountId: 'your-account-id', | ||
| testAdsEnabled: true | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ]; | ||
| ``` | ||
|
|
||
| # Additional Notes | ||
| - The adapter processes requests via OpenRTB 2.5 standards. | ||
|
patmmccann marked this conversation as resolved.
|
||
| - Ensure that the `accountId` parameter is set correctly for your integration. | ||
| - Test ads can be enabled using `testAdsEnabled: true` during development. | ||
| - The adapter supports multiple ad formats, allowing publishers to serve banners, native ads and instream video ads seamlessly. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this logic not happen in core? Should it be there instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I can see, in core by default we set
banner.formatinfillBannerImpfunction. In our case we need to haveimp.banner.wandimp.banner.hset explicitly, so we need to extend the functionality.