Skip to content

Commit

Permalink
Ats optional 3p endpoint - keep default behavior the same (#6586)
Browse files Browse the repository at this point in the history
* ATS-identityLinkIdSystem - add use3P config property to control firing of 3P envelope endpoint

* ATS-identityLinkIdSystem - add notUse3P config property to control firing of 3P envelope endpoint
  • Loading branch information
mamatic authored Apr 14, 2021
1 parent 5fbef60 commit 1aeca20
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 24 deletions.
3 changes: 1 addition & 2 deletions integrationExamples/gpt/idImportLibrary_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@
name: 'identityLink',
params: {
pid: '14', // Set your real identityLink placement ID here
// use3P: false // true/false - If you want to use 3P endpoint to retrieve envelope. If you do not set this property to true, 3p endpoint will not be fired. By default this property is undefined and 3p request will not be fired.
},
// notUse3P: true // true/false - If you do not want to use 3P endpoint to retrieve envelope. If you do not set this property to true, 3p endpoint will be fired. By default this propertt is undefined and 3p request will be fired.},
storage: {
type: 'html5',
name: 'idl_env',
Expand Down
2 changes: 1 addition & 1 deletion integrationExamples/gpt/userId_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
name: 'identityLink',
params: {
pid: '14', // Set your real identityLink placement ID here
// use3P: false // true/false - If you want to use 3P endpoint to retrieve envelope. If you do not set this property to true, 3p endpoint will not be fired. By default this property is undefined and 3p request will not be fired.
// notUse3P: true // true/false - If you do not want to use 3P endpoint to retrieve envelope. If you do not set this property to true, 3p endpoint will be fired. By default this property is undefined and 3p request will be fired.
},
storage: {
type: 'cookie',
Expand Down
2 changes: 1 addition & 1 deletion modules/identityLinkIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function getEnvelope(url, callback, configParams) {
}
};

if (configParams.use3P && !storage.getCookie('_lr_retry_request')) {
if (!configParams.notUse3P && !storage.getCookie('_lr_retry_request')) {
setRetryCookie();
utils.logInfo('identityLink: A 3P retrieval is attempted!');
setEnvelopeSource(false);
Expand Down
2 changes: 1 addition & 1 deletion modules/userId/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
* @property {(LiveIntentCollectConfig|undefined)} liCollectConfig - the config for LiveIntent's collect requests
* @property {(string|undefined)} pd - publisher provided data for reconciling ID5 IDs
* @property {(string|undefined)} emailHash - if provided, the hashed email address of a user
* @property {(string|undefined)} use3P - use to retrieve envelope from 3p endpoint
* @property {(string|undefined)} notUse3P - use to retrieve envelope from 3p endpoint
*/

/**
Expand Down
4 changes: 2 additions & 2 deletions modules/userId/userId.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pbjs.setConfig({
name: 'identityLink',
params: {
pid: '999', // Set your real identityLink placement ID here
// use3P: false // true/false - If you want to use 3P endpoint to retrieve envelope. If you do not set this property to true, 3p endpoint will not be fired. By default this propertt is undefined and 3p request will not be fired.
// notUse3P: true // true/false - If you do not want to use 3P endpoint to retrieve envelope. If you do not set this property to true, 3p endpoint will be fired. By default this property is undefined and 3p request will be fired.
},
storage: {
type: 'cookie',
Expand Down Expand Up @@ -146,7 +146,7 @@ pbjs.setConfig({
name: 'identityLink',
params: {
pid: '999', // Set your real identityLink placement ID here
// use3P: false // true/false - If you want to use 3P endpoint to retrieve envelope. If you do not set this property to true, 3p endpoint will not be fired. By default this property is undefined and 3p request will not be fired.
// notUse3P: true // true/false - If you do not want to use 3P endpoint to retrieve envelope. If you do not set this property to true, 3p endpoint will be fired. By default this property is undefined and 3p request will be fired.
},
storage: {
type: 'html5',
Expand Down
20 changes: 3 additions & 17 deletions test/spec/modules/identityLinkIdSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ describe('IdentityLinkId tests', function () {

it('should call the LiveRamp envelope endpoint', function () {
let callBackSpy = sinon.spy();
defaultConfigParams.params.use3P = true;
let submoduleCallback = identityLinkSubmodule.getId(defaultConfigParams).callback;
submoduleCallback(callBackSpy);
let request = server.requests[0];
Expand Down Expand Up @@ -65,7 +64,6 @@ describe('IdentityLinkId tests', function () {
});

it('should call the LiveRamp envelope endpoint with IAB consent string v1', function () {
defaultConfigParams.params.use3P = true;
let callBackSpy = sinon.spy();
let consentData = {
gdprApplies: true,
Expand All @@ -84,7 +82,6 @@ describe('IdentityLinkId tests', function () {
});

it('should call the LiveRamp envelope endpoint with IAB consent string v2', function () {
defaultConfigParams.params.use3P = true;
let callBackSpy = sinon.spy();
let consentData = {
gdprApplies: true,
Expand All @@ -106,7 +103,6 @@ describe('IdentityLinkId tests', function () {
});

it('should not throw Uncaught TypeError when envelope endpoint returns empty response', function () {
defaultConfigParams.params.use3P = true;
let callBackSpy = sinon.spy();
let submoduleCallback = identityLinkSubmodule.getId(defaultConfigParams).callback;
submoduleCallback(callBackSpy);
Expand All @@ -123,7 +119,6 @@ describe('IdentityLinkId tests', function () {
});

it('should log an error and continue to callback if ajax request errors', function () {
defaultConfigParams.params.use3P = true;
let callBackSpy = sinon.spy();
let submoduleCallback = identityLinkSubmodule.getId(defaultConfigParams).callback;
submoduleCallback(callBackSpy);
Expand All @@ -148,8 +143,7 @@ describe('IdentityLinkId tests', function () {
expect(request).to.be.eq(undefined);
});

it('should call the LiveRamp envelope endpoint if cookie _lr_retry_request does not exist and use3P config property was set to true', function () {
defaultConfigParams.params.use3P = true;
it('should call the LiveRamp envelope endpoint if cookie _lr_retry_request does not exist and notUse3P config property was not set', function () {
let callBackSpy = sinon.spy();
let submoduleCallback = identityLinkSubmodule.getId(defaultConfigParams).callback;
submoduleCallback(callBackSpy);
Expand All @@ -163,16 +157,8 @@ describe('IdentityLinkId tests', function () {
expect(callBackSpy.calledOnce).to.be.true;
});

it('should not call the LiveRamp envelope endpoint if config property use3P is set to false', function () {
defaultConfigParams.params.use3P = false;
let callBackSpy = sinon.spy();
let submoduleCallback = identityLinkSubmodule.getId(defaultConfigParams).callback;
submoduleCallback(callBackSpy);
let request = server.requests[0];
expect(request).to.be.eq(undefined);
});

it('should not call the LiveRamp envelope endpoint if config property use3P is undefined', function () {
it('should not call the LiveRamp envelope endpoint if config property notUse3P is set to true', function () {
defaultConfigParams.params.notUse3P = true;
let callBackSpy = sinon.spy();
let submoduleCallback = identityLinkSubmodule.getId(defaultConfigParams).callback;
submoduleCallback(callBackSpy);
Expand Down

0 comments on commit 1aeca20

Please sign in to comment.