Skip to content

Commit

Permalink
1plusX: Do not set keywords for appnexus
Browse files Browse the repository at this point in the history
  • Loading branch information
dgirardi committed Jun 12, 2023
1 parent 4ebb70d commit 710afd1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 43 deletions.
24 changes: 4 additions & 20 deletions modules/1plusXRtdProvider.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { submodule } from '../src/hook.js';
import { config } from '../src/config.js';
import { ajax } from '../src/ajax.js';
import {
logMessage, logError,
deepAccess, mergeDeep,
isNumber, isArray, deepSetValue
} from '../src/utils.js';
import {submodule} from '../src/hook.js';
import {config} from '../src/config.js';
import {ajax} from '../src/ajax.js';
import {deepAccess, deepSetValue, isArray, isNumber, logError, logMessage, mergeDeep} from '../src/utils.js';

// Constants
const REAL_TIME_MODULE = 'realTimeData';
Expand All @@ -14,7 +10,6 @@ const ORTB2_NAME = '1plusX.com'
const PAPI_VERSION = 'v1.0';
const LOG_PREFIX = '[1plusX RTD Module]: ';
const OPE_FPID = 'ope_fpid'
const LEGACY_SITE_KEYWORDS_BIDDERS = ['appnexus'];
export const segtaxes = {
// cf. https://github.com/InteractiveAdvertisingBureau/openrtb/pull/108
AUDIENCE: 526,
Expand Down Expand Up @@ -152,17 +147,6 @@ const getTargetingDataFromPapi = (papiUrl) => {
* @returns {Object} Object describing the updates to make on bidder configs
*/
export const buildOrtb2Updates = ({ segments = [], topics = [] }, bidder) => {
// Currently appnexus bidAdapter doesn't support topics in `site.content.data.segment`
// Therefore, writing them in `site.keywords` until it's supported
// Other bidAdapters do fine with `site.content.data.segment`
const writeToLegacySiteKeywords = LEGACY_SITE_KEYWORDS_BIDDERS.includes(bidder);
if (writeToLegacySiteKeywords) {
const site = {
keywords: topics.join(',')
};
return { site };
}

const userData = {
name: ORTB2_NAME,
segment: segments.map((segmentId) => ({ id: segmentId }))
Expand Down
25 changes: 2 additions & 23 deletions test/spec/modules/1plusXRtdProvider_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,6 @@ describe('1plusXRtdProvider', () => {
}
expect([ortb2Updates]).to.deep.include.members([expectedOutput]);
});
it('fills site.keywords in the ortb2 config (appnexus specific)', () => {
const rtdData = { segments: fakeResponse.s, topics: fakeResponse.t };
const ortb2Updates = buildOrtb2Updates(rtdData, 'appnexus');

const expectedOutput = {
site: {
keywords: rtdData.topics.join(','),
}
}
expect([ortb2Updates]).to.deep.include.members([expectedOutput]);
});

it('defaults to empty array if no segment is given', () => {
const rtdData = { topics: fakeResponse.t };
Expand Down Expand Up @@ -242,17 +231,6 @@ describe('1plusXRtdProvider', () => {
}
expect(ortb2Updates).to.deep.include(expectedOutput);
})
it('defaults to empty string if no topic is given (appnexus specific)', () => {
const rtdData = { segments: fakeResponse.s };
const ortb2Updates = buildOrtb2Updates(rtdData, 'appnexus');

const expectedOutput = {
site: {
keywords: '',
}
}
expect(ortb2Updates).to.deep.include(expectedOutput);
})
})

describe('extractConsent', () => {
Expand Down Expand Up @@ -486,7 +464,8 @@ describe('1plusXRtdProvider', () => {
}
const expectedOrtb2 = {
appnexus: {
site: { keywords: expectedKeywords }
site: { content: expectedSiteContentObj },
user: expectedUserObj,
},
rubicon: {
site: { content: expectedSiteContentObj },
Expand Down

0 comments on commit 710afd1

Please sign in to comment.