So there are websites that send the following information to their servers: screen.width = x, screen.height = y? And on the basis of those data the servers compile their statistics? And how exactly would the sites send that code snippet to the servers?
AJAX, I would imagine.
It would be quite simple to fire off a small AJAX request containing any relevant user statistics when the page loads.
img = new Image();
img.src = 'process.php?height=' + screen.height + '&width=' + screen.width;
img = undefined;
That runs process.php on the server passing it the width and height of the screen that the browser is displayed on.
Most scripts would use a lot more code than that because most people don't realise that if you are just sending data from the web page to the server and don't need a response back that you can do it this way and only need three lines of code to pass as much information to the server as needed.
Agreed, Dave, it would. But who has such an AJAX script on their site? Have you or anyone you know ever received a request from anyone to include such a script somewhere in the code so that the servers can collect resolution data? And to you the same question, Stephen.
I must admit, no I haven't.
I think most people who are interested in such things would use Google Analytics.
Pullo has answered Frank's question. Anyone using Google Analytics (or any other similar script that captures statistics about visitors) has a script in their page that captures such data.
I can't see any reason why anyone would bother to write code to do it themselves rather than to use a script such as Analytics that does it for you.
That's a neat trick felgall and I must confess I didn't know it before, so thanks for sharing
However, saying that, I was vaguely aware that some companies use images in HTML emails to find out if people read them (the emails that is), so I guess this would be a similar tactic, as in this case, too, there is no response needed from the server.
OK, but how many years are there between the resolution stats being readily available and the appearance of Google Analytics? At least a number of years. How did servers compile their stats before GA?
The same way that analytics does it - using an ajax call of one type or another. The version I posted above works in any browser that supports images. The more conventional XMLHttpRequest type of call has been available to use since IE4. The XDomain and XHR2 calls that analytics actually uses now have only been added in more recent browsers.
Basically any browser from Netscape 2 on has had the ability to send the information to the server in one way or another.
OK, but who had that script/code snippet included in their code? Not the normal websites, I would think. Or are the statistics based upon the users of search engines like Google?
It used to be really common for web sites to include a counter on their page that displayed how many visitors the site had received. Capturing any stats about the visitors would have been a part of that script. There were literally hundreds if not thousands of different hit counter scripts around for people to choose from. Hardly anyone used search engines back then as they didn't find much in the way of useful results. Directories built by real people were far more popular back then. Google didn't come along until much later.
It used to be really common for web sites to include a counter on their page that displayed how many visitors the site had received. Capturing any stats about the visitors would have been a part of that script. There were literally hundreds if not thousands of different hit counter scripts around for people to choose from.
That sounds plausible. Thanks for clearing it up, Stephen.
This topic is now closed. New replies are no longer allowed.