@mattab opened this Issue on March 16th 2015 Owner

The goal of this issue is to fix the bug where the "% visits with Cookie support" sometimes shows more than 100%. this can be seen in the demo here.

cookie 103 percent

@mnapoli commented on March 17th 2015 Member

The piwik.js tracker will not detect plugins on IE because "it is not supported".

if (!((new RegExp('MSIE')).test(navigatorAlias.userAgent))) {
    if (navigatorAlias.mimeTypes && navigatorAlias.mimeTypes.length) {
        // ... look in navigator.mimeTypes
    }

    ...

    // other browser features
    browserFeatures.cookie = hasCookies();
}

full code here: https://github.com/piwik/piwik/blob/master/js/piwik.js#L3996-4022

However IE 11 does not report itself as MSIE user agent anymore which means it will go into this branch of code, so it will report for example if the browser supports cookie. I don't think it will report for other plugins yet but it could happen in the future.

Anyway now the problem is that we have IE11 cookies stats recorded. But in the "Plugins" report we do this:

$visitsSum = $visitsSumTotal - $ieVisits;

full code here: https://github.com/piwik/piwik/blob/master/plugins/DevicePlugins/API.php#L77-77

Which means we calculate the percentage over all the visits that are not IE (but IE 11 did report cookie usage). Which leads to a total greater than 100%…

I don't see a perfect way to fix this, here are options:

  • do not ignore IE visits when calculating the percentage: however this leads to % that could be wrong (e.g. 95% support for cookies could actually be 100% in reality)
  • hack to ignore IE < 11 visits: cookies % would be fixed but for other plugins we don't have stats for IE 11 so we still have wrong % for them…
  • even more hacky stuff to ignore IE < 11 visits for cookie % but ignore all IE visits for the rest of the rows: in the future if IE support improves then we will get the same problem again
  • just replace any % > 100 to 100: quick and dirty, destroys the value of the report, but that's a possibility
  • change piwik.js to differentiate between "not supported" and "unknown": that way we can have realistic %

I think the last solution is the best as it would also allow to have realistic % for any other browser that doesn't support getting supported plugins. It would also allow to show 2 percentages: the % for visits that were correctly detected and the % for all the visits (e.g. 80% browsers support Java but it's 50% in total if we include visits where we can't detect the feature). However it requires changing the tracker (and probably other extensive changes), and it wouldn't be backward compatible with data previously recorded…

@mattab @sgiehl do you see any other solution, or do you have a preference with the one I exposed?

@mattab commented on March 17th 2015 Owner

Good find... it's a tricky one to decide the best way forward.

for other plugins we don't have stats for IE 11 so we still have wrong % for them…

does the plugin detection start working for IE11 as well as the cookie detection? (it uses different JS code (cookes detected with navigator.cookieEnabled while plugins detected looking at navigator.mimeTypes)

@mnapoli commented on March 17th 2015 Member

No I don't think so because on MSDN they still show that navigator.mimeTypes is not supported. However that may change in the future of course. That's also why there is the bullet point 2 and 3 which have slightly different implementation because of that.

Scratch that I didn't look hard enough, mimeTypes is supported in IE11: https://msdn.microsoft.com/en-us/library/ie/dn423948(v=vs.85).aspx It's confusing though because the link to the documentation leads to this: https://msdn.microsoft.com/en-us/library/ie/hh801965(v=vs.85).aspx

@mnapoli commented on March 18th 2015 Member

Pull request here: #7469

This Issue was closed on March 19th 2015
Powered by GitHub Issue Mirror