ASP.NET中如何获取访问者的停留时间

发布于 2024-09-26 06:53:20 字数 56 浏览 0 评论 0原文

我使用的是asp.net 2.0。我的项目中有 5 个网页。我想计算 访问者查看页面的时间长度。

I am using asp.net 2.0. I have 5 web pages in my project. I want to calculate the
length of time for which visitor view the page.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

总以为 2024-10-03 06:53:20

跟踪系统概述:

  1. 服务器端:当访问者请求页面时,生成一个唯一的 ID 并将其包含在页面中。将唯一 ID 与用户、页面以及您希望跟踪的任何其他信息一起保存。
  2. 使用 javascript 的客户端:当 window.onunload 触发时,向服务器发送 ajax 调用,表明用户已完成由唯一 id 标识的页面。查找步骤1中保存的id,更新访问时长。

或者,使用 Google Analytics 之类的工具,它在跟踪访问者方面做得非常出色。

Outline for a tracking system:

  1. Server-side: When the visitor requests the page, generate a unique id and include it in the page. Save the unique id with the user, page, and any other information you wish to track.
  2. Client-side using javascript: When window.onunload fires, send an ajax call to the server to say the user has finished with the page identified by the unique id. Looking up the id saved in step 1, update the length of time visited.

Alternatively, use something like Google Analytics, which does a stellar job of tracking visitors.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文