-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Revnew Bid Adapter: transfer from alias #14212
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
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0cfc649
revnew with own logic
d6915fb
Update modules/revnewBidAdapter.ts
gchicoye c41af2d
Update test/spec/modules/revnewBidAdapter_spec.js
gchicoye 10133cd
Update modules/revnewBidAdapter.ts
gchicoye 4259296
Update test/spec/modules/revnewBidAdapter_spec.js
gchicoye c3eede0
Update test/spec/modules/revnewBidAdapter_spec.js
gchicoye 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
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: Revnew Bid Adapter | ||
| Module Type: Bidder Adapter | ||
| Maintainer: [email protected] | ||
| ``` | ||
|
|
||
| # Description | ||
|
|
||
| Connects to Revnew network for bids. | ||
|
|
||
| To use us as a bidder you must have an account and an active "tagId" or "placement" on our platform. | ||
|
|
||
| # Test Parameters | ||
|
|
||
| ## Web | ||
|
|
||
| ### Display | ||
| ``` | ||
| var adUnits = [ | ||
| // Banner adUnit | ||
| { | ||
| code: 'banner-div', | ||
| mediaTypes: { | ||
| banner: { | ||
| sizes: [[300, 250], [300,600]] | ||
| } | ||
| }, | ||
| bids: [{ | ||
| bidder: 'revnew', | ||
| params: { | ||
| tagId: 'testnexx' | ||
| } | ||
| }] | ||
| }, | ||
| ]; | ||
| ``` | ||
|
|
||
| ### Video Instream | ||
| ``` | ||
| var videoAdUnit = { | ||
| code: 'video1', | ||
| mediaTypes: { | ||
| video: { | ||
| playerSize: [640, 480], | ||
| context: 'instream' | ||
| } | ||
| }, | ||
| bids: [{ | ||
| bidder: 'revnew', | ||
| 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, getAmxId, 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 = 'revnew'; | ||
| const REQUEST_URL = 'https://fast.nexx360.io/revnew'; | ||
| const PAGE_VIEW_ID = generateUUID(); | ||
| const BIDDER_VERSION = '1.0'; | ||
| const GVLID = 1468; | ||
| const REVNEW_KEY = 'revnew_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 RevnewBidParams = RequireAtLeastOne<{ | ||
| tagId?: string; | ||
| placement?: string; | ||
| customId?: string; | ||
| }, "tagId" | "placement">; | ||
|
|
||
| declare module '../src/adUnits' { | ||
| interface BidderParams { | ||
| [BIDDER_CODE]: RevnewBidParams; | ||
| } | ||
| } | ||
|
|
||
| export const STORAGE = getStorageManager({ | ||
| bidderCode: BIDDER_CODE, | ||
| }); | ||
|
|
||
| export const getRevnewLocalStorage = getLocalStorageFunctionGenerator<{ revnewId: string }>( | ||
| STORAGE, | ||
| BIDDER_CODE, | ||
| REVNEW_KEY, | ||
| 'revnewId' | ||
| ); | ||
|
|
||
| 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.revnew', bidRequest.params); | ||
| return imp; | ||
| }, | ||
| request(buildRequest, imps, bidderRequest, context) { | ||
| let request:ORTBRequest = buildRequest(imps, bidderRequest, context); | ||
| const amxId = getAmxId(STORAGE, BIDDER_CODE); | ||
| request = enrichRequest(request, amxId, PAGE_VIEW_ID, BIDDER_VERSION); | ||
| return request; | ||
| }, | ||
| }); | ||
|
|
||
| const isBidRequestValid = (bid:BidRequest<typeof BIDDER_CODE>): boolean => { | ||
| if (!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, | ||
| } | ||
| return adapterRequest; | ||
| }; | ||
|
|
||
| export const spec:BidderSpec<typeof BIDDER_CODE> = { | ||
| code: BIDDER_CODE, | ||
| gvlid: GVLID, | ||
| 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.
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.
why do you not want to be an alias?
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.
Hi @patmmccann , we're implementing specific logic here (imp.ext.revnew for instance), that's why we need to isolate this bidAdapter.