Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the 1x1 pixel image technique a good way to capture analytics data cross-domain?

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 generates a 1x1 pixel image request to the server. The request contains GET attributes with the data I want to capture (which 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?

like image 532
Mads Mogenshøj Avatar asked Aug 06 '10 22:08

Mads Mogenshøj


1 Answers

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.

like image 149
David Avatar answered Oct 22 '22 02:10

David