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

Lotame Panorama ID Module : add safari handling #9418

Merged
merged 26 commits into from Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
15b58dc
Merge pull request #8 from prebid/master
Tonsil Jan 20, 2021
f9c4ab2
Merge remote-tracking branch 'upstream/master' into master
markaconrad Aug 16, 2021
a86bfde
Merge remote-tracking branch 'upstream/master' into master
markaconrad Oct 26, 2021
61bdf6c
Merge branch 'prebid:master' into master
markaconrad Oct 29, 2021
e0da02d
GRUE-176 work in progress, trying to make the id URL dynamic.
Tonsil Aug 10, 2022
b11b71e
GRUE-176 After some attempts with leveraging environment variables, d…
Tonsil Aug 10, 2022
9eb65a3
GRUE-177 WIP added a fix for handling timestamps, plus there's some t…
Tonsil Aug 17, 2022
b442c8e
GRUE-177 Fixed bug with localStorage checking for empty, included nul…
Tonsil Aug 18, 2022
f7e4397
Merge branch 'master' of github.com:prebid/Prebid.js
Tonsil Aug 18, 2022
6890c08
Merge branch 'master' into feature/GRUE-177_more_prebid_tests
Tonsil Aug 18, 2022
3b33345
GRUE-177 updated the environment handling for dev, qa, and prod. I'm …
Tonsil Aug 19, 2022
06f2d36
GRUE-178 removed the dynamic URL handling for the ID endpoint. We wil…
Tonsil Aug 24, 2022
f0585df
Merge pull request #12 from Lotame/feature/GRUE-177_more_prebid_tests
Tonsil Aug 29, 2022
8dd303f
Merge branch 'master' of github.com:prebid/Prebid.js
Tonsil Oct 7, 2022
a93affc
Resolved merge conflict.
Tonsil Nov 28, 2022
cb61d53
Merge branch 'master-old' into feature/GRUE-339_safari_urls
Tonsil Jan 4, 2023
c242756
GRUE-339 changes to check for browser, and accomodate Safari with a d…
Tonsil Jan 4, 2023
d489241
GRUE-339 changes to check for browser, and accomodate Safari with a d…
Tonsil Jan 4, 2023
8bf14b6
Resolving conflict due to whitespace.
Tonsil Jan 4, 2023
e8d0c9a
Merge branch 'master' into feature/GRUE-339_safari_urls
Tonsil Jan 4, 2023
e37d083
Merge branch 'master' of github.com:prebid/Prebid.js
Tonsil Jan 4, 2023
ce8747f
Merge branch 'master' into feature/GRUE-339_safari_urls
Tonsil Jan 4, 2023
53f3091
GRUE-339 Removed the obfuscation from the Safari URL, as it was deeme…
Tonsil Jan 4, 2023
6de0622
GRUE-339 corrected the safari id endpoint - I had forgotten that it w…
Tonsil Jan 4, 2023
9f0320f
GRUE-339 Updated test to cover Safari handling.
Tonsil Jan 12, 2023
aa8ec7a
GRUE-340 Updated the variable name for the cookieless domain, to remo…
Tonsil Jan 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion modules/lotamePanoramaIdSystem.js
Expand Up @@ -29,6 +29,7 @@ const DAY_MS = 60 * 60 * 24 * 1000;
const MISSING_CORE_CONSENT = 111;
const GVLID = 95;
const ID_HOST = 'id.crwdcntrl.net';
const ID_HOST_COOKIELESS = 'c.ltmsphrcl.net';

export const storage = getStorageManager({gvlid: GVLID, moduleName: MODULE_NAME});
let cookieDomain;
Expand Down Expand Up @@ -252,6 +253,13 @@ export const lotamePanoramaIdSubmodule = {
usPrivacy = getFromStorage('us_privacy');
}

const getRequestHost = function() {
if (navigator.userAgent && navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
patmmccann marked this conversation as resolved.
Show resolved Hide resolved
return ID_HOST_COOKIELESS;
}
return ID_HOST;
}

const resolveIdFunction = function (callback) {
let queryParams = {};
if (storedUserId) {
Expand Down Expand Up @@ -288,7 +296,7 @@ export const lotamePanoramaIdSubmodule = {

const url = buildUrl({
protocol: 'https',
host: ID_HOST,
host: getRequestHost(),
pathname: '/id',
search: isEmpty(queryParams) ? undefined : queryParams,
});
Expand Down
26 changes: 16 additions & 10 deletions test/spec/modules/lotamePanoramaIdSystem_spec.js
Expand Up @@ -18,6 +18,7 @@ describe('LotameId', function() {
let removeFromLocalStorageStub;
let timeStampStub;
let uspConsentDataStub;
let requestHost;

const nowTimestamp = new Date().getTime();

Expand All @@ -33,6 +34,11 @@ describe('LotameId', function() {
);
timeStampStub = sinon.stub(utils, 'timestamp').returns(nowTimestamp);
uspConsentDataStub = sinon.stub(uspDataHandler, 'getConsentData');
if (navigator.userAgent && navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
requestHost = 'https://c.ltmsphrcl.net/id';
} else {
requestHost = 'https://id.crwdcntrl.net/id';
}
});

afterEach(function () {
Expand Down Expand Up @@ -69,7 +75,7 @@ describe('LotameId', function() {
});

it('should call the remote server when getId is called', function () {
expect(request.url).to.be.eq('https://id.crwdcntrl.net/id');
expect(request.url).to.be.eq(`${requestHost}`);
expect(callBackSpy.calledOnce).to.be.true;
});

Expand Down Expand Up @@ -439,7 +445,7 @@ describe('LotameId', function() {

it('should pass the gdpr consent string back', function() {
expect(request.url).to.be.eq(
'https://id.crwdcntrl.net/id?gdpr_applies=true&gdpr_consent=consentGiven'
`${requestHost}?gdpr_applies=true&gdpr_consent=consentGiven`
);
});
});
Expand Down Expand Up @@ -471,7 +477,7 @@ describe('LotameId', function() {

it('should pass the gdpr consent string back', function() {
expect(request.url).to.be.eq(
'https://id.crwdcntrl.net/id?gdpr_applies=true&gdpr_consent=consentGiven'
`${requestHost}?gdpr_applies=true&gdpr_consent=consentGiven`
);
});
});
Expand Down Expand Up @@ -503,7 +509,7 @@ describe('LotameId', function() {

it('should pass the gdpr consent string back', function() {
expect(request.url).to.be.eq(
'https://id.crwdcntrl.net/id?gdpr_applies=true&gdpr_consent=consentGiven'
`${requestHost}?gdpr_applies=true&gdpr_consent=consentGiven`
);
});
});
Expand Down Expand Up @@ -531,7 +537,7 @@ describe('LotameId', function() {

it('should not include the gdpr consent string on the url', function() {
expect(request.url).to.be.eq(
'https://id.crwdcntrl.net/id?gdpr_applies=true'
`${requestHost}?gdpr_applies=true`
);
});
});
Expand Down Expand Up @@ -560,7 +566,7 @@ describe('LotameId', function() {

it('should pass the gdpr consent string back', function() {
expect(request.url).to.be.eq(
'https://id.crwdcntrl.net/id?gdpr_consent=consentGiven'
`${requestHost}?gdpr_consent=consentGiven`
);
});
});
Expand Down Expand Up @@ -589,7 +595,7 @@ describe('LotameId', function() {

it('should pass the gdpr consent string back', function() {
expect(request.url).to.be.eq(
'https://id.crwdcntrl.net/id?gdpr_consent=consentGiven'
`${requestHost}?gdpr_consent=consentGiven`
);
});
});
Expand All @@ -613,7 +619,7 @@ describe('LotameId', function() {
});

it('should pass the gdpr consent string back', function() {
expect(request.url).to.be.eq('https://id.crwdcntrl.net/id');
expect(request.url).to.be.eq(`${requestHost}`);
});
});

Expand Down Expand Up @@ -835,7 +841,7 @@ describe('LotameId', function() {

it('should pass the usp consent string and client id back', function () {
expect(request.url).to.be.eq(
'https://id.crwdcntrl.net/id?gdpr_applies=false&us_privacy=1NNN&c=1234'
`${requestHost}?gdpr_applies=false&us_privacy=1NNN&c=1234`
);
});

Expand Down Expand Up @@ -923,7 +929,7 @@ describe('LotameId', function() {

it('should pass client id back', function () {
expect(request.url).to.be.eq(
'https://id.crwdcntrl.net/id?gdpr_applies=false&c=1234'
`${requestHost}?gdpr_applies=false&c=1234`
);
});

Expand Down