-
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
adnuntias Bid Adapter: Added GDPR support and segment passing #6796
Changes from 3 commits
c780e00
ea14b3a
998caa8
a788d37
b7910c6
24c4230
21a1cb1
ee72517
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 |
---|---|---|
@@ -1,38 +1,50 @@ | ||
import { registerBidder } from '../src/adapters/bidderFactory.js'; | ||
import { BANNER } from '../src/mediaTypes.js'; | ||
import * as utils from '../src/utils.js'; | ||
import { config } from '../src/config.js'; | ||
|
||
const BIDDER_CODE = 'adnuntius'; | ||
const ENDPOINT_URL = 'https://delivery.adnuntius.com/i?tzo='; | ||
const GVLID = 855; | ||
|
||
export const spec = { | ||
code: BIDDER_CODE, | ||
|
||
gvlid: GVLID, | ||
supportedMediaTypes: [BANNER], | ||
isBidRequestValid: function (bid) { | ||
return !!(bid.bidId || (bid.params.member && bid.params.invCode)); | ||
}, | ||
|
||
buildRequests: function (validBidRequests) { | ||
buildRequests: function (validBidRequests, bidderRequest) { | ||
const networks = {}; | ||
const bidRequests = {}; | ||
const requests = []; | ||
const segments = config.getConfig('segments'); | ||
utils.logMessage('CONF', segments) | ||
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. I think this line should be removed entirely, as this does not seem like a necessary log to me. I believe that we would rather not inflate code with messaging that is not pertinent as this is neither a user warning/error or really clear in label as to what is being logged - also this can be achieved in the console via a pbjs.getConfig('segments'). 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. yeah, that was just a blunder from me, will remove that. |
||
const tzo = new Date().getTimezoneOffset(); | ||
|
||
const gdprApplies = utils.deepAccess(bidderRequest, 'gdprConsent.gdprApplies'); | ||
const consentString = utils.deepAccess(bidderRequest, 'gdprConsent.consentString'); | ||
const reqConsent = (gdprApplies !== undefined) ? '&consentString=' + consentString : ''; | ||
const reqSegments = (segments !== undefined && utils.isArray(segments) && segments.length > 0) ? '&segments=' + segments.join(',') : ''; | ||
for (var i = 0; i < validBidRequests.length; i++) { | ||
const bid = validBidRequests[i] | ||
const network = bid.params.network || 'network'; | ||
const targeting = bid.params.targeting || {}; | ||
|
||
bidRequests[network] = bidRequests[network] || []; | ||
bidRequests[network].push(bid); | ||
|
||
networks[network] = networks[network] || {}; | ||
networks[network].adUnits = networks[network].adUnits || []; | ||
networks[network].adUnits.push({ ...bid.params.targeting, auId: bid.params.auId, targetId: bid.bidId }); | ||
networks[network].adUnits.push({ ...targeting, auId: bid.params.auId, targetId: bid.bidId }); | ||
} | ||
|
||
const networkKeys = Object.keys(networks) | ||
for (var j = 0; j < networkKeys.length; j++) { | ||
const network = networkKeys[j]; | ||
requests.push({ | ||
method: 'POST', | ||
url: ENDPOINT_URL + tzo + '&format=json', | ||
url: ENDPOINT_URL + tzo + '&format=json' + reqSegments + reqConsent, | ||
data: JSON.stringify(networks[network]), | ||
bid: bidRequests[network] | ||
}); | ||
|
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 is not so much of a change request, but more curious about this config setting. I am not aware of segments being set under the config at the top level, so I am curious if this is something specific to your adapter and if so, should it be in your docs? I also want to make sure that this is not meant to be first party segment data that is defined to be passed via ortb2.user.data and ortb2.site.content.data respectively
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.
I was strugling to find where to put it, and yes it's just meant to be for our adapter only, but if ortb2.user.data is the place to put it I will go for it. Should I also prefix our segments (like
adn-segments
) or are there any other rules for how to structure it?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.
I can offer suggestions, but Im not sure where you mean to put the prefix. Maybe reviewing this will offer a better understanding of first party segment data: https://docs.prebid.org/features/firstPartyData.html. You can see under ortb2.user.data, this is an array of objects that "should" include at the very least name and segment (with segment as an array of objects), as well as ext property that can contain other data. Let me know if this helps in any way. Also, the pubs will have the option to utilize setBidderConfig to set config data meant only for specific adapters, meaning that only your adapter will receive those values if set using your bidder.
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 should now be solved and the documentation is filed under this pull request:
prebid/prebid.github.io#2975