From ddba642d9cb68e86073b6e5667c1ca26ef49520e Mon Sep 17 00:00:00 2001 From: Viktor Dreiling Date: Mon, 17 Apr 2023 16:51:01 +0200 Subject: [PATCH] Add magnite id resolution and eids mapping --- modules/liveIntentIdSystem.js | 4 ++++ modules/userId/eids.js | 9 +++++++++ test/spec/modules/eids_spec.js | 15 +++++++++++++++ test/spec/modules/liveIntentIdSystem_spec.js | 5 +++++ 4 files changed, 33 insertions(+) diff --git a/modules/liveIntentIdSystem.js b/modules/liveIntentIdSystem.js index 3ecd061085c..8b4a9239db1 100644 --- a/modules/liveIntentIdSystem.js +++ b/modules/liveIntentIdSystem.js @@ -196,6 +196,10 @@ export const liveIntentIdSubmodule = { result.medianet = { 'id': value.medianet } } + if (value.magnite) { + result.magnite = { 'id': value.magnite } + } + return result } diff --git a/modules/userId/eids.js b/modules/userId/eids.js index 2f2d1ca7514..4c95068fcd4 100644 --- a/modules/userId/eids.js +++ b/modules/userId/eids.js @@ -164,6 +164,15 @@ export const USER_IDS_CONFIG = { } }, + // magnite + 'magnite': { + source: 'rubiconproject.com', + atype: 3, + getValue: function(data) { + return data.id; + } + }, + // britepoolId 'britepoolid': { source: 'britepool.com', diff --git a/test/spec/modules/eids_spec.js b/test/spec/modules/eids_spec.js index e5e779479cc..c7a5a59780e 100644 --- a/test/spec/modules/eids_spec.js +++ b/test/spec/modules/eids_spec.js @@ -202,6 +202,21 @@ describe('eids array generation for known sub-modules', function() { }); }); + it('magnite', function() { + const userId = { + magnite: {'id': 'sample_id'} + }; + const newEids = createEidsArray(userId); + expect(newEids.length).to.equal(1); + expect(newEids[0]).to.deep.equal({ + source: 'rubiconproject.com', + uids: [{ + id: 'sample_id', + atype: 3 + }] + }); + }); + it('liveIntentId; getValue call and NO ext', function() { const userId = { lipb: { diff --git a/test/spec/modules/liveIntentIdSystem_spec.js b/test/spec/modules/liveIntentIdSystem_spec.js index afbd1566438..98ecabad038 100644 --- a/test/spec/modules/liveIntentIdSystem_spec.js +++ b/test/spec/modules/liveIntentIdSystem_spec.js @@ -323,6 +323,11 @@ describe('LiveIntentId', function() { expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'medianet': 'bar'}, 'medianet': {'id': 'bar'}}); }); + it('should decode a magnite id to a seperate object when present', function() { + const result = liveIntentIdSubmodule.decode({ nonId: 'foo', magnite: 'bar' }); + expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'magnite': 'bar'}, 'magnite': {'id': 'bar'}}); + }); + it('should decode values with uid2 but no nonId', function() { const result = liveIntentIdSubmodule.decode({ uid2: 'bar' }); expect(result).to.eql({'uid2': {'id': 'bar'}});