From 79e8a66b312b10924ccbfcf8bd33f63bb5a74894 Mon Sep 17 00:00:00 2001 From: Dan Check Date: Tue, 25 Oct 2022 07:57:32 -0400 Subject: [PATCH] * Allow browser-available segments that have not been activated for a specific bidder to be used for IAB Audience taxonomy. --- modules/permutiveRtdProvider.js | 15 ++++++++++----- test/spec/modules/permutiveRtdProvider_spec.js | 4 +++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/modules/permutiveRtdProvider.js b/modules/permutiveRtdProvider.js index 79c709f9bcc..6deded4a66b 100644 --- a/modules/permutiveRtdProvider.js +++ b/modules/permutiveRtdProvider.js @@ -73,7 +73,7 @@ export function setBidderRtb (bidderOrtb2, customModuleConfig) { acBidders.forEach(function (bidder) { const currConfig = { ortb2: bidderOrtb2[bidder] || {} } - const nextConfig = updateOrtbConfig(currConfig, segmentData.ac, transformationConfigs) // ORTB2 uses the `ac` segment IDs + const nextConfig = updateOrtbConfig(currConfig, segmentData, transformationConfigs) // ORTB2 uses the `ac` segment IDs bidderOrtb2[bidder] = nextConfig.ortb2; }) } @@ -81,22 +81,25 @@ export function setBidderRtb (bidderOrtb2, customModuleConfig) { /** * Updates `user.data` object in existing bidder config with Permutive segments * @param {Object} currConfig - Current bidder config + * @param {Object} segmentData - Permutive segments * @param {Object[]} transformationConfigs - array of objects with `id` and `config` properties, used to determine * the transformations on user data to include the ORTB2 object - * @param {string[]} segmentIDs - Permutive segment IDs * @return {Object} Merged ortb2 object */ -function updateOrtbConfig (currConfig, segmentIDs, transformationConfigs) { +function updateOrtbConfig (currConfig, segmentData, transformationConfigs) { const name = 'permutive.com' const permutiveUserData = { name, - segment: segmentIDs.map(segmentId => ({ id: segmentId })), + segment: segmentData.ac.map(segmentId => ({ id: segmentId })), } const transformedUserData = transformationConfigs .filter(({ id }) => ortb2UserDataTransformations.hasOwnProperty(id)) - .map(({ id, config }) => ortb2UserDataTransformations[id](permutiveUserData, config)) + .map(({ id, config }) => ortb2UserDataTransformations[id]({ + name, + segment: segmentData.transformations.map(segmentId => ({ id: segmentId })), + }, config)) const ortbConfig = mergeDeep({}, currConfig) const currentUserData = deepAccess(ortbConfig, 'ortb2.user.data') || [] @@ -234,6 +237,7 @@ export function isPermutiveOnPage () { */ export function getSegments (maxSegs) { const legacySegs = readSegments('_psegs').map(Number).filter(seg => seg >= 1000000).map(String) + const legacySegsUnfiltered = readSegments('_psegs').map(String) const _ppam = readSegments('_ppam') const _pcrprs = readSegments('_pcrprs') @@ -242,6 +246,7 @@ export function getSegments (maxSegs) { rubicon: readSegments('_prubicons'), appnexus: readSegments('_papns'), gam: readSegments('_pdfps'), + transformations: [..._pcrprs, ..._ppam, ...legacySegsUnfiltered], } for (const bidder in segments) { diff --git a/test/spec/modules/permutiveRtdProvider_spec.js b/test/spec/modules/permutiveRtdProvider_spec.js index 4e59cd35741..a4835934ca7 100644 --- a/test/spec/modules/permutiveRtdProvider_spec.js +++ b/test/spec/modules/permutiveRtdProvider_spec.js @@ -67,6 +67,7 @@ describe('permutiveRtdProvider', function () { config: { segtax: 4, iabIds: { + 1234: '9000007', 1000001: '9000009', 1000002: '9000008' } @@ -86,7 +87,7 @@ describe('permutiveRtdProvider', function () { { name: 'permutive.com', ext: { segtax: 4 }, - segment: [{ id: '9000009' }, { id: '9000008' }] + segment: [{ id: '9000007' }, { id: '9000009' }, { id: '9000008' }] } ]) }) @@ -374,6 +375,7 @@ function transformedTargeting () { appnexus: data._papns, rubicon: data._prubicons, gam: data._pdfps, + transformations: [...data._pcrprs, ...data._ppam, ...data._psegs], } }