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

cpexId Id Module: Renamed to czechAdId [vendor confirms no use yet, non-breaking] #9433

Merged
merged 1 commit into from
Feb 24, 2023
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
2 changes: 1 addition & 1 deletion modules/.submodules.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"amxIdSystem",
"britepoolIdSystem",
"connectIdSystem",
"cpexIdSystem",
"czechAdIdSystem",
"criteoIdSystem",
"dacIdSystem",
"deepintentDpesIdSystem",
Expand Down
27 changes: 0 additions & 27 deletions modules/cpexIdSystem.md

This file was deleted.

14 changes: 7 additions & 7 deletions modules/cpexIdSystem.js → modules/czechAdIdSystem.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
/**
* This module adds 'caid' to the User ID module
* The {@link module:modules/userId} module is required
* @module modules/cpexIdSystem
* @module modules/czechAdIdSystem
* @requires module:modules/userId
*/

import { submodule } from '../src/hook.js'
import { getStorageManager } from '../src/storageManager.js'

// Returns StorageManager
export const storage = getStorageManager({ gvlid: 570, moduleName: 'cpexId' })
export const storage = getStorageManager({ gvlid: 570, moduleName: 'czechAdId' })

// Returns the id string from either cookie or localstorage
const readId = () => { return storage.getCookie('czaid') || storage.getDataFromLocalStorage('czaid') }

/** @type {Submodule} */
export const cpexIdSubmodule = {
version: '0.0.5',
export const czechAdIdSubmodule = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my strategy would be to export this as a function taking in the module name, and have a "dummy" cpexIdSystyem.js that re-registers under the old name until version 8. alternatively, you could delay this change until v8.

version: '0.1.0',
/**
* used to link submodule with config
* @type {string}
*/
name: 'cpexId',
name: 'czechAdId',
/**
* Vendor ID of Czech Publisher Exchange
* @type {Number}
Expand All @@ -32,7 +32,7 @@ export const cpexIdSubmodule = {
* @function decode
* @returns {(Object|undefined)}
*/
decode () { return { cpexId: readId() } },
decode () { return { czechAdId: readId() } },
/**
* performs action to obtain id and return a value in the callback's response argument
* @function
Expand All @@ -44,4 +44,4 @@ export const cpexIdSubmodule = {
}
}

submodule('userId', cpexIdSubmodule)
submodule('userId', czechAdIdSubmodule)
27 changes: 27 additions & 0 deletions modules/czechAdIdSystem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## CzechAdId User ID Submodule

Czech Ad ID is a joint project of publishers of the [CPEx alliance](https://www.cpex.cz/) and [Seznam.cz](https://www.seznam.cz). It is a deterministic user ID that offers cross-domain and cross-device identification. For more information see [czechadid.cz](https://www.czechadid.cz)).

## Building Prebid with CzechAdId Support

First, make sure to add the czechAdId to your Prebid.js package with:

```
gulp build --modules=czechAdIdSystem
```

The following configuration parameters are available:

```javascript
pbjs.setConfig({
userSync: {
userIds: [{
name: 'czechAdId'
}]
}
});
```

| Param under userSync.userIds[] | Scope | Type | Description | Example |
| --- | --- | --- | --- | --- |
| name | Required | String | The name of this module. | `"czechAdId"` |
4 changes: 2 additions & 2 deletions modules/userId/eids.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ export const USER_IDS_CONFIG = {
atype: 1
},

// cpexId
'cpexId': {
// czechAdId
'czechAdId': {
source: 'czechadid.cz',
atype: 1
},
Expand Down
2 changes: 1 addition & 1 deletion modules/userId/userId.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pbjs.setConfig({
expires: 1
}
}, {
name: "cpexId"
name: "czechAdId"
}, {
name: 'mwOpenLinkId',
params: {
Expand Down
18 changes: 9 additions & 9 deletions test/spec/modules/cpexIdSystem_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { cpexIdSubmodule, storage } from 'modules/cpexIdSystem.js';
import { czechAdIdSubmodule, storage } from 'modules/czechAdIdSystem.js';

describe('cpexId module', function () {
describe('czechAdId module', function () {
let getCookieStub;

beforeEach(function (done) {
Expand All @@ -16,23 +16,23 @@ describe('cpexId module', function () {

describe('getId()', function () {
it('should return the uid when it exists in cookie', function () {
getCookieStub.withArgs('czaid').returns('cpexIdTest');
const id = cpexIdSubmodule.getId();
expect(id).to.be.deep.equal({ id: 'cpexIdTest' });
getCookieStub.withArgs('czaid').returns('czechAdIdTest');
const id = czechAdIdSubmodule.getId();
expect(id).to.be.deep.equal({ id: 'czechAdIdTest' });
});

cookieTestCasesForEmpty.forEach(testCase => it('should not return the uid when it doesnt exist in cookie', function () {
getCookieStub.withArgs('czaid').returns(testCase);
const id = cpexIdSubmodule.getId();
const id = czechAdIdSubmodule.getId();
expect(id).to.be.undefined;
}));
});

describe('decode()', function () {
it('should return the uid when it exists in cookie', function () {
getCookieStub.withArgs('czaid').returns('cpexIdTest');
const decoded = cpexIdSubmodule.decode();
expect(decoded).to.be.deep.equal({ cpexId: 'cpexIdTest' });
getCookieStub.withArgs('czaid').returns('czechAdIdTest');
const decoded = czechAdIdSubmodule.decode();
expect(decoded).to.be.deep.equal({ czechAdId: 'czechAdIdTest' });
});
});
});
4 changes: 2 additions & 2 deletions test/spec/modules/eids_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,9 @@ describe('eids array generation for known sub-modules', function() {
});
});

it('cpexId', () => {
it('czechAdId', () => {
const id = 'some-random-id-value'
const userId = { cpexId: id };
const userId = { czechAdId: id };
const [eid] = createEidsArray(userId);
expect(eid).to.deep.equal({
source: 'czechadid.cz',
Expand Down