-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Submitting EMX Digital Adapter #3173
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
876de32
Submitting EMX Digital Prebid Adapter
EMXDigital 1156463
Merge pull request #1 from EMXDigital/EMXDigital-patch-1
EMXDigital 78caa11
fixing lint errors. updating our md
EMXDigital cd767e3
updating to const/let variables. adding test spec.
EMXDigital bf262ed
fixed linting on test spec js
EMXDigital f97d94c
Merge branch 'master' of https://github.com/prebid/Prebid.js
EMXDigital 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 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 * as utils from 'src/utils'; | ||
import { | ||
registerBidder | ||
} from 'src/adapters/bidderFactory'; | ||
import { | ||
BANNER | ||
} from 'src/mediaTypes'; | ||
import { | ||
config | ||
} from 'src/config'; | ||
|
||
const BIDDER_CODE = 'emx_digital'; | ||
const ENDPOINT = 'hb.emxdgt.com'; | ||
export const spec = { | ||
code: BIDDER_CODE, | ||
supportedMediaTypes: [BANNER], | ||
isBidRequestValid: function (bid) { | ||
return !!(bid.params.tagid); | ||
}, | ||
buildRequests: function (validBidRequests, bidRequests) { | ||
const {host, href, protocol} = utils.getTopWindowLocation(); | ||
var emxData = {}; | ||
var emxImps = []; | ||
var auctionId = bidRequests.auctionId; | ||
var timeout = config.getConfig('bidderTimeout'); | ||
var timestamp = Date.now(); | ||
var url = location.protocol + '//' + ENDPOINT + ('?t=' + timeout + '&ts=' + timestamp); | ||
|
||
utils._each(validBidRequests, function (bid) { | ||
let tagId = String(utils.getBidIdParameter('tagid', bid.params)); | ||
let bidFloor = utils.getBidIdParameter('bidfloor', bid.params) || 0; | ||
let emxBid = { | ||
id: bid.bidId, | ||
tid: bid.transactionId, | ||
tagid: tagId, | ||
secure: protocol === 'https:' ? 1 : 0, | ||
banner: { | ||
format: bid.sizes.map(function (size) { | ||
return { | ||
w: size[0], | ||
h: size[1] | ||
}; | ||
}), | ||
w: bid.sizes[0][0], | ||
h: bid.sizes[0][1] | ||
} | ||
} | ||
if (bidFloor > 0) { | ||
emxBid.bidfloor = bidFloor | ||
} | ||
emxImps.push(emxBid); | ||
}); | ||
emxData = { | ||
id: auctionId, | ||
imp: emxImps, | ||
site: { | ||
domain: host, | ||
page: href | ||
} | ||
}; | ||
if (bidRequests.gdprConsent) { | ||
emxData.regs = { | ||
ext: { | ||
gdpr: bidRequests.gdprConsent.gdprApplies === true ? 1 : 0 | ||
} | ||
}; | ||
emxData.user = { | ||
ext: { | ||
consent: bidRequests.gdprConsent.consentString | ||
} | ||
}; | ||
} | ||
return { | ||
method: 'POST', | ||
url: url, | ||
data: JSON.stringify(emxData), | ||
options: { | ||
withCredentials: true | ||
} | ||
}; | ||
}, | ||
interpretResponse: function (serverResponse) { | ||
var emxBidResponses = []; | ||
var response = serverResponse.body || {}; | ||
if (response.seatbid && response.seatbid.length > 0 && response.seatbid[0].bid) { | ||
response.seatbid.forEach(function (emxBid) { | ||
emxBid = emxBid.bid[0]; | ||
emxBidResponses.push({ | ||
requestId: emxBid.id, | ||
cpm: emxBid.price, | ||
width: emxBid.w, | ||
height: emxBid.h, | ||
creativeId: emxBid.crid || emxBid.id, | ||
dealId: emxBid.dealid || null, | ||
currency: 'USD', | ||
netRevenue: true, | ||
mediaType: BANNER, | ||
ad: decodeURIComponent(emxBid.adm), | ||
ttl: emxBid.ttl | ||
}); | ||
}); | ||
} | ||
return emxBidResponses; | ||
}, | ||
getUserSyncs: function (syncOptions) { | ||
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. This method is optional. You can remove since you are not using |
||
} | ||
}; | ||
registerBidder(spec); |
This file contains 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,38 @@ | ||
# Overview | ||
|
||
``` | ||
Module Name: EMX Digital Adapter | ||
Module Type: Bidder Adapter | ||
Maintainer: git@emxdigital.com | ||
``` | ||
|
||
# Description | ||
|
||
The EMX Digital adapter provides publishers with access to the EMX Marketplace. The adapter is GDPR compliant. Please note that the adapter supports Banner media type only. | ||
|
||
Note: The EMX Digital adapter requires approval and implementation guidelines from the EMX team, including existing publishers that work with EMX Digital. Please reach out to your account manager or prebid@emxdigital.com for more information. | ||
|
||
The bidder code should be ```emx_digital``` | ||
The params used by the bidder are : | ||
```tagid``` - string (mandatory) | ||
```bidfloor``` - string (optional) | ||
|
||
# Test Parameters | ||
``` | ||
var adUnits = [{ | ||
code: 'banner-div', | ||
mediaTypes: { | ||
banner: { | ||
sizes: [ | ||
[300, 250], [300, 600] | ||
} | ||
}, | ||
bids: [ | ||
{ | ||
bidder: 'emx_digital', | ||
params: { | ||
tagid: '25251', | ||
} | ||
}] | ||
}]; | ||
``` |
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.
Use let/const everywhere.