Easy User Agent Storage - UserAgentDB.com

by Gregg Hilferding

The itch

As a web developer, I often store user agent information in logging tables. Many user agents are the same, or similar, and they all take up a large amount of space in tables. And, typically, it is not incredibly useful information.

Why store it at all? Well, when it comes time to understand why just these three users are having the same kind of problem, it is incredibly helpful to know what browser they were using at the time. Users don't always know their user agent and they shouldn't have to. After all, it's up to the developer to get things working.

So, as my body of programming work expands I see a lot of duplication. I store these user agent strings all over the place. When it comes to database design, I cringe over duplicated data. Sure, I started a single table of user agents on one of my servers, but I wanted to be able to use that data on other servers too.

Rather than build a tiny little service for myself, I'd rather build a public service. It strikes me as more elegant to store all these silly strings in one place on the internet rather than in millions of places.

The solution

  1. A single database that stores every user agent string and can produce a unique identifier instantly.
  2. Services that can provide the data in useful formats.
  3. A public database that anyone can download for their own site.

The method

Initially, you can send a request to either of two urls to either get an id for a user agent string or to get the user agent string for a corresponding id.

Examples of retrieving an id:

Test the output using these forms:

To get an id for a user agent:

To get the user agent string for a corresponding id:

All rights reserved. © 2008 Gregg Hilferding (While I sort out what license it should actually be under.)