Detect Internet Explorer 11


#1

I use piwik 2.0.2 and only changed the browser.yml file like it is done in the forthcoming 2.0.3 – but nothing happens, IE 11 is still displayes as unknown. Is there anything to do else besides changing browser.yml ?


#2

Same problem here.

Posted earlier about this a few days ago: 301 Moved Permanently

Any help would be appreciated.

SR


#3

if you change the brwser line for ie 11 to

Trident/7.0;*rv:11.0

or

Trident/7.0*rv:11.0

does that help?


#4

No, we both made the changes suggested in the link I provided.

Matt suggested the latest beta, where can I get that?

Thanks,

SR


(Matthieu Aubry) #5

What is the user agent that is not properly detected?


#6

Hi Matt,

My issue is slightly different in that my Piwik installation does not detect any visits. I’ve updated my thread

Thanks,

SR


#7

@Matt:

“Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko” is an example of an user agent I found in my apache log where in piwik the visit is counted, but with browser unknown.


(Matthieu Aubry) #8

I added it to the tests: https://github.com/piwik/piwik/blob/master/tests/PHPUnit/Fixtures/userAgentParserEnhancedFixtures.yml

it now works in git


#9

I was too focused on the nice syntax of browser.yml - and have not realized that it is only used when the plugin DevicesDetection is activated. It isn’t activated in my configuration, cause it’s marked as beta.

So now I found the right place for changes if you do not use the DevicesDetection plugin:

libs/UserAgentParser/UserAgentParser.php

After line 128 I added
’trident’ => ‘IE’,

and changed (former) line 518 from
&& strncmp($userAgent, ‘Mozilla/4.0’, 11) == 0
to
&& (strncmp($userAgent, ‘Mozilla/4.0’, 11) == 0 || strncmp($userAgent, ‘Mozilla/5.0’, 11) == 0)

Now it works and I would suggest to change UserAgentParser.php as mentioned in piwik 2.0.3


(Matthieu Aubry) #10

Thanks I fixed it. IE11 detection fix when not using DevicesDetection · matomo-org/matomo@be3673c · GitHub
soon we will remove this old code and only use DevicesDetection hopefully!


#11

Please note that my mentioned new line after line 128 is needed:
‘trident’ => ‘IE’,

Without that, no browser id would be set (which will be $info[‘id’] in line 518!) and the lines 516-524 are not triggered. So please add this change, too.


#12

And please add it NOT as line 131 (which I did first). Then the IE would be called Trident in piwik.


(Matthieu Aubry) #13

Thanks for review, this was fixed!


#14

I can’t see any fix in matomo/UserAgentParser.php at be3673cf1a7344e3d82cdf1655ed193f3675689e · matomo-org/matomo · GitHub

Please just:
+128 ‘trident’ => ‘IE’,

Without this it would not work!


#15

@Oliver lost:
Thank you for this fix.

I implemented this into “libs/UserAgentParser/UserAgentParser.php” in version 1.12 (I haven’t upgraded yet), and it works perfectly.


#16

Ah, I see now :slight_smile:

For me it works great, too. No more “unknown” browsers. And more IE 11-user then any other IE-version.