-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Mtc Bid Adapter: initial release #14782
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 7 commits into
prebid:master
from
nexx360:agent-mtc-bid-adapter-initial-release
Apr 27, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3f3c432
Nexx360 Utils Library: add shared getGzipSetting helper
1e69124
Mtc Bid Adapter: initial release
f1f8cfe
Merge branch 'master' into agent-mtc-bid-adapter-initial-release
gchicoye 653dae9
Update mtcBidAdapter.ts
gchicoye b42fb60
Update mtcBidAdapter.md
gchicoye 3e53685
Merge branch 'master' into agent-mtc-bid-adapter-initial-release
gchicoye 100c060
Nexx360 Bid Adapter: make requestCounter assertion order-independent
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,57 @@ | ||
| # Overview | ||
|
|
||
| ``` | ||
| Module Name: Mtc Bid Adapter | ||
| Module Type: Bidder Adapter | ||
| Maintainer: gabriel@nexx360.io | ||
| ``` | ||
|
|
||
| # Description | ||
|
|
||
| Connects to Mtc network for bids. | ||
|
|
||
| To use us as a bidder you must have an account and an active "tagId" or "placement" from us. | ||
|
|
||
| # Test Parameters | ||
|
|
||
| ## Web | ||
|
|
||
| ### Display | ||
| ``` | ||
| var adUnits = [ | ||
| // Banner adUnit | ||
| { | ||
| code: 'banner-div', | ||
| mediaTypes: { | ||
| banner: { | ||
| sizes: [[300, 250], [300,600]] | ||
| } | ||
| }, | ||
| bids: [{ | ||
| bidder: 'mtc', | ||
| params: { | ||
| tagId: 'testnexx' | ||
| } | ||
| }] | ||
| }, | ||
| ]; | ||
| ``` | ||
|
|
||
| ### Video Instream | ||
| ``` | ||
| var videoAdUnit = { | ||
| code: 'video1', | ||
| mediaTypes: { | ||
| video: { | ||
| playerSize: [640, 480], | ||
| context: 'instream' | ||
| } | ||
| }, | ||
| bids: [{ | ||
| bidder: 'mtc', | ||
| params: { | ||
| placement: 'TEST_PLACEMENT' | ||
| } | ||
| }] | ||
| }; | ||
| ``` |
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,97 @@ | ||
| import { deepSetValue, generateUUID, logError } from '../src/utils.js'; | ||
| import { getStorageManager } from '../src/storageManager.js'; | ||
| import { AdapterRequest, BidderSpec, registerBidder } from '../src/adapters/bidderFactory.js'; | ||
| import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js'; | ||
| import { ortbConverter } from '../libraries/ortbConverter/converter.js' | ||
|
|
||
| import { interpretResponse, enrichImp, enrichRequest, getGzipSetting, getLocalStorageFunctionGenerator, getUserSyncs } from '../libraries/nexx360Utils/index.js'; | ||
| import { BidRequest, ClientBidderRequest } from '../src/adapterManager.js'; | ||
| import { ORTBImp, ORTBRequest } from '../src/prebid.public.js'; | ||
|
|
||
| const BIDDER_CODE = 'mtc'; | ||
| const REQUEST_URL = 'https://fast.nexx360.io/mtc'; | ||
| const PAGE_VIEW_ID = generateUUID(); | ||
| const BIDDER_VERSION = '1.0'; | ||
| const MTC_KEY = 'mtc_storage'; | ||
|
|
||
| type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = | ||
| Omit<T, Keys> & { | ||
| [K in Keys]-?: Required<Pick<T, K>> & | ||
| Partial<Pick<T, Exclude<Keys, K>>> | ||
| }[Keys]; | ||
|
|
||
| type MtcBidParams = RequireAtLeastOne<{ | ||
| tagId?: string; | ||
| placement?: string; | ||
| customId?: string; | ||
| }, "tagId" | "placement">; | ||
|
|
||
| declare module '../src/adUnits' { | ||
| interface BidderParams { | ||
| [BIDDER_CODE]: MtcBidParams; | ||
| } | ||
| } | ||
|
|
||
| export const STORAGE = getStorageManager({ | ||
| bidderCode: BIDDER_CODE, | ||
| }); | ||
|
|
||
| export const getMtcLocalStorage = getLocalStorageFunctionGenerator<{ mtcId: string }>( | ||
| STORAGE, | ||
| BIDDER_CODE, | ||
| MTC_KEY, | ||
| 'mtcId' | ||
| ); | ||
|
|
||
| const converter = ortbConverter({ | ||
| context: { | ||
| netRevenue: true, | ||
| ttl: 120, | ||
| }, | ||
| imp(buildImp, bidRequest: BidRequest<typeof BIDDER_CODE>, context) { | ||
| let imp:ORTBImp = buildImp(bidRequest, context); | ||
| imp = enrichImp(imp, bidRequest); | ||
| deepSetValue(imp, 'ext.mtc', bidRequest.params); | ||
| return imp; | ||
| }, | ||
| request(buildRequest, imps, bidderRequest, context) { | ||
| let request:ORTBRequest = buildRequest(imps, bidderRequest, context); | ||
| request = enrichRequest(request, null, PAGE_VIEW_ID, BIDDER_VERSION); | ||
| return request; | ||
| }, | ||
| }); | ||
|
|
||
| const isBidRequestValid = (bid:BidRequest<typeof BIDDER_CODE>): boolean => { | ||
| if (!bid.params || (!bid.params?.tagId && !bid.params?.placement)) { | ||
| logError('bid.params.tagId or bid.params.placement must be defined'); | ||
| return false; | ||
| } | ||
| return true; | ||
| }; | ||
|
|
||
| const buildRequests = ( | ||
| bidRequests: BidRequest<typeof BIDDER_CODE>[], | ||
| bidderRequest: ClientBidderRequest<typeof BIDDER_CODE>, | ||
| ): AdapterRequest => { | ||
| const data:ORTBRequest = converter.toORTB({ bidRequests, bidderRequest }) | ||
| const adapterRequest:AdapterRequest = { | ||
| method: 'POST', | ||
| url: REQUEST_URL, | ||
| data, | ||
| options: { | ||
| endpointCompression: getGzipSetting(BIDDER_CODE, true), | ||
| }, | ||
| } | ||
| return adapterRequest; | ||
| }; | ||
|
|
||
| export const spec:BidderSpec<typeof BIDDER_CODE> = { | ||
| code: BIDDER_CODE, | ||
| supportedMediaTypes: [BANNER, VIDEO, NATIVE], | ||
| isBidRequestValid, | ||
| buildRequests, | ||
| interpretResponse, | ||
| getUserSyncs, | ||
| }; | ||
|
|
||
| registerBidder(spec); | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.