Measure Connection Type

Determine whether your visitors use modems or broadband connections, and support critical site design decisions.

One of the most common questions asked of web measurement applications regarding site performance is, “How can I tell how my visitors connect to the Internet when they’re coming to my site?” This question gets asked most often when companies are trying to make design decisions about page size, use of multimedia and Flash, and whether or not to deploy weighty tracking code.

High-end geographic reporting

Figure 5-3. High-end geographic reporting

Many web measurement vendors attempt to provide this information using an obscure hack, the fact that IE users self-report how they connect to the Internet, and that this information is available via the JavaScript document object model. You’ll commonly see reports called “Connection Type” that provide percentage of visitors using “LAN,” “modem,” and “unknown” or “other” types of connections (Figure 5-4).

While these reports are moderately useful, especially considering they come with no additional setup hassles, you can use some relatively simple JavaScript to build a much more complete report using custom variables.

The Code

The following code has been written in JavaScript, which is pretty much your only option since it needs to run in the visitor’s web browser to test how long it takes to download an image.

The essence of this hack is as ...

Get Web Site Measurement Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.