When we detect these items for visitors:
- Browser name
- Browser version
- OS name
- OS version
- Screen resolution
- Screen depth
- Flash enabled
- …
Should these all be stored in the database in separate columns or should I be storing it all as a user agent string and then breaking it down in the application?
And should I use varchar(255) for this just to be safe or are there well-defined datatypes for these items? I use MySQL and PHP
It really depends on what you want to do with the information. If you plan to use the data for very detailed statistics, use separate columns so you can run detailed queries like “show all screen resolutions for users with Internet Explorer 6” and such.
If you don’t expect to need such detailed statistics, storing the user agent string in one field will usually work fine.