Knowing when the Alexa Toolbar visits

Since my last posting about the relevancy of Alexa rankings I've had some questions about detecting when the Alexa Toolbar is being used. It's really quite simple, actually, if you're web server is logging the right information.

You see, most browsers send what is called a user agent string to the web server whenever they request a page from the web server. The user agent string is meant to identify the “user agent” (the browser, who is acting as an “agent” for the user) to the web server. The web server can use this information in different ways, perhaps by serving up different content formatted for different browsers.

[Note: There are actually better ways of doing that than relying on the user agent string, but let's not get too technical here. If you really want to know the details, see my articles Masquerading Your Browser and How to Detect Internet Explorer.]

Browsers are not required to send a user agent string, and for privacy reasons some people turn them off. Some browsers even send different user agent strings to masquerade as a certain kind of browser — this often happens when you want to visit sites with Firefox/Mozilla/Opera that have been “designed for Internet Explorer only” and are obnoxious about it. Non-browsers often send user agent strings: web crawlers like the Googlebot or the Mediapartners crawler identify themselves with a user agent string. In fact, using the user agent information to figure out when Google is crawling your site is infinitely more useful than figuring out when the Alexa Toolbar is being used.

Anyhow, browsers with the Alexa Toolbar installed include the phrase “Alexa Toolbar” in their user agent string. So all you need to do is configure your web server to include user agent information in the log files it generates. What's a log file, you ask? A log file is basically just a text file to which the web server writes (”logs”) important information. Things like what pages are being accessed at what times. If you're lucky, your log files should already be tracking this information. If not, you'll have to consult your web server documentation (or ask your web hosting service) for instructions. (If you're running a blog using a free service and you don't have access to those logs, then there's not much I can do to help you, sorry!)

And if you're curious about the user agent string your own browser is sending, visit my web browser header viewer page to see what exactly my web server knows about your web browser.

Socialize This Post (Please!)

Add to OnlywireAdd to Onlywire

Tags

Comments

Comments are closed.

Subscribe without commenting