User

Browsers and Operating Systems

How Opterius identifies browsers and operating systems from User-Agent strings.

Last updated 1775692800
  • How operating systems are detected
  • Why simple substring matching?
  • Bot detection happens first
  • Mobile vs desktop split
  • The Top Browsers and Top Operating Systems tables show what software your visitors are using. They're useful for browser compatibility decisions ("can we drop IE support yet?") and for sizing UI choices ("most of my traffic is mobile, prioritize the responsive design").

    How browsers are detected

    The agent parses each visitor's User-Agent string and matches it against known browser markers. The order matters because some browsers' UAs contain markers from other browsers:

    Browser Detection marker Notes
    Edge Edg/ Must check first — Edge's UA also contains Chrome/ and Safari/
    Opera OPR/ or Opera Must check before Chrome — Opera also says Chrome/
    Firefox Firefox/ Distinctive — easy to spot
    Chrome Chrome/ (excluding Chromium) Caught after Edge and Opera
    Safari Safari/ Caught last because Chrome/Edge UAs also contain it
    Other None of the above Old browsers, niche browsers, headless browsers

    A typical Chrome UA looks like:

    Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
    

    The agent sees Chrome/, marks it as Chrome, and ignores the trailing Safari/537.36 (which is there for historical reasons — every modern browser pretends to be Safari for backwards compatibility with old user-agent sniffing scripts).

    Browser icons

    Each browser shows up with its official brand icon:

    • 🟢🟡🔴🔵 Chrome — circular logo with Google brand colours
    • 🦊 Firefox — orange flame
    • 🧭 Safari — blue compass
    • 🌊 Edge — blue swirl
    • 🅾️ Opera — red O

    The icons are inline SVGs, no image files or external requests required. They're recognisable instantly without needing the text label.

    How operating systems are detected

    Same approach — substring matching against the UA string with the order chosen carefully:

    OS Detection marker Notes
    Windows Windows Distinct, easy
    iOS iPhone or iPad Must check before macOS — iPhone UAs also say Mac OS X
    macOS Mac OS X or Macintosh Caught after iOS
    Android Android Distinct
    Linux Linux Caught last — Android UAs also say Linux
    Other None of the above BSD, ChromeOS, gaming consoles, etc.

    OS icons

    • 🪟 Windows — four-pane logo
    • 🍎 macOS — apple silhouette
    • 🐧 Linux — yellow flame (using Tux colours)
    • 🤖 Android — green robot
    • 📱 iOS — apple silhouette (same as macOS — they're both Apple products)

    Why simple substring matching?

    There are full-featured User-Agent parser libraries (uap-go, mssola/user_agent) that can extract browser version, OS version, device type, etc. The agent could use one of those, but Opterius deliberately uses simple substring matching for three reasons:

    1. Speed: substring checks are dozens of times faster than regex parsers. Matters when you're parsing thousands of log lines per second on a busy server.
    2. No dependencies: zero external Go libraries to track for security updates.
    3. Good enough: hosting customers care about browser families ("how many of my visitors use Chrome?"), not minor version numbers ("how many use Chrome 120.0.6099.234?"). The simple approach gives them everything useful with none of the complexity.

    If you want detailed UA breakdowns, query the raw access logs directly via SSH.

    Bot detection happens first

    Before the agent even tries to identify the browser/OS, it checks if the User-Agent matches a known bot pattern. If yes, the visit is counted as a bot and skipped from the browser/OS tables. Otherwise it's counted as a human visit and processed normally.

    This means the Top Browsers and Top Operating Systems tables show only human traffic, which is what you want. The bot count appears in the dedicated Bot Traffic stat card.

    Mobile vs desktop split

    The dashboard doesn't have a dedicated "mobile vs desktop" pie chart yet, but you can read it from the OS table:

    • Desktop: Windows + macOS + Linux
    • Mobile: iOS + Android

    If iOS + Android together are larger than Windows + macOS + Linux, your audience is mobile-first.