First off, you can't trust User Agent Strings. Browsers can, and will, lie to you - especially mobile browsers, as they often come with features to spoof being the desktop version as an easy-to-find checkbox. But they are the only way you can get any system information from every browser.
I'm assuming that, since you're looking at the statistics, you'll be saving all the UA strings you recieve somewhere.
Thanks to decades of inconsistent standards you need to resign yourself to the fact browser vendors have stuffed their UA strings with a whole load of nonsense and that you're going to have to unpick that mess yourself and do some parsing and, even putting a lot of time in, it will never be perfect.
First you need to understand the format UA strings are in. UA Strings should be of the format:
Mozilla/5.0 (platform(comment); ...; ...) extension/version ... ...
Internet Explorer reports itself under the 'Platform' section, in the colon-deliminated list in brackets, most other browsers reports themselves in the 'Extension' area.
According to the User-Agent strings guide on MDN and the extensive list on UserAgentString.com the following hold true right now:
- Edge's last extension is 'Edge (version)'
- Internet Explorer contains the string 'MSIE (version)' in the 'Product' section
- Some browsers, such as the AOL embedded browser, do report MSIE, and follow it up with AOL (version)
- Safari always ends with 'Safari/(version)', and does not include 'Chrome' as an extension
- Firefox always ends with 'Firefox/(version)'
- Chrome always ends with 'Chrome/(version) Safari/(version)'
- Other, less popular, browsers (such as Opera) often mimic Chrome or Firefox's UA string but add their own browser to the end, so it would be 'Firefox/(version) (MyBrowser)/(version)'
From here you should be able to write a programme that'll figure out, with a decent accuracy, what each browser is telling you they are. You're going to get false positives, and probably some false negatives, but it's up to you to decide how much work to put in to improve your accuracy.
For example, the UA string you posted in reply to Jorg
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/63.0.3239.132 Safari/537.36"
is more than likely from Chrome, not Edge, as it doesn't end with Edge/(version). Indeed it doesn't include Edge anywhere in the UA string. Again, if it did come from Edge, then there's likely been some UA spoofing going on and if that is the case, you can't reliably discerne those.
[Edit] (As per the comment below, Edge doesn't always report 'Edge', but it will report "Windows NT 10.0; Win64; x64" in its Platform area.)
Now, if that seems like a lot of work (and it is) you could just go with an off-the-shelf system, like Google Analytics*, that have already put in the work for you and work quite well and do a whole lot more than just browser usage reporting.
*(other analytics services are available)