views:

168

answers:

1

Hi,

I see many web analytics application and otherwise use javascript to capture data on a client website, and then send it to a central server for processing/storage/presentation.

For a similar purpose I've been using a javascript snippet which generate a 1x1 pixel image request to the server. The request contains GET attributes with the data i want to capture (can vary in size). This request may be generated millions of times per day, across thousands of websites (and multiple times on each website).

Is the 1x1 pixel image the 00's way to do it?

Are alternative cross-browser techniques (JSONP or others) mature enough to replace it, when dealing with an application with thousands of client websites?

+11  A: 

I think the continued popularity of the 1x1 pixel is because every web browser everywhere (well, not Lynx or any browser that has images turned off, but don't tell the marketing folks about that) requests the image. The "cooler" methods of doing stuff aren't as universal just yet.

And the more complicated and code-involved the solution, the more you're going to run into browsers set to "paranoid" that won't execute the code. As it stands now that JavaScript might not get executed. Fitting that 1x1 pixel into the plain HTML would be more universal.

There's also the fact that this same method can easily be expanded to include cookie data. It's a standard web request, so cookies apply.

At the end of the day, it's not always about the "best" solution from a development perspective. Web development is often about the common denominator and working for as many visitors as possible, including the stuff the visitors don't know it's doing.

David
Great answer, thanks :)
Mads Jensen
Thanks, and go ahead and click that "accept" button :)
David