From 2e55667eacef4ccf07d9d8ec087ab740b13b1ffc Mon Sep 17 00:00:00 2001 From: Hugo Penha Date: Tue, 29 Jun 2021 10:59:47 -0300 Subject: [PATCH] navegg userid --- modules/.submodules.json | 5 +-- modules/naveggId.js | 83 ++++++++++++++++++++++++++++++++++++++++ modules/naveggId.md | 22 +++++++++++ modules/userId/eids.js | 11 +++--- modules/userId/eids.md | 15 ++++---- 5 files changed, 121 insertions(+), 15 deletions(-) create mode 100644 modules/naveggId.js create mode 100644 modules/naveggId.md diff --git a/modules/.submodules.json b/modules/.submodules.json index 555e8adaefa..b67abed844b 100644 --- a/modules/.submodules.json +++ b/modules/.submodules.json @@ -28,9 +28,9 @@ "uid2IdSystem", "admixerIdSystem", "dmdIdSystem", - "akamaiDAPId", "flocIdSystem", - "amxIdSystem" + "amxIdSystem", + "naveggId" ], "adpod": [ "freeWheelAdserverVideo", @@ -43,7 +43,6 @@ "haloRtdProvider", "iasRtdProvider", "jwplayerRtdProvider", - "medianetRtdProvider", "optimeraRtdProvider", "permutiveRtdProvider", "reconciliationRtdProvider", diff --git a/modules/naveggId.js b/modules/naveggId.js new file mode 100644 index 00000000000..66ec18dedd8 --- /dev/null +++ b/modules/naveggId.js @@ -0,0 +1,83 @@ +/** + * This module adds naveggId to the User ID module + * The {@link module:modules/userId} module is required + * @module modules/naveggId + * @requires module:modules/userId + */ +import * as utils from '../src/utils.js' +import { submodule } from '../src/hook.js'; +import { getStorageManager } from '../src/storageManager.js'; + +const MODULE_NAME = 'naveggId'; +export const storage = getStorageManager(); + +function readnaveggIdFromLocalStorage() { + return storage.localStorageIsEnabled ? storage.getDataFromLocalStorage('nvggid') : null; +} + +function readnaveggIDFromCookie() { + return storage.cookiesAreEnabled ? storage.getCookie('nvggid') : null; +} + +function readoldnaveggIDFromCookie() { + return storage.cookiesAreEnabled ? storage.getCookie('nid') : null; +} + +function readnvgIDFromCookie() { + return storage.cookiesAreEnabled ? storage.findSimilarCookies('nvg')[0] : null; +} + +function readnavIDFromCookie() { + return storage.cookiesAreEnabled ? storage.findSimilarCookies('nav')[0] : null; +} + +function readnvgnavFromLocalStorage() { + var i, results = []; + const query = '^nvg|^nav'; + for (i in window.localStorage) { + if (i.match(query) || (!query && typeof i === 'string')) { + return storage.localStorageIsEnabled ? storage.getDataFromLocalStorage(i.match(query).input) : null; + } + } +} + +/** @type {Submodule} */ +export const naveggIdSubmodule = { + /** + * used to link submodule with config + * @type {string} + */ + name: MODULE_NAME, + /** + * decode the stored id value for passing to bid requests + * @function + * @param { Object | string | undefined } value + * @return { Object | string | undefined } + */ + decode(value) { + const naveggIdVal = value ? utils.isStr(value) ? value : utils.isPlainObject(value) ? value.id : undefined : undefined; + return naveggIdVal ? { + 'naveggId': naveggIdVal + } : undefined; + }, + /** + * performs action to obtain id and return a value in the callback's response argument + * @function + * @param {SubmoduleConfig} config + * @return {{id: string | undefined } | undefined} + */ + getId() { + const naveggIdString = readnaveggIdFromLocalStorage() || readnaveggIDFromCookie() || readoldnaveggIDFromCookie() || readnvgIDFromCookie() || readnavIDFromCookie() || readnvgnavFromLocalStorage(); + + if (typeof naveggIdString == 'string' && naveggIdString) { + try { + return { id: naveggIdString }; + // return { id: naveggIdString ? { naveggId: naveggIdString } : undefined } + } catch (error) { + utils.logError(error); + } + } + return undefined; + } +}; +submodule('userId', naveggIdSubmodule); diff --git a/modules/naveggId.md b/modules/naveggId.md new file mode 100644 index 00000000000..f758fbc9d5d --- /dev/null +++ b/modules/naveggId.md @@ -0,0 +1,22 @@ +## Navegg User ID Submodule + +For assistance setting up your module please contact us at [prebid@navegg.com](prebid@navegg.com). + +### Prebid Params + +Individual params may be set for the IDx Submodule. +``` +pbjs.setConfig({ + userSync: { + userIds: [{ + name: 'naveggId', + }] + } +}); +``` +## Parameter Descriptions for the `userSync` Configuration Section +The below parameters apply only to the naveggID integration. + +| Param under usersync.userIds[] | Scope | Type | Description | Example | +| --- | --- | --- | --- | --- | +| name | Required | String | ID of the module - `"naveggId"` | `"naveggId"` | diff --git a/modules/userId/eids.js b/modules/userId/eids.js index 32f7c163f3c..ad232b3e17d 100644 --- a/modules/userId/eids.js +++ b/modules/userId/eids.js @@ -11,6 +11,12 @@ const USER_IDS_CONFIG = { atype: 1 }, + // naveggId + 'naveggId': { + source: 'navegg.com', + atype: 1 + }, + // pubCommonId 'pubcid': { source: 'pubcid.org', @@ -203,11 +209,6 @@ const USER_IDS_CONFIG = { source: 'deepintent.com', atype: 3 }, - // Akamai Data Activation Platform (DAP) - 'dapId': { - source: 'akamai.com', - atype: 1 - }, // Admixer Id 'admixerId': { source: 'admixer.net', diff --git a/modules/userId/eids.md b/modules/userId/eids.md index 279a5a0cb49..4fe3a6ca453 100644 --- a/modules/userId/eids.md +++ b/modules/userId/eids.md @@ -21,6 +21,14 @@ userIdAsEids = [ }] }, + { + source: 'navegg.com', + uids: [{ + id: 'naveggId', + atype: 1 + }] + }, + { source: 'neustar.biz', uids: [{ @@ -182,13 +190,6 @@ userIdAsEids = [ atype: 3 }] }, - { - source: 'akamai.com', - uids: [{ - id: 'some-random-id-value', - atype: 1 - }] - }, { source: 'deepintent.com', uids: [{