最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin2浏览0评论

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?

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?

Share Improve this question edited Apr 19, 2011 at 1:24 sawa 168k49 gold badges286 silver badges396 bronze badges asked Aug 6, 2010 at 22:20 Mads MogenshøjMads Mogenshøj 2,0681 gold badge16 silver badges23 bronze badges 1
  • Well I'd like for you to update me (at least, but all of us) on did you go with this solution and your answers as to why. That would be great. – pjammer Commented Jul 31, 2012 at 12:02
Add a ment  | 

1 Answer 1

Reset to default 19

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 plicated 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 mon denominator and working for as many visitors as possible, including the stuff the visitors don't know it's doing.

发布评论

评论列表(0)

  1. 暂无评论