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

LiveIntent User Id Module: Use gppApplicableSections and gppString #10713

Merged
merged 3 commits into from
Nov 14, 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
8 changes: 6 additions & 2 deletions modules/liveIntentIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { triggerPixel, logError } from '../src/utils.js';
import { ajaxBuilder } from '../src/ajax.js';
import { submodule } from '../src/hook.js';
import { LiveConnect } from 'live-connect-js'; // eslint-disable-line prebid/validate-imports
import { gdprDataHandler, uspDataHandler } from '../src/adapterManager.js';
import { gdprDataHandler, uspDataHandler, gppDataHandler } from '../src/adapterManager.js';
import {getStorageManager} from '../src/storageManager.js';
import {MODULE_TYPE_UID} from '../src/activities/modules.js';
import {UID2_EIDS} from '../libraries/uid2Eids/uid2Eids.js';
Expand Down Expand Up @@ -127,7 +127,11 @@ function initializeLiveConnect(configParams) {
liveConnectConfig.gdprApplies = gdprConsent.gdprApplies;
liveConnectConfig.gdprConsent = gdprConsent.consentString;
}

const gppConsent = gppDataHandler.getConsentData();
if (gppConsent) {
liveConnectConfig.gppString = gppConsent.gppString;
liveConnectConfig.gppApplicableSections = gppConsent.applicableSections;
}
// The second param is the storage object, LS & Cookie manipulation uses PBJS
// The third param is the ajax and pixel object, the ajax and pixel use PBJS
liveConnect = liveIntentIdSubmodule.getInitializer()(liveConnectConfig, storage, calls);
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.

23 changes: 19 additions & 4 deletions test/spec/modules/liveIntentIdSystem_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { liveIntentIdSubmodule, reset as resetLiveIntentIdSubmodule, storage } from 'modules/liveIntentIdSystem.js';
import * as utils from 'src/utils.js';
import { gdprDataHandler, uspDataHandler } from '../../../src/adapterManager.js';
import { gdprDataHandler, uspDataHandler, gppDataHandler } from '../../../src/adapterManager.js';
import { server } from 'test/mocks/xhr.js';
resetLiveIntentIdSubmodule();
liveIntentIdSubmodule.setModuleMode('standard')
Expand All @@ -12,6 +12,7 @@ describe('LiveIntentId', function() {
let logErrorStub;
let uspConsentDataStub;
let gdprConsentDataStub;
let gppConsentDataStub;
let getCookieStub;
let getDataFromLocalStorageStub;
let imgStub;
Expand All @@ -24,6 +25,7 @@ describe('LiveIntentId', function() {
logErrorStub = sinon.stub(utils, 'logError');
uspConsentDataStub = sinon.stub(uspDataHandler, 'getConsentData');
gdprConsentDataStub = sinon.stub(gdprDataHandler, 'getConsentData');
gppConsentDataStub = sinon.stub(gppDataHandler, 'getConsentData');
});

afterEach(function() {
Expand All @@ -33,6 +35,7 @@ describe('LiveIntentId', function() {
logErrorStub.restore();
uspConsentDataStub.restore();
gdprConsentDataStub.restore();
gppConsentDataStub.restore();
resetLiveIntentIdSubmodule();
});

Expand All @@ -42,11 +45,15 @@ describe('LiveIntentId', function() {
gdprApplies: true,
consentString: 'consentDataString'
})
gppConsentDataStub.returns({
gppString: 'gppConsentDataString',
applicableSections: [1, 2]
})
let callBackSpy = sinon.spy();
let submoduleCallback = liveIntentIdSubmodule.getId(defaultConfigParams).callback;
submoduleCallback(callBackSpy);
let request = server.requests[0];
expect(request.url).to.match(/.*us_privacy=1YNY.*&gdpr=1&n3pc=1&gdpr_consent=consentDataString.*/);
expect(request.url).to.match(/.*us_privacy=1YNY.*&gdpr=1&n3pc=1&gdpr_consent=consentDataString.*&gpp_s=gppConsentDataString&gpp_as=1%2C2.*/);
const response = {
unifiedId: 'a_unified_id',
segments: [123, 234]
Expand All @@ -65,9 +72,13 @@ describe('LiveIntentId', function() {
gdprApplies: true,
consentString: 'consentDataString'
})
gppConsentDataStub.returns({
gppString: 'gppConsentDataString',
applicableSections: [1]
})
liveIntentIdSubmodule.getId(defaultConfigParams);
setTimeout(() => {
expect(server.requests[0].url).to.match(/https:\/\/rp.liadm.com\/j\?.*&us_privacy=1YNY.*&wpn=prebid.*&gdpr=1&n3pc=1&n3pct=1&nb=1&gdpr_consent=consentDataString.*/);
expect(server.requests[0].url).to.match(/https:\/\/rp.liadm.com\/j\?.*&us_privacy=1YNY.*&wpn=prebid.*&gdpr=1&n3pc=1&n3pct=1&nb=1&gdpr_consent=consentDataString&gpp_s=gppConsentDataString&gpp_as=1.*/);
done();
}, 200);
});
Expand Down Expand Up @@ -123,9 +134,13 @@ describe('LiveIntentId', function() {
gdprApplies: false,
consentString: 'consentDataString'
})
gppConsentDataStub.returns({
gppString: 'gppConsentDataString',
applicableSections: [1]
})
liveIntentIdSubmodule.decode({}, defaultConfigParams);
setTimeout(() => {
expect(server.requests[0].url).to.match(/.*us_privacy=1YNY.*&gdpr=0&gdpr_consent=consentDataString.*/);
expect(server.requests[0].url).to.match(/.*us_privacy=1YNY.*&gdpr=0&gdpr_consent=consentDataString.*&gpp_s=gppConsentDataString&gpp_as=1.*/);
done();
}, 200);
});
Expand Down