Sign up below to view device data and get your trial account.

We communicate via email to process your request in line with our privacy policy. Please check the box to give us your permission to do this.


User-Agent parsing made easy

User-Agent parsing allows you to identify devices accessing web content due to the fact that a User-Agent string conveys information to the server about the source of the request. If you’re looking for a simple and reliable way for parsing User-Agent strings, you’ve come to the right place. This article provides you with an overview of UA parsing and information on how to implement it.

Why User-Agent parsing is problematic

The User-Agent (UA) string is one of the headers defined in the HTTP standard which says that it’s generally used for identifying the origin of the request sent to the web server. The standard doesn’t really specify the details on how UAs should be built. Here’s what it says about requirements related to the UA field:

“Although it is not required, user agents should include this field with requests. The field can contain multiple product tokens (Section 3.7) and comments identifying the agent and any subproducts which form a significant part of the user agent. By convention, the product tokens are listed in order of their significance for identifying the application.”

This excerpt highlights the fact that the rules for creating UAs are extremely superficial given that only vague “product tokens” are mentioned as possible components of a UA. In fact, browser makers and device manufacturers are free to conceal some important information or even build nonsensical UAs. Here is an example of a UA string which is sent by an IE Mobile browser used on a Windows Phone-based device:

Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; Microsoft; RM-1141) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537

There are many keywords included in this UA which aren’t related to a Windows Phone device or the IE Mobile browser, such as “Mozilla”, “Android”, “iPhone”, “Mac OS X”, or “Mobile Safari”.

The information included in the UA can’t be analyzed simply by searching for keywords because it will return inaccurate results. To accurately detect devices requesting online content, you need a sophisticated mechanism for parsing information included in the UA header that can actually detect patterns and look them up in a highly accurate, comprehensive, regularly updated device database.

Get access to a free, trial version of DeviceAtlas.

Start Your Free Trial Today

User-Agent parsing using a dedicated API

The best option for businesses looking to implement a User-Agent parsing method is to use a dedicated third-party device detection platform, such as DeviceAtlas. This works especially well for high-traffic, high-profile websites and other online services such as ad platforms or web analytics tools.

You will usually have two options for a User-Agent parser including cloud-based and a locally-deployed solution.

The Complete Guide To User Agents.

Download our free e-book on User Agents to learn:

  • What is a User Agent?
  • How do you parse them?
  • What can you do with them?

Download the Free Guide

1. Cloud-based User-Agent parsing

With cloud-based detection, device data is provided on-demand for device headers analyzed through the cloud API. To implement cloud-based detection in your website you need to drop a code snippet into your website’s code. The UA parsing service adds the capability of identifying and handling traffic from any device to your website via an up-to-date database of all the latest devices.

2. Locally-based User-Agent parsing

Some of the largest businesses avoid any dependency on cloud services, and thus utilize locally installed device detection platform.

To implement locally-installed detection you need to download a device data file from your detection provider and deploy the provider’s API in your environment. In DeviceAtlas’s case, the device data is available in a highly compressed JSON format minimizing the server footprint. It can either be downloaded manually or obtained via an automated script. The data file consists of a JSON structure offering extremely fast lookups with a minimal footprint.

You can check User-Agent parsing implementation examples here. It is best to set automatic downloads for the data file to ensure that device data is up-to-date.


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.

Get started