Skip to content

Commit

Permalink
Add segtax for site.content.data
Browse files Browse the repository at this point in the history
  • Loading branch information
bwhisp committed Jul 7, 2022
1 parent f57fec2 commit 4c1f1fb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
10 changes: 8 additions & 2 deletions modules/1plusXRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ const ORTB2_NAME = '1plusX.com'
const PAPI_VERSION = 'v1.0';
const LOG_PREFIX = '[1plusX RTD Module]: ';
const LEGACY_SITE_KEYWORDS_BIDDERS = ['appnexus'];
export const segtaxes = {
// cf. https://github.com/InteractiveAdvertisingBureau/openrtb/pull/108
AUDIENCE: 526,
CONTENT: 527,
};
// Functions
/**
* Extracts the parameters for 1plusX RTD module from the config object passed at instanciation
Expand Down Expand Up @@ -115,7 +120,8 @@ export const buildOrtb2Updates = ({ segments = [], topics = [] }, bidder) => {
} else {
const siteContentData = {
name: ORTB2_NAME,
segment: topics.map((topicId) => ({ id: topicId }))
segment: topics.map((topicId) => ({ id: topicId })),
ext: { segtax: segtaxes.CONTENT }
}
return { userData, siteContentData };
}
Expand All @@ -140,7 +146,7 @@ export const updateBidderConfig = (bidder, ortb2Updates, bidderConfigs) => {
}

if (siteContentData) {
const siteDataPath = 'ortb2.site.content.data'
const siteDataPath = 'ortb2.site.content.data';
const currentSiteContentData = deepAccess(bidderConfigCopy, siteDataPath) || [];
const updatedSiteContentData = [
...currentSiteContentData.filter(({ name }) => name != siteContentData.name),
Expand Down
20 changes: 14 additions & 6 deletions test/spec/modules/1plusXRtdProvider_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { config } from 'src/config';
import {
onePlusXSubmodule,
segtaxes,
extractConfig,
buildOrtb2Updates,
updateBidderConfig,
Expand Down Expand Up @@ -56,7 +57,9 @@ describe('1plusXRtdProvider', () => {
user: { data: [] },
site: {
content: {
data: [{ name: '1plusX.com', segment: [{ id: 'initial' }] }]
data: [{
name: '1plusX.com', segment: [{ id: 'initial' }], ext: { segtax: 525 }
}]
}
},
}
Expand Down Expand Up @@ -178,7 +181,8 @@ describe('1plusXRtdProvider', () => {
const expectedOutput = {
siteContentData: {
name: '1plusX.com',
segment: rtdData.topics.map((topicId) => ({ id: topicId }))
segment: rtdData.topics.map((topicId) => ({ id: topicId })),
ext: { segtax: segtaxes.CONTENT }
},
userData: {
name: '1plusX.com',
Expand Down Expand Up @@ -210,7 +214,8 @@ describe('1plusXRtdProvider', () => {
const expectedOutput = {
siteContentData: {
name: '1plusX.com',
segment: rtdData.topics.map((topicId) => ({ id: topicId }))
segment: rtdData.topics.map((topicId) => ({ id: topicId })),
ext: { segtax: segtaxes.CONTENT }
},
userData: {
name: '1plusX.com',
Expand Down Expand Up @@ -242,7 +247,8 @@ describe('1plusXRtdProvider', () => {
const expectedOutput = {
siteContentData: {
name: '1plusX.com',
segment: []
segment: [],
ext: { segtax: segtaxes.CONTENT }
},
userData: {
name: '1plusX.com',
Expand Down Expand Up @@ -281,7 +287,8 @@ describe('1plusXRtdProvider', () => {
const ortb2Updates = {
siteContentData: {
name: '1plusX.com',
segment: fakeResponse.t.map((topicId) => ({ id: topicId }))
segment: fakeResponse.t.map((topicId) => ({ id: topicId })),
ext: { segtax: segtaxes.CONTENT }
},
userData: {
name: '1plusX.com',
Expand Down Expand Up @@ -398,7 +405,8 @@ describe('1plusXRtdProvider', () => {
const expectedSiteContentObj = {
data: [{
name: '1plusX.com',
segment: fakeResponse.t.map((topicId) => ({ id: topicId }))
segment: fakeResponse.t.map((topicId) => ({ id: topicId })),
ext: { segtax: segtaxes.CONTENT }
}]
}
const expectedUserObj = {
Expand Down

0 comments on commit 4c1f1fb

Please sign in to comment.