是否可以判断用户是否浏览了页面的一部分?
正如网站上的标题所示,是否可以判断用户是否查看了页面的一部分?
As the title says on a website is it possible to tell if a user has viewed a portion of the page?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
将该部分移动到单独的 iframe 可以吗? 然后如果他们滚动到底部,发出一个小图像文件的 get 请求..忘记了该技术的名称..
更新:它被称为 Web Bug..Web Bug 是嵌入网页或电子邮件中的对象,通常对用户不可见,但允许检查用户是否已查看该页面或电子邮件。 一种常见用途是电子邮件跟踪。 替代名称包括网络信标、跟踪错误、跟踪像素、像素标签、1×1 gif 和透明 gif。
Will moving that portion to a separate iframe work? then if they scroll to the bottom, issue a get request for a small image file..forgot the name of the technique..
Update: It is called Web Bug..A Web bug is an object that is embedded in a web page or e-mail and is usually invisible to the user but allows checking that a user has viewed the page or e-mail. One common use is in e-mail tracking. Alternative names are Web beacon, tracking bug, tracking pixel, pixel tag, 1×1 gif, and clear gif.
如果您要检查用户是否确实查看了页面的某些部分,您将需要安装网络摄像头并跟踪他的眼球运动。
如果您正在谈论检测用户向下滚动页面的距离,您可以使用 Javascript 在 OnScroll 事件中检测这一点。 如果需要记录的话,您可以向服务器触发一些 ajax。
If you are talking about to check if the user has actually viewed some part of the page you would need to install a web camera and track his eye-movement.
If you are talking about detecting how far the user has scrolled down the page, you can use Javascript to detect this in the OnScroll event. You can then fire some ajax to the server if you need to record this.
除非您需要某种类型的用户操作,否则您只能知道他们下载了某些部分,而不是他们实际查看了它。
Unless you require a user action of some kind, all you will be able to tell is that they downloaded some portion, not that they actually looked at it.
当然。 将该内容放入 div 中,然后在 html 中使用一些 javascript 捕获 onmouseover 事件并在那里完成您的工作。 如果他们将鼠标放在某物上,那么可以肯定他们已经看到了它,我想说......
希望这会有所帮助。
Sure. Put that content inside a div, then in your html, with some javascript, capture the onmouseover event and do your work there. If they've put their mouse over something, it's a pretty safe bet that they've seen it, I'd say...
Hope this helps.
不可靠,不。
简单的示例:我用鼠标中键单击链接,这会在新的后台选项卡中将其打开。 然后我决定不这样做,并没有看它就关闭了选项卡。 任何 JavaScript 技巧都会报告我查看了首屏上的所有内容。
更复杂的示例:新手用户没有最大化浏览器窗口,并且浏览器窗口的一部分位于屏幕外。 任何 JavaScript 技巧都会报告好像正在查看整个视口,因此即使将查询限制为仅发生滚动的情况也无济于事。
Not reliably, no.
Simple example: I middle-click on a link, which opens it in a new background tab. I then decide against it, and close the tab without ever looking at it. Any JavaScript trick is going to report that I viewed everything above the fold.
More complicated example: A newbie user doesn't have the browser window maximised, and a portion of the browser window is off-screen. Any JavaScript trick is going to report as if the entire viewport is being viewed, so even restricting your query to only the cases where scrolling occurs will not help.
我不确定这是否道德 - 但从技术上讲,如果您使用 javascript,您可以检测文档中每个段落标记的鼠标悬停事件,然后将该信息 AJAX 返回到服务器。 当用户向下滚动页面时,他们可能会将鼠标悬停在段落上,然后您至少知道他们读到的位置。
I'm not sure this would be ethical - but technically if you use javascript, you could detect the mouseover event of each paragraph tag in the document, and then AJAX that information back to the server. As the user scrolls down the page, they're likely to mouse over the paragraphs, and then you know at least approximately where they've read to.