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

Make sure to set cookie name before loading any cookie #15814

Merged
merged 2 commits into from Apr 15, 2020
Merged

Make sure to set cookie name before loading any cookie #15814

merged 2 commits into from Apr 15, 2020

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Apr 15, 2020

fix #14978

As described in the issue we need to make sure that setCookieNamePrefix is executed before setSiteId.

Because the method is now executed early, we now longer really need to get the custom variables from cookie there because the method is executed so early that it will be loaded correctly later as part of loadCustomVariables. Nonetheless loading them if it was attempted to load them earlier eg when there is a manually created tracker instance that isn't using _paq.push but tracker.setCookieNamePrefix()

@tsteur tsteur added the Needs Review PRs that need a code review label Apr 15, 2020
@tsteur tsteur added this to the 4.0.0 milestone Apr 15, 2020
@@ -3102,7 +3102,7 @@ if (typeof window.Piwik !== 'object') {
var cookieName = getCookieName('cvar'),
cookie = getCookie(cookieName);

if (cookie.length) {
if (cookie && cookie.length) {
Copy link
Member Author

Choose a reason for hiding this comment

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

cookie might be 0 so better to check if it is set

@sgiehl
Copy link
Member

sgiehl commented Apr 15, 2020

build js

@sgiehl sgiehl merged commit 5c7f849 into 4.x-dev Apr 15, 2020
@sgiehl sgiehl deleted the m14978 branch April 15, 2020 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JS tracker: visitor cookie is set before configuration
2 participants