Statcounter is a web analytics service. Our tracking code is installed on more than 1.5 million sites globally. These sites cover various activities and geographic locations. Every month, we record billions of page views to these sites. For each page view, we analyse the browser/operating system/screen resolution used and we establish if the page view is from a mobile device.
From the FAQ:
So yeah, they’re basing of browser user agents.