1x1 像素图像技术是跨域捕获分析数据的好方法吗?
我看到许多网络分析应用程序使用 JavaScript 来捕获客户端网站上的数据,然后将其发送到中央服务器进行处理/存储/演示。
出于类似的目的,我一直使用 JavaScript 代码片段来向服务器生成 1x1 像素图像请求。该请求包含 GET
属性以及我想要捕获的数据(大小可能有所不同)。该请求每天可能会在数千个网站上生成数百万次(并且在每个网站上生成多次)。
1x1 像素图像是 00 人的做法吗?
在处理具有数千个客户端网站的应用程序时,替代跨浏览器技术(JSONP 或其他)是否足够成熟以取代它?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为 1x1 像素的持续流行是因为世界各地的每个网络浏览器(好吧,不是 Lynx 或任何关闭图像的浏览器,但不要告诉营销人员这一点)都请求图像。 “更酷”的做事方法还没有那么普遍。
解决方案越复杂,涉及的代码越多,您就越会遇到设置为“偏执”的浏览器,而这些浏览器不会执行代码。就目前情况而言,JavaScript 可能不会被执行。将 1x1 像素放入纯 HTML 中会更通用。
还有一个事实是,同样的方法可以轻松扩展以包含 cookie 数据。这是标准 Web 请求,因此适用 cookie。
归根结底,从开发角度来看,这并不总是“最佳”解决方案。 Web 开发通常涉及共同点,并为尽可能多的访问者工作,包括访问者不知道它在做什么的事情。
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.