-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Update adapter: Selectmedia #14867
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
base: master
Are you sure you want to change the base?
Update adapter: Selectmedia #14867
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| \# Overview | ||
|
|
||
| ``` | ||
| Module Name: Selectmedia Bidder Adapter | ||
| Module Type: Selectmedia Bidder Adapter | ||
| Maintainer: prebid@selectmedia.asia | ||
| ``` | ||
|
|
||
| # Description | ||
|
|
||
| Connects to Selectmedia exchange for bids. | ||
| Selectmedia bid adapter supports Banner, Video (instream and outstream) and Native. | ||
|
|
||
| # Test Parameters | ||
| ``` | ||
| var adUnits = [ | ||
| // Will return static test banner | ||
| { | ||
| code: 'adunit1', | ||
| mediaTypes: { | ||
| banner: { | ||
| sizes: [ [300, 250], [320, 50] ], | ||
| } | ||
| }, | ||
| bids: [ | ||
| { | ||
| bidder: 'selectmedia', | ||
| params: { | ||
| placementId: 'testBanner', | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| code: 'addunit2', | ||
| mediaTypes: { | ||
| video: { | ||
| playerSize: [ [640, 480] ], | ||
| context: 'instream', | ||
| minduration: 5, | ||
| maxduration: 60, | ||
| } | ||
| }, | ||
| bids: [ | ||
| { | ||
| bidder: 'selectmedia', | ||
| params: { | ||
| placementId: 'testVideo', | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| code: 'addunit3', | ||
| mediaTypes: { | ||
| native: { | ||
| title: { | ||
| required: true | ||
| }, | ||
| body: { | ||
| required: true | ||
| }, | ||
| icon: { | ||
| required: true, | ||
| size: [64, 64] | ||
| } | ||
| } | ||
| }, | ||
| bids: [ | ||
| { | ||
| bidder: 'selectmedia', | ||
| params: { | ||
| placementId: 'testNative', | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ]; | ||
| ``` |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,56 @@ | ||||||||
| import { AdapterRequest, BidderSpec, registerBidder } from '../src/adapters/bidderFactory.js'; | ||||||||
| import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js'; | ||||||||
| import { | ||||||||
| interpretResponse, | ||||||||
| isBidRequestValid, | ||||||||
| getUserSyncs, | ||||||||
| buildRequestsBase, | ||||||||
| type TeqBlazeBidParams, | ||||||||
| } from '../libraries/teqblazeUtils/bidderUtils.ts'; | ||||||||
| import type { BidRequest, BaseBidderRequest } from '../src/adapterManager.ts'; | ||||||||
|
|
||||||||
| const BIDDER_CODE = 'selectmedia'; | ||||||||
| const AD_URL = 'https://#{REGION}#.zxyvrtd.com/pbjs'; | ||||||||
| const GVLID = 775; | ||||||||
| const SYNC_URL = 'https://sync.zxyvrtd.com'; | ||||||||
|
|
||||||||
| type Region = 'eu' | 'us-east'; | ||||||||
| type SelectmediaBidParams = TeqBlazeBidParams & { region: Region }; | ||||||||
|
|
||||||||
| const VALID_REGIONS = new Set<string>(['eu', 'us-east'] satisfies Region[]); | ||||||||
|
|
||||||||
| declare module '../src/adUnits' { | ||||||||
| interface BidderParams { | ||||||||
| [BIDDER_CODE]: SelectmediaBidParams; | ||||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
| const regionMap: Record<string, string> = { | ||||||||
| eu: 'eu', | ||||||||
| 'us-east': 'us-east' | ||||||||
| }; | ||||||||
|
|
||||||||
| const baseIsBidRequestValid = isBidRequestValid(); | ||||||||
|
|
||||||||
| const buildRequests = ( | ||||||||
| validBidRequests: BidRequest<typeof BIDDER_CODE>[], | ||||||||
| bidderRequest: BaseBidderRequest<typeof BIDDER_CODE> | ||||||||
| ): AdapterRequest => { | ||||||||
| const region = validBidRequests[0]?.params?.region; | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not base this on the user timezone instead of the config? |
||||||||
| const adUrl = AD_URL.replace('#{REGION}#', region != null ? (regionMap[region] ?? region) : ''); | ||||||||
|
patmmccann marked this conversation as resolved.
|
||||||||
|
|
||||||||
| return buildRequestsBase({ adUrl, validBidRequests, bidderRequest }); | ||||||||
| }; | ||||||||
|
|
||||||||
| export const spec: BidderSpec<typeof BIDDER_CODE> = { | ||||||||
| code: BIDDER_CODE, | ||||||||
| gvlid: GVLID, | ||||||||
| supportedMediaTypes: [BANNER, VIDEO, NATIVE], | ||||||||
|
|
||||||||
| isBidRequestValid: (bid) => baseIsBidRequestValid(bid) && VALID_REGIONS.has(bid.params?.region), | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is region required? your md file never mentions it. also if you need the pub to fill it in perhaps tell them how to do so based on Intl.DateTimeFormat().resolvedOptions().timeZone or preferably, import
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or this one from escalax Prebid.js/modules/escalaxBidAdapter.js Line 41 in f5638f2
|
||||||||
| buildRequests, | ||||||||
| interpretResponse, | ||||||||
| getUserSyncs: getUserSyncs(SYNC_URL) | ||||||||
| }; | ||||||||
|
|
||||||||
| registerBidder(spec); | ||||||||
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.
this appears to be the gvlid of a different company