Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

applying the changes #5

Merged
merged 4 commits into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/.submodules.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"idxIdSystem",
"fabrickIdSystem",
"verizonMediaIdSystem",
"pubProvidedIdSystem"
"pubProvidedIdSystem",
"mwOpenLinkIdSystem"
],
"adpod": [
"freeWheelAdserverVideo",
Expand Down
13 changes: 5 additions & 8 deletions modules/mwOpenLinkIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function setID(configParams) {
export { writeCookie };

/** @type {Submodule} */
export const mwOpenLinkSubModule = {
export const mwOpenLinkIdSubModule = {
/**
* used to link submodule with config
* @type {string}
Expand All @@ -127,10 +127,8 @@ export const mwOpenLinkSubModule = {
* @return {(Object|undefined}
*/
decode(mwOlId) {
if (mwOlId && utils.isPlainObject(mwOlId)) {
return { mwOlId };
}
return undefined;
const id = value ? utils.isStr(value) ? value : utils.isPlainObject(value) ? value.id : undefined : undefined;
return id ? { 'mwOpenLinkId': id } : undefined;
},

/**
Expand All @@ -142,9 +140,8 @@ export const mwOpenLinkSubModule = {
getId(submoduleConfig) {
const submoduleConfigParams = (submoduleConfig && submoduleConfig.params) || {};
if (!isValidConfig(submoduleConfigParams)) return undefined;
const newId = setID(submoduleConfigParams);
return newId;
return setID(submoduleConfigParams);
}
};

submodule('userId', mwOpenLinkSubModule);
submodule('userId', mwOpenLinkIdSubModule);
13 changes: 7 additions & 6 deletions modules/mwOpenLinkIdSystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ex: $ gulp build --modules=userId,mwOpenLinkIdSystem

##$ MediaWallah openLink ID Example Configuration

When the module is included, it's automatically enabled and saves an id to both cookie and local storage with an expiration time of 1 year.
When the module is included, it's automatically enabled and saves an id to both cookie with an expiration time of 1 year.

### Prebid Params

Expand All @@ -21,9 +21,9 @@ pbjs.setConfig({
userIds: [{
name: 'mwOpenLinkId',
params: {
accountId: 0000,
partnerId: 0000,
uid: '12345xyz'
accountId: '1000',
partnerId: '1001',
uid: 'u-123xyz'
}
}]
}
Expand All @@ -34,7 +34,8 @@ The below parameters apply only to the MediaWallah OpenLink ID User ID Module in

| Params under usersync.userIds[]| Scope | Type | Description | Example |
| --- | --- | --- | --- | --- |
| name | Required | String | The name of this module. | `'mwOpenLinkId'` |
| params | Required | Object | Details for mwOLID syncing. | |
| params.accountId | Required | String | The MediaWallah assigned Account Id | `1000` |
| params.partnerId | Required | String | The MediaWallah assign partner Id | `1001` |
| params.uid | Optional | String | Your unique Id for the user or browser. Used for matching| `u-123xyz` |
| params.partnerId | Required | String | The MediaWallah assign Partner Id | `1001` |
| params.uid | Optional | String | Your unique Id for the user or browser. Used for matching | `u-123xyz` |
6 changes: 6 additions & 0 deletions modules/userId/eids.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ const USER_IDS_CONFIG = {
'fabrickId': {
source: 'neustar.biz',
atype: 1
},

// MediaWallah OpenLink
'mwOpenLinkId': {
source: 'mediawallahscript.com',
atype: 1
}
};

Expand Down
8 changes: 8 additions & 0 deletions modules/userId/eids.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ userIdAsEids = [
id: 'some-random-id-value',
atype: 1
}]
},

{
source: 'mediawallahscript.com',
uids: [{
id: 'some-random-id-value',
atype: 1
}]
}
]
```
7 changes: 7 additions & 0 deletions modules/userId/userId.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ pbjs.setConfig({
name: '_criteoId',
expires: 1
}
}, {
name: 'mwOpenLinkId',
params: {
accountId: 0000,
partnerId: 0000,
uid: '12345xyz'
}
}],
syncDelay: 5000,
auctionDelay: 1000
Expand Down
6 changes: 3 additions & 3 deletions test/spec/modules/mwOpenLinkIdSystem_spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { writeCookie, mwOpenLinkSubModule } from 'modules/mwOpenLinkIdSystem.js';
import { writeCookie, mwOpenLinkIdSubModule } from 'modules/mwOpenLinkIdSystem.js';

const P_CONFIG_MOCK = {
params: {
Expand All @@ -14,12 +14,12 @@ describe('mwOpenLinkId module', function () {

it('getId() should return a MediaWallah openLink Id when the MediaWallah openLink first party cookie exists', function () {
writeCookie({eid: 'XX-YY-ZZ-123'});
const id = mwOpenLinkSubModule.getId(P_CONFIG_MOCK);
const id = mwOpenLinkIdSubModule.getId(P_CONFIG_MOCK);
expect(id).to.be.deep.equal({id: {eid: 'XX-YY-ZZ-123'}});
});

it('getId() should return an empty Id when the MediaWallah openLink first party cookie is missing', function () {
const id = mwOpenLinkSubModule.getId();
const id = mwOpenLinkIdSubModule.getId();
expect(id).to.be.deep.equal(undefined);
});
});
Loading