Skip to content

Commit

Permalink
Renamed cpexId to czechAdId (#9433)
Browse files Browse the repository at this point in the history
  • Loading branch information
EskelCz authored Feb 24, 2023
1 parent feb2973 commit 9100018
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 49 deletions.
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 = {
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

0 comments on commit 9100018

Please sign in to comment.