-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deepintent ID System: add new ID module (#6537)
* initial commit * feat(deepintent-dpes): adds deepintent user id module * chore(code-cleanup): removed console logs * eids config added * fix for passing the eids * docs added with minor change * tests added * remaining conflict resolution * kick off circle-ci tests manually * fix linting error * changed the atype to 3 * tests added for eids_spec.js * Change the language * added cacheIdObject signature * changed test cases * eIds passing added to adapter * docs changed removed params not required * doc added * docs added in userId base * user id tests added * lint fixes * lint fixes * code review comments fix Co-authored-by: Sourabh Gandhe <sourabh@Sourabhs-MacBook-Pro.local> Co-authored-by: ChinmoyDebnath <chinmoy@lightbeam.ai> Co-authored-by: Chris Huie <phoenixtechnerd@gmail.com>
- Loading branch information
1 parent
a3790c2
commit caead3c
Showing
10 changed files
with
302 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* This module adds DPES to the User ID module | ||
* The {@link module:modules/userId} module is required | ||
* @module modules/deepintentDpesSystem | ||
* @requires module:modules/userId | ||
*/ | ||
|
||
import { submodule } from '../src/hook.js'; | ||
import { getStorageManager } from '../src/storageManager.js'; | ||
|
||
const MODULE_NAME = 'deepintentId'; | ||
export const storage = getStorageManager(null, MODULE_NAME); | ||
|
||
/** @type {Submodule} */ | ||
export const deepintentDpesSubmodule = { | ||
/** | ||
* used to link submodule with config | ||
* @type {string} | ||
*/ | ||
name: MODULE_NAME, | ||
/** | ||
* decode the stored id value for passing to bid requests | ||
* @function | ||
* @param {{value:string}} value | ||
* @returns {{deepintentId:Object}} | ||
*/ | ||
decode(value, config) { | ||
return value ? { 'deepintentId': value } : undefined; | ||
}, | ||
|
||
/** | ||
* performs action to obtain id and return a value in the callback's response argument | ||
* @function | ||
* @param {SubmoduleConfig} config | ||
* @param {ConsentData|undefined} consentData | ||
* @param {Object} cacheIdObj - existing id, if any | ||
* @return {{id: string | undefined} | undefined} | ||
*/ | ||
getId(config, consentData, cacheIdObj) { | ||
return cacheIdObj; | ||
} | ||
|
||
}; | ||
|
||
submodule('userId', deepintentDpesSubmodule); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Deepintent DPES ID | ||
|
||
The Deepintent Id is a shared, healthcare identifier which helps publisher in absence of the 3rd Party cookie matching. This lets publishers set and bid with healthcare identity . Deepintent lets users protect their privacy through advertising value chain, where Healthcare identity when setting the identity takes in consideration of users choices, as well as when passing identity on the cookie itself privacy consent strings are checked. The healthcare identity when set is not stored on Deepintent's servers but is stored on users browsers itself. User can still opt out of the ads by https://option.deepintent.com/adchoices. | ||
|
||
## Deepintent DPES ID Registration | ||
|
||
The Deepintent DPES ID is free to use, but requires a simple registration with Deepintent. Please reach to prebid@deepintent.com to get started. | ||
Once publisher registers with deepintents platform for healthcare identity Deepintent provides the Tag code to be placed on the page, this tag code works to capture and store information as per publishers and users agreement. DPES User ID module uses this stored id and passes it on the deepintent prebid adapter. | ||
|
||
|
||
## Deepintent DPES ID Configuration | ||
|
||
First, make sure to add the Deepintent submodule to your Prebid.js package with: | ||
|
||
``` | ||
gulp build --modules=deepintentDpesIdSystem,userId | ||
``` | ||
|
||
The following configuration parameters are available: | ||
|
||
```javascript | ||
pbjs.setConfig({ | ||
userSync: { | ||
userIds: [{ | ||
name: 'deepintentId', | ||
storage: { | ||
type: 'cookie', | ||
name: '_dpes_id', | ||
expires: 90 // storage lasts for 90 days, optional if storage type is html5 | ||
} | ||
}], | ||
auctionDelay: 50 // 50ms maximum auction delay, applies to all userId modules | ||
} | ||
}); | ||
``` | ||
|
||
| Param under userSync.userIds[] | Scope | Type | Description | Example | | ||
| --- | --- | --- | --- | --- | | ||
| name | Required | String | The name of this module: `"deepintentId"` | `"deepintentId"` | | ||
| storage | Required | Object | Storage settings for how the User Id module will cache the Deepintent ID locally | | | ||
| storage.type | Required | String | This is where the results of the user ID will be stored. Deepintent`"html5"` or `"cookie"`. | `"html5"` | | ||
| storage.name | Required | String | The name of the local storage where the user ID will be stored. | `"_dpes_id"` | | ||
| storage.expires | Optional | Integer | How long (in days) the user ID information will be stored. Deepintent recommends `90`. | `90` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { expect } from 'chai'; | ||
import find from 'core-js-pure/features/array/find.js'; | ||
import { storage, deepintentDpesSubmodule } from 'modules/deepintentDpesIdSystem.js'; | ||
import { init, requestBidsHook, setSubmoduleRegistry } from 'modules/userId/index.js'; | ||
import { config } from 'src/config.js'; | ||
|
||
const DI_COOKIE_NAME = '_dpes_id'; | ||
const DI_COOKIE_STORED = '{"id":"2cf40748c4f7f60d343336e08f80dc99"}'; | ||
const DI_COOKIE_OBJECT = {id: '2cf40748c4f7f60d343336e08f80dc99'}; | ||
|
||
const cookieConfig = { | ||
name: 'deepintentId', | ||
storage: { | ||
type: 'cookie', | ||
name: '_dpes_id', | ||
expires: 28 | ||
} | ||
}; | ||
|
||
const html5Config = { | ||
name: 'deepintentId', | ||
storage: { | ||
type: 'html5', | ||
name: '_dpes_id', | ||
expires: 28 | ||
} | ||
} | ||
|
||
describe('Deepintent DPES System', () => { | ||
let getDataFromLocalStorageStub, localStorageIsEnabledStub; | ||
let getCookieStub, cookiesAreEnabledStub; | ||
|
||
beforeEach(() => { | ||
getDataFromLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage'); | ||
localStorageIsEnabledStub = sinon.stub(storage, 'localStorageIsEnabled'); | ||
getCookieStub = sinon.stub(storage, 'getCookie'); | ||
cookiesAreEnabledStub = sinon.stub(storage, 'cookiesAreEnabled'); | ||
}); | ||
|
||
afterEach(() => { | ||
getDataFromLocalStorageStub.restore(); | ||
localStorageIsEnabledStub.restore(); | ||
getCookieStub.restore(); | ||
cookiesAreEnabledStub.restore(); | ||
}); | ||
|
||
describe('Deepintent Dpes Sytsem: test "getId" method', () => { | ||
it('Wrong config should fail the tests', () => { | ||
// no config | ||
expect(deepintentDpesSubmodule.getId()).to.be.eq(undefined); | ||
expect(deepintentDpesSubmodule.getId({ })).to.be.eq(undefined); | ||
|
||
expect(deepintentDpesSubmodule.getId({params: {}, storage: {}})).to.be.eq(undefined); | ||
expect(deepintentDpesSubmodule.getId({params: {}, storage: {type: 'cookie'}})).to.be.eq(undefined); | ||
expect(deepintentDpesSubmodule.getId({params: {}, storage: {name: '_dpes_id'}})).to.be.eq(undefined); | ||
}); | ||
|
||
it('Get value stored in cookie for getId', () => { | ||
getCookieStub.withArgs(DI_COOKIE_NAME).returns(DI_COOKIE_STORED); | ||
let diId = deepintentDpesSubmodule.getId(cookieConfig, undefined, DI_COOKIE_OBJECT); | ||
expect(diId).to.deep.equal(DI_COOKIE_OBJECT); | ||
}); | ||
|
||
it('provides the stored deepintentId if cookie is absent but present in local storage', () => { | ||
getDataFromLocalStorageStub.withArgs(DI_COOKIE_NAME).returns(DI_COOKIE_STORED); | ||
let idx = deepintentDpesSubmodule.getId(html5Config, undefined, DI_COOKIE_OBJECT); | ||
expect(idx).to.deep.equal(DI_COOKIE_OBJECT); | ||
}); | ||
}); | ||
|
||
describe('Deepintent Dpes System : test "decode" method', () => { | ||
it('Get the correct decoded value for dpes id', () => { | ||
expect(deepintentDpesSubmodule.decode(DI_COOKIE_OBJECT, cookieConfig)).to.deep.equal({'deepintentId': {'id': '2cf40748c4f7f60d343336e08f80dc99'}}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.