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

Do not generate crossdomain link when cookies are disabled #16017

Merged
merged 2 commits into from Jun 4, 2020

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Jun 4, 2020

Noticed this when testing on our site with cookies disabled. Basically in this case there is no visitorId unless a user sets it manually.

getCrossDomainVisitorId() was then only returning the device ID but not the visitorId and thus the generated link was invalid.

Tried to add a test like

        tracker.setVisitorId(null); // also tried empty string etc
        tracker.setSiteId(99);

        replacedUrl = makeReplaceHrefForCrossDomainLink('http://www.example.com/');
        strictEqual(null, replacedUrl, 'replaceHrefForCrossDomainLink, should not return a link when visitorId not set');

but wasn't possible because the site had a cookie already set and Matomo would then always use that cookie overwriting any custom set value when the value is empty
image

Shouldn't be needed the test anyway.

@tsteur tsteur added the Needs Review PRs that need a code review label Jun 4, 2020
@tsteur tsteur added this to the 4.0.0 milestone Jun 4, 2020
Copy link
Member

@diosmosis diosmosis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. If desired, we can add a test to JSTracker_spec.js where we disable cookies in puppeteer and make sure tracking generally works.

@tsteur
Copy link
Member Author

tsteur commented Jun 4, 2020

build js

@tsteur tsteur merged commit 1d1a5ac into 4.x-dev Jun 4, 2020
@tsteur tsteur deleted the disablecookiefix branch June 4, 2020 21:03
@mattab mattab added the c: Privacy For issues that impact or improve the privacy. label Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Privacy For issues that impact or improve the privacy. Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants