Since #14495 is merged navigatorAlias.cookieEnabled
is not utilized any more, which results in a greater number of testcookies, which leads to strange browser-problems.
I am currently using Matomo on one domain with >100 different websites /subdivision-a
, /subdivision-b
. Some of the websites have multiple names: /subdivision-a
= /alias-a
)
setCookieDomain
is set to *.example.org
, setCookiePath
is set to the specific path of a subdivision or alias (subdivision-a
, alias-a
)
Once a user visited too many pages and accumulated too many cookies their browser starts to act weird. Reloading the page does not work, or results in an error. (Deleting the cookies resolves the problem.)
Is there a chance that navigatorAlias.cookieEnabled
will be used again if applicable, e.g. not on Modals in IE 11 #11507?
Or that the testcookie does not use getCookieName
?
Is there a reason to use both configTrackerSiteId
or domainHash
for the testcookie?
I am aware that less testcookies don't solve my problem entirely, but reducing the number of cookies from n
to 1
would be a big help. (If there are other solutions, I would appreciate any help.)
Thanks in advance!
This sounds not good indeed.
e.g. not on Modals in IE 11 #11507?
by any chance do you know if / how this can be detected?
I suppose in worst case we would maybe need to detect IE in general see https://stackoverflow.com/a/21712356 using userAgent.indexOf('MSIE ') > 0
and userAgent.indexOf('Trident/ ') > 0
? This be obviously not the best solution since IE would still have these issues but it would at least limit that problem.
Or that the testcookie does not use getCookieName?
I suppose this could be done too... we would just need to make sure to use our cookiePrefixName... @mattab I suppose there be no problem with this? Might be good to do this in general to avoid setting heaps of test cookies.
by any chance do you know if / how this can be detected?
Since showModalDialog
is obsolete and can not be used in current browsers, maybe checking for window.showModalDialog
could do the job:
function hasCookies() {
if (configCookiesDisabled) {
return '0';
}
if(window.showModalDialog !== undefined && isDefined(navigatorAlias.cookieEnabled))
{
return navigatorAlias.cookieEnabled ? '1' : '0';
}
var testCookieName = getCookieName('testcookie');
setCookie(testCookieName, '1');
return getCookie(testCookieName) === '1' ? '1' : '0';
}
Cheers @SpazzMarticus created https://github.com/matomo-org/matomo/pull/15225
Two awesome ideas there re testing for showModalDialog and only one test cookie overall and not per site...
@mattab I suppose there be no problem with this? Might be good to do this in general to avoid setting heaps of test cookies.
There should be no problem with this :+1: