Updated: September 2023
Why User-Agent String analysis is difficult
One of the most confusing aspects about User-Agent strings is that many of them look the same. In fact, most will look like this:
This is a User-Agent string for a Samsung Galaxy S23 Ultra, however, based on included keywords such as 'Mozilla', 'Mobile Safari', and 'AppleWebKit', the string alone could easily cause confusion. Let's break down each component:
Since the introduction of User-Agent Client Hints, extracting valuable information from User-Agent strings is now even more difficult as less information is provided on the initial request. Here's what a Samsung Galaxy S23 Ultra User-Agent string might now look like if Client Hints headers are not passed to the web server:
As you can see, information about the specific model and browser version are no longer available, making it difficult to determine much about the device at all (access our resources on User-Agent Client Hints and the new landscape change here).
The technique of User-Agents' masquerading started in the very early days of Internet browsing. Below are two User-Agent strings originating from the mid-1990s:
Netscape Navigator 2, code named Mozilla, was the dominant browser at the time and offered more features than IE 3. Instead of adjusting websites to IE's limited capabilities, web developers often blocked users completely. In response to this, Microsoft made the decision that the early version of Internet Explorer would introduce itself as Mozilla to ensure end-users could view the content and to help the new browser grow its market share. Over time, other browsers adopted the same approach as a form of 'browser sniffing' and Mozilla quickly became a staple in any User-Agent string.
As seen above, legacy terms that were used 20-30 years ago are still present in User-Agents today.
Device detection must be based on User-Agent Strings and other HTTP headers
A device-aware content adaptation strategy including smartphones and tablets requires device identification to be carried out and doing some analysis of User-Agent strings.
Although searching for keywords in User-Agents can look like a reasonable approach to device detection, it certainly won’t return any accurate results for the reasons explained earlier in this article.
For example a User-Agent string that contains the keyword 'iphone' doesn't necessarily mean the requesting device is really an iPhone. To accurately detect a device you need to analyse every aspect of the user-agent as well as other HTTP headers, and not just keywords. This is especially important if you require some fine-grained targeting, such as language and locale.
This is why sophisticated device intelligence solutions are utilized to ensure accuracy and speed of detection.
You can test DeviceAtlas's capabilities by following the steps below:
Search online for User-Agent string examples, or search for any device using our Device Browser (e.g. iPhone 14) and copy its User-Agent (you can find it at the bottom of the device page – create a an account to do this).
- Head over to the User-Agent Tester and paste the User-Agent string. Click the result to find out what DeviceAtlas says about the selected device.
Try pasting more User-Agent strings to check the User-Agent Tester and learn about the DeviceAtlas’ accuracy.
Get started with a local device detection trial
DeviceAtlas is a high-speed device detection solution used by some of the largest companies in the online space to:
- Optimize UX and conversion rate on mobile
- Boost web performance
- Target ads and analyze web traffic
- Enable App analytics and advertising insights
Get started with a locally-installed trial to test DeviceAtlas at no cost.