Skip to content

Commit

Permalink
fpid
Browse files Browse the repository at this point in the history
  • Loading branch information
3link committed Apr 26, 2024
1 parent 4596e7b commit 3f85fb9
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 88 deletions.
18 changes: 0 additions & 18 deletions libraries/pubcidEids/pubcidEids.js

This file was deleted.

21 changes: 13 additions & 8 deletions modules/liveIntentIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { gdprDataHandler, uspDataHandler, gppDataHandler, coppaDataHandler } fro
import { getStorageManager } from '../src/storageManager.js';
import { MODULE_TYPE_UID } from '../src/activities/modules.js';
import { UID2_EIDS } from '../libraries/uid2Eids/uid2Eids.js';
import { PUBCID_EIDS } from '../libraries/pubcidEids/pubcidEids.js';
import {UID1_EIDS} from '../libraries/uid1Eids/uid1Eids.js';
import { getRefererInfo } from '../src/refererDetection.js';

Expand Down Expand Up @@ -88,7 +87,7 @@ function parseLiveIntentCollectorConfig(collectConfig) {
*/
function parseRequestedAttributes(overrides) {
function renameAttribute(attribute) {
if (attribute === 'sharedId') {
if (attribute === 'fpId') {
return 'idCookie';
} else {
return attribute;
Expand All @@ -110,7 +109,7 @@ function initializeLiveConnect(configParams) {
}

configParams = configParams || {};
const sharedIdConfig = configParams.sharedId || {};
const fpIdConfig = configParams.fpId || {};

const publisherId = configParams.publisherId || 'any';
const identityResolutionConfig = {
Expand Down Expand Up @@ -139,8 +138,8 @@ function initializeLiveConnect(configParams) {
liveConnectConfig.fireEventDelay = configParams.fireEventDelay;

liveConnectConfig.idCookie = {};
liveConnectConfig.idCookie.name = sharedIdConfig.name;
liveConnectConfig.idCookie.strategy = sharedIdConfig.strategy == 'html5' ? 'localStorage' : sharedIdConfig.strategy;
liveConnectConfig.idCookie.name = fpIdConfig.name;
liveConnectConfig.idCookie.strategy = fpIdConfig.strategy == 'html5' ? 'localStorage' : fpIdConfig.strategy;

const usPrivacyString = uspDataHandler.getConsentData();
if (usPrivacyString) {
Expand Down Expand Up @@ -253,8 +252,8 @@ export const liveIntentIdSubmodule = {

if (value.idCookie) {
if (!coppaDataHandler.getCoppa()) {
result.lipb = { ...result.lipb, pubcid: value.idCookie };
result.pubcid = { 'id': value.idCookie, ext: { provider: LI_PROVIDER_DOMAIN } };
result.lipb = { ...result.lipb, fpid: value.idCookie };
result.fpid = { 'id': value.idCookie };
}
delete result.lipb.idCookie;
}
Expand Down Expand Up @@ -306,7 +305,6 @@ export const liveIntentIdSubmodule = {
eids: {
...UID1_EIDS,
...UID2_EIDS,
...PUBCID_EIDS,
'lipb': {
getValue: function(data) {
return data.lipbid;
Expand Down Expand Up @@ -404,6 +402,13 @@ export const liveIntentIdSubmodule = {
return data.ext;
}
}
},
'fpid': {
source: 'fpid.liveintent.com',
atype: 1,
getValue: function(data) {
return data.id;
}
}
}
};
Expand Down
6 changes: 4 additions & 2 deletions modules/sharedIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {getStorageManager} from '../src/storageManager.js';
import {VENDORLESS_GVLID} from '../src/consentHandler.js';
import {MODULE_TYPE_UID} from '../src/activities/modules.js';
import {domainOverrideToRootDomain} from '../libraries/domainOverrideToRootDomain/index.js';
import {PUBCID_EIDS} from '../libraries/pubcidEids/pubcidEids.js';

/**
* @typedef {import('../modules/userId/index.js').Submodule} Submodule
Expand Down Expand Up @@ -184,7 +183,10 @@ export const sharedIdSystemSubmodule = {

domainOverride: domainOverrideToRootDomain(storage, 'sharedId'),
eids: {
...PUBCID_EIDS
'pubcid': {
source: 'pubcid.org',
atype: 1
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion modules/userId/eids.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ userIdAsEids = [
},
{
source: 'pubcid.org',
source: 'fpid.liveintent.com',
uids: [{
id: 'some-random-id-value',
atype: 1,
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 14 additions & 48 deletions test/spec/modules/eids_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,20 @@ describe('eids array generation for known sub-modules', function() {
});
});

it('fpid; getValue call and ext', function() {
const userId = {
lipb: {
idCookie: 'some-random-id-value'
}
};
const newEids = createEidsArray(userId);
expect(newEids.length).to.equal(1);
expect(newEids[0]).to.deep.equal({
source: 'fpid.liveintent.com',
uids: [{id: 'some-random-id-value', atype: 1}]
});
});

it('bidswitch', function() {
const userId = {
bidswitch: {'id': 'sample_id'}
Expand Down Expand Up @@ -429,54 +443,6 @@ describe('eids array generation for known sub-modules', function() {
});
});

it('pubcid', function() {
const userId = {
pubcid: {'id': 'sample_id'}
};
const newEids = createEidsArray(userId);
expect(newEids.length).to.equal(1);
expect(newEids[0]).to.deep.equal({
source: 'pubcid.org',
uids: [{
id: 'sample_id',
atype: 1
}]
});
});

it('pubcid flat', function() {
const userId = {
pubcid: 'sample_id'
};
const newEids = createEidsArray(userId);
expect(newEids.length).to.equal(1);
expect(newEids[0]).to.deep.equal({
source: 'pubcid.org',
uids: [{
id: 'sample_id',
atype: 1
}]
});
});

it('pubcid with ext', function() {
const userId = {
pubcid: {'id': 'sample_id', 'ext': {'provider': 'some.provider.com'}}
};
const newEids = createEidsArray(userId);
expect(newEids.length).to.equal(1);
expect(newEids[0]).to.deep.equal({
source: 'pubcid.org',
uids: [{
id: 'sample_id',
atype: 1,
ext: {
provider: 'some.provider.com'
}
}]
});
});

it('britepoolId', function() {
const userId = {
britepoolid: 'some-random-id-value'
Expand Down
17 changes: 7 additions & 10 deletions test/spec/modules/liveIntentIdSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,26 +443,26 @@ describe('LiveIntentId', function() {
expect(callBackSpy.calledOnce).to.be.true;
});

it('should decode a idCookie as sharedId if it exists and coppa is false', function() {
it('should decode a idCookie as fpid if it exists and coppa is false', function() {
coppaConsentDataStub.returns(false)
const result = liveIntentIdSubmodule.decode({nonId: 'foo', idCookie: 'bar'})
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'pubcid': 'bar'}, 'pubcid': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}})
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'pubcid': 'bar'}, 'fpid': {'id': 'bar'}})
});

it('should not decode a idCookie as sharedId if it exists and coppa is true', function() {
it('should not decode a idCookie as fpid if it exists and coppa is true', function() {
coppaConsentDataStub.returns(true)
const result = liveIntentIdSubmodule.decode({nonId: 'foo', idCookie: 'bar'})
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo'}})
});

it('should parse sharedId to pubcid', async function() {
it('should resolve fpid from cookie', async function() {
const expectedValue = 'someValue'
const cookieName = 'testcookie'
getCookieStub.withArgs(cookieName).returns(expectedValue)
const config = { params: {
...defaultConfigParams,
sharedId: { 'strategy': 'cookie', 'name': cookieName },
requestedAttributesOverrides: { 'sharedId': true } }
requestedAttributesOverrides: { 'fpid': true } }
}
const submoduleCallback = liveIntentIdSubmodule.getId(config).callback;
const decodedResult = new Promise(resolve => {
Expand All @@ -478,11 +478,8 @@ describe('LiveIntentId', function() {

const result = await decodedResult
expect(result).to.be.eql({
lipb: { 'pubcid': expectedValue },
pubcid: {
ext: { 'provider': 'liveintent.com' },
id: expectedValue
}
lipb: { 'fpid': expectedValue },
fpid: { id: expectedValue }
});
});
})

0 comments on commit 3f85fb9

Please sign in to comment.