@oldcookie opened this Issue on March 21st 2017

When the tracker is being initialized, configCookiesDisabled is set to true by default. When hasCookies() is called by detectBroweserFeatures() during initialization, this causes a cookie warning dialog to popup twice(each time navigatorAlias.cookieEnabled) is accessed. This occurs every time the modal dialog is opened.

           function hasCookies() {
                if (configCookiesDisabled) {
                    return '0';
                }
                if (!isDefined(navigatorAlias.cookieEnabled)) {
                    var testCookieName = getCookieName('testcookie');
                    setCookie(testCookieName, '1');
                    return getCookie(testCookieName) === '1' ? '1' : '0';
                }
                return navigatorAlias.cookieEnabled ? '1' : '0';
            }
@mattab commented on March 21st 2017 Member

On IE11 and Win10 I'm not seeing a popup or warning on https://piwik.org

blog

@oldcookie

  • do you use the default JavaScript tracker code on your website or have you customised it in any way?
  • What website URL do you see this warning on IE11?
  • can you see this warning / popup on piwik.org?
@oldcookie commented on March 22nd 2017
  1. Yes, default tracker code.
  2. It's an proprietary webapp that uses a lot of modal dialogs.
  3. I can get it to happen on piwik.org if I open up the console and call window.showModalDialog("http://piwik.org")
screen shot 2017-03-21 at 9 30 47 pm
@mattab commented on March 22nd 2017 Member

Ok thanks for the report. Do you maybe know how to fix this problem?

@oldcookie commented on March 23rd 2017

@mattab We can break this down into two problems:

  1. Cookie is required: don't think this is fixable without IE changing it's behavior.
  2. Cookie is disabled: Since cookie is enabled by default and detection of cookie occurs during initialization—before disableCookie can be called—there is currently no way to get around these modals.

To fix #2, may be can can delay the cookie detection until the call to trackPageView?

@siva538 commented on May 3rd 2019

@mattab , we are planning to modify this in the following way, so we can validate this every time consistently.

FYI - we also got the same issue popped up with IE and showmodal dialog combination.

`

    function hasCookies() 
    {
         if (configCookiesDisabled) 
         {
                 return '0';
         }
                var testCookieName = getCookieName('testcookie');
                setCookie(testCookieName, '1');

                return getCookie(testCookieName) === '1' ? '1' : '0';
     }

`

Let us know if you have any concerns with this approach. Thanks in advance.

@mattab commented on May 12th 2019 Member

@siva538 could you please open a pull request and not there what issue / use case does it help with? Thanks

@siva538 commented on May 13th 2019

Sure @mattab . Will do. We ran into an issue with this when there were repeated popup messages as mentioned in screenshot on 3/22/17 above, and browser was asking to insert a cookie.

However the reality was "navigatorAlias.cookieEnabled" is not supported in IE browser during "Show Modal Dialog".

Reason for weightage is that there are still huge number of users across the globe using IE and this fix would help avoid the unnecessary popup's when Modal is used.

Thank you.

Powered by GitHub Issue Mirror