I am curious as to how companies are able to track the number of unique visitors to other people's sites. Seems like an impossible task to me. Any ideas?
People agree to anonymously share their browsing habits with these companies in return for perks, such as toolbars and analytics packages. The companies use these habits and mine data from other sources (e.g. other companies like them) to build an estimate of traffic flow.
From Alexa's about page:
The traffic rank is based on three months of aggregated historical traffic data from millions of Alexa Toolbar users and data obtained from other, diverse traffic data sources, and is a combined measure of page views and users (reach).
From Compete's homepage:
Compete's data comes from a statistically representative cross-section of 2 million consumers across the United States who have given permission to have their internet clickstream behaviors and opt-in survey responses analyzed anonymously as a new source of marketing research.
W3Spy has a similar Firefox and Chrome extension, so they probably use this to gather data in addition to other sources such as Google Trends and competing services.
In short, none of these sites track total unique visitors; instead, they track a small proportion of visitors whose data they have access to, then try to guess the bigger picture based on third party data and an algorithm they each fine tune over time. As a result, alexa and compete traffic data isn't a completely accurate representation of traffic; it's a (nearly) blind best guess.
They can't actually track the exact numbers with the level of precision that the owner of the site can. I'm not sure about w3spy.net but Alexa uses a panel to sample a subset of users then combines it with other sources of data to guesstimate the full number. I know that this is also done by other similar companies such as Quantcast and ComScore.
Panels consist of users that are willing to let such companies track their browsing capabilities. This is usually done with a browser plugin, commonly a toolbar. The numbers need to be taken with a pinch of salt given that the samples might not always be representative of the whole population.