5

As web browsing continues to change due to apps with "web view" widgets, tablets, etc., I want to track hits to my website based on browser-type so I can proactively tailor content and presentation.

When I examine a small handful of web browsers from iPad, Android, Macbook, iPad and others, it appears that the userAgent is simply the appCodeName concatenated with appVersion.

Is that always true? Can I rely on it for presentation (i.e., CSS) decisions?

Any other issues to consider?

mobibob
  • 8,670
  • 20
  • 82
  • 131
  • You can't rely on it (easily spoofed). – Knu Apr 24 '11 at 21:59
  • OK. But this application usage should be tolerant as I am not looking for count (although interesting, there are better analytics for that), just an early warning of new technology visiting and if the spoofed value doesn't really exist, it will be readily apparent and ignored. Having said that, I totally agree for more important usage that would be a bad attribute. – mobibob Apr 26 '11 at 03:01

1 Answers1

2

I think it's better to use a browser detection mechanism like WURFL(Wireless Universal Resource File). This is an XML file (and now a DB file) and various DBI libraries that not only contain up-to-date wireless user-agent data, but also what features and capabilities those user-agents support.

And Detect Mobile Browser that do this in Apache, ASP, ColdFusion, JavaScript and PHP.

Faraz Kelhini
  • 3,925
  • 32
  • 38