-
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
Rubicon Bid Adapter: Pass on carbon segtaxes #10985
Merged
Merged
Changes from 7 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4676ba2
Pass through Carbon segments
spotxslagle 0b282fe
Fix rubiconBidAdapter for unit tests
spotxslagle 8206da4
segtax spec
spotxslagle f92e8e6
Fix access issues
spotxslagle 23761e3
Remove dup ortb2 work
spotxslagle 36ddddf
Adjust unit tests
spotxslagle 87a2175
Fix lint issues
spotxslagle 02a9591
Add all desired segtaxes
spotxslagle 905df99
Fix unit tests
spotxslagle 41e5e27
Fix linting
spotxslagle c8e5a26
Don't concat undefined
spotxslagle 9916193
Unit test pub added segtaxes
spotxslagle 8e2d0d3
Pull site data from site.content.data
spotxslagle be28180
Update unit tests
spotxslagle 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 |
---|---|---|
|
@@ -528,6 +528,13 @@ export const spec = { | |
if (bidRequest?.ortb2Imp?.ext?.ae) { | ||
data['o_ae'] = 1; | ||
} | ||
|
||
const topics = getCarbonTopics(bidderRequest); | ||
if (topics) { | ||
Object.keys(topics).forEach(field => { | ||
data[field] = topics[field]; | ||
}); | ||
} | ||
// loop through userIds and add to request | ||
if (bidRequest.userIdAsEids) { | ||
bidRequest.userIdAsEids.forEach(eid => { | ||
|
@@ -1001,6 +1008,23 @@ function applyFPD(bidRequest, mediaType, data) { | |
} | ||
} | ||
|
||
function getCarbonTopics(bidderRequest) { | ||
if (rubiConf.readTopics === false) { | ||
return undefined; | ||
} | ||
let fields = {}; | ||
let userData = bidderRequest.ortb2?.user?.data || []; | ||
userData.forEach(topic => { | ||
const taxonomy = topic.ext?.segtax; | ||
if (taxonomy == 507 || taxonomy == 508) { | ||
const domain = bidderRequest.refererInfo.domain; | ||
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 should be const domain = topic.name || bidderRequest.refererInfo.domain; |
||
fields[`s_segs_${taxonomy}_${domain}`] = topic.segment?.map(seg => seg.id).join(',') | ||
} | ||
}) | ||
let hasProps = Object.keys(fields).length > 0; | ||
return hasProps ? fields : undefined; | ||
} | ||
|
||
/** | ||
* @param sizes | ||
* @returns {*} | ||
|
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
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.
Not really a huge performance increase but no need to have two loops when we can just add those keys to the data object during the initial getCarbonTopics loop.
And maybe we can generalize it to not say carbon and just "Get wanted segtax" or topics or whatever. And it just takes in list of taxonomy numbers?
So if we need to add another one we just update the list or something. - guess you can just update the if statement also so no worries.