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

cee Id System : initial ID module release #11510

Merged
merged 55 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
1a37b62
Merge pull request #1 from prebid/master
wojciech-bialy-wpm Aug 18, 2020
5a90ba4
Update tests for sspBC adapter
wojciech-bialy-wpm Nov 16, 2020
2183a85
Merge pull request #9 from prebid/master
wojciech-bialy-wpm May 20, 2021
767334b
Merge pull request #11 from prebid/master
wojciech-bialy-wpm Jun 1, 2021
97d7ccf
Merge pull request #13 from prebid/master
wojciech-bialy-wpm Jul 29, 2021
8856c36
Merge pull request #15 from prebid/master
wojciech-bialy-wpm Sep 21, 2021
754df70
Merge pull request #16 from prebid/master
wojciech-bialy-wpm Oct 7, 2021
273e7db
[sspbc-adapter] 5.3 updates: content-type for notifications
Oct 8, 2021
08c90fb
[sspbc-adapter] pass CTA to native bid
Oct 14, 2021
363d342
[sspbc-5.3] keep pbsize for detected adunits
Oct 14, 2021
9f9cc49
[maintenance] - remove old test for sspBc bid adaptor
Oct 14, 2021
22b2afc
[sspbc-5.3] increment adaptor ver
Oct 14, 2021
62dad10
[sspbc-adapter] maintenance update to sspBCBidAdapter
Oct 14, 2021
65a7738
remove yarn.lock
Oct 14, 2021
d224072
Merge pull request #17 from prebid/master
wojciech-bialy-wpm Oct 14, 2021
cf9f3e0
Delete package-lock.json
wojciech-bialy-wpm Oct 25, 2021
1721574
remove package-lock.jsonfrom pull request
Oct 25, 2021
ee21d84
update sspbc-5.3 branch
Oct 25, 2021
170fdcd
Merge branch 'master' of https://github.com/prebid/Prebid.js into ssp…
Oct 25, 2021
26ca477
[sspbc-adapter] send pageViewId in request
Oct 25, 2021
2a8278b
[sspbc-adapter] update pageViewId test
Oct 25, 2021
14ac217
Merge pull request #19 from prebid/master
wojciech-bialy-wpm Nov 16, 2021
6d5bbd3
[sspbc-adapter] add viewabiility tracker to native ads
Nov 16, 2021
75174f6
[sspbc-adapter] add support for bid.admNative property
Nov 16, 2021
7891a9e
[sspbc-adapter] ensure that placement id length is always 3 (improves…
Nov 18, 2021
ad6a21a
[sspbc-adapter] read publisher id and custom ad label, then send them…
Nov 18, 2021
e422156
[sspbc-adapter] adlabel and pubid are set as empty strings, if not pr…
Nov 18, 2021
9a792f0
[sspbc-adapter] jstracker data fix
Nov 22, 2021
9ea4c7c
[sspbc-adapter] jstracker data fix
Nov 22, 2021
4461f6f
[sspbc-adapter] send tagid in notifications
Nov 24, 2021
ca7c5b4
[sspbc-adapter] add gvlid to spec; prepare getUserSyncs for iframe + …
Nov 26, 2021
e419627
update remote repo
wojciech-bialy-wpm Sep 20, 2022
af81f6f
update remote repo
wojciech-bialy-wpm Sep 20, 2022
cb7eed2
update remote repo
wojciech-bialy-wpm Sep 20, 2022
99801d1
Merge pull request #28 from prebid/master
wojciech-bialy-wpm Jul 3, 2023
7bb7efa
Merge pull request #29 from prebid/master
wojciech-bialy-wpm Jul 12, 2023
ac9e623
cleanup of grupawp/prebid master branch
wojciech-bialy-wpm Jul 12, 2023
5a206fd
update sspBC adapter to v 5.9
wojciech-bialy-wpm Jul 12, 2023
6d1f2a8
update tests for sspBC bid adapter
wojciech-bialy-wpm Jul 13, 2023
35a190f
Merge pull request #30 from prebid/master
wojciech-bialy-wpm Aug 23, 2023
8fd00ff
[sspbc-adapter] add support for topicsFPD module
wojciech-bialy-wpm Aug 30, 2023
e5eba5d
[sspbc-adapter] change topic segment ids to int
wojciech-bialy-wpm Sep 5, 2023
cc82ed7
Merge pull request #31 from prebid/master
wojciech-bialy-wpm Oct 30, 2023
e9c99f8
merge repo updates
wojciech-bialy-wpm Oct 30, 2023
c501072
Merge pull request #32 from prebid/master
wojciech-bialy-wpm Jan 8, 2024
f093c44
Merge branch 'prebid:master' into master
wojciech-bialy-wpm Feb 8, 2024
7b8d1a7
Merge pull request #33 from prebid/master
wojciech-bialy-wpm Feb 22, 2024
2dc6ce6
Merge pull request #34 from prebid/master
wojciech-bialy-wpm Mar 1, 2024
f88385a
add pirIdSystem
decemberWP Mar 26, 2024
f96e3c6
pirIdSystem
decemberWP Mar 27, 2024
6625b70
piridSystem - preCR
decemberWP Mar 28, 2024
455d118
Merge branch 'prebid:master' into master
decemberWP Apr 2, 2024
3e3c529
Merge branch 'master' into piridsystem
decemberWP Apr 2, 2024
16e3a21
fix after CR
decemberWP Apr 15, 2024
7c961d1
name change
decemberWP May 17, 2024
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
62 changes: 62 additions & 0 deletions modules/ceeIdSystem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* This module adds ceeId to the User ID module
* The {@link module:modules/userId} module is required
* @module modules/ceeId
* @requires module:modules/userId
*/

import { MODULE_TYPE_UID } from '../src/activities/modules.js';
import { getStorageManager } from '../src/storageManager.js';
import { submodule } from '../src/hook.js';
import {domainOverrideToRootDomain} from '../libraries/domainOverrideToRootDomain/index.js';

/**
* @typedef {import('../modules/userId/index.js').Submodule} Submodule
* @typedef {import('../modules/userId/index.js').IdResponse} IdResponse
*/

const MODULE_NAME = 'ceeId';
const ID_TOKEN = 'WPxid';
export const storage = getStorageManager({ moduleName: MODULE_NAME, moduleType: MODULE_TYPE_UID });

/**
* Reads the ID token from local storage or cookies.
* @returns {string|undefined} The ID token, or undefined if not found.
*/
export const readId = () => storage.getDataFromLocalStorage(ID_TOKEN) || storage.getCookie(ID_TOKEN);

/** @type {Submodule} */
export const ceeIdSubmodule = {
name: MODULE_NAME,
gvlid: 676,

/**
* decode the stored id value for passing to bid requests
* @function decode
* @param {string} value
* @returns {(Object|undefined)}
*/
decode(value) {
return typeof value === 'string' ? { 'ceeId': value } : undefined;
},

/**
* performs action to obtain id and return a value
* @function
* @returns {(IdResponse|undefined)}
*/
getId() {
const ceeIdToken = readId();

return ceeIdToken ? { id: ceeIdToken } : undefined;
},
domainOverride: domainOverrideToRootDomain(storage, MODULE_NAME),
eids: {
'ceeId': {
source: 'ceeid.eu',
atype: 1
},
},
};

submodule('userId', ceeIdSubmodule);
27 changes: 27 additions & 0 deletions modules/ceeIdSystem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Overview

Module Name: ceeIdSystem
Module Type: UserID Module
Maintainer: pawel.grudzien@grupawp.pl

# Description

User identification system for WPM

### Prebid Params example

```
pbjs.setConfig({
userSync: {
userIds: [{
name: 'ceeId',
storage: {
type: 'cookie',
name: 'ceeIdToken',
expires: 7,
refreshInSeconds: 360
}
}]
}
});
```
77 changes: 77 additions & 0 deletions test/spec/modules/ceeIdSystem_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { ceeIdSubmodule, storage, readId } from 'modules/ceeIdSystem.js';
import sinon from 'sinon';

describe('ceeIdSystem', () => {
let sandbox;
let getCookieStub;
let getDataFromLocalStorageStub;

beforeEach(() => {
sandbox = sinon.createSandbox();
getCookieStub = sandbox.stub(storage, 'getCookie');
getDataFromLocalStorageStub = sandbox.stub(storage, 'getDataFromLocalStorage');
});

afterEach(() => {
sandbox.restore();
});

describe('getId', () => {
it('should return an object with id when ceeIdToken is found', () => {
getDataFromLocalStorageStub.returns('testToken');
getCookieStub.returns('testToken');

const result = ceeIdSubmodule.getId();

expect(result).to.deep.equal({ id: 'testToken' });
});

it('should return undefined when ceeIdToken is not found', () => {
const result = ceeIdSubmodule.getId();

expect(result).to.be.undefined;
});
});

describe('decode', () => {
it('should return an object with ceeId when value is a string', () => {
const result = ceeIdSubmodule.decode('testId');

expect(result).to.deep.equal({ ceeId: 'testId' });
});

it('should return undefined when value is not a string', () => {
const result = ceeIdSubmodule.decode({});

expect(result).to.be.undefined;
});
});

describe('readId', () => {
it('should return data from local storage when it exists', () => {
getDataFromLocalStorageStub.returns('local_storage_data');

const result = readId();

expect(result).to.equal('local_storage_data');
});

it('should return data from cookie when local storage data does not exist', () => {
getDataFromLocalStorageStub.returns(null);
getCookieStub.returns('cookie_data');

const result = readId();

expect(result).to.equal('cookie_data');
});

it('should return null when neither local storage data nor cookie data exists', () => {
getDataFromLocalStorageStub.returns(null);
getCookieStub.returns(null);

const result = readId();

expect(result).to.be.null;
});
});
});