473,503 Members | 1,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A Server call using onUnload

Hi all,
I'm trying to create a server side log, that will show how much time a
user was present on my web page.

I tried using onUnload and onBeforeUnload to do an http call to the
server.
I've noticed that the call pass to the server is not consistent.

Q:Is there a better way of logging the time user spent on my page
before leaving it?

P.S: currently I'm using an Interval call each 5 sec that logs that the
user is still there.

thanks

Dec 22 '05 #1
3 1849
The call pass will never be consistent. The network/power on the user
side may go down, the user may close/kill the browser window, the user
may turn off javascript (especially if seeing the page calls home every
5s), the network may be slow enough that the call won't be forwarded
before the page is unloaded fully etc. There are things you simply
can't prevent.

An idea I have would be possibly a hidden frame that monitors the
webpage, survives the user following a link, reports the case the page
has been closed and then closes itself gracefully. Of course this
introduces a range of problems that would have to be adressed and some
that can't be addressed. Personally I doubt it can be done reliably
over HTTP.

Dec 22 '05 #2
You can make something using the idea of a chat where you have a
timeout solution...

When the user access your site for the first time (you can use the
session id or ip...), you can fill into the database the current
datetime and a timeout... And in *every* page call you should refresh
this timeout...
Whenever the user gets timed out (for example, after 1 hour of
inactivity), you could set the time he spent on your site...

Another way to do it, is by analyzing the web server log, there you can
check the first ocurrence of the ip on a certain date and make a diff
between it and the last ocurrence...

I would use a 3th party tool like awstats ;]

But if you want to do it on your own, it's ok, good luck :)
--
"Invente, Tente!!! Faça um código eficiente" (Jonas Raoni)

Jonas Raoni Soares Silva
---------------------------
jonasraoni at gmail dot com
http://www.jsfromhell.com

Dec 22 '05 #3
On 2005-12-22, sh*************@gmail.com <sh*************@gmail.com> wrote:
Hi all,
I'm trying to create a server side log, that will show how much time a
user was present on my web page.
If they save their page to their hard disk does that count as infinite time?

ISTM you are trying to measure the unmeasurable.
I tried using onUnload and onBeforeUnload to do an http call to the
server.
I've noticed that the call pass to the server is not consistent.
if they close the tab or turn off their modem there is no unload.

if they minimise the window, switch to another tab, or leave the room
are they still "present"
Q:Is there a better way of logging the time user spent on my page
before leaving it?
convince them to install your logging software on their PC :)
P.S: currently I'm using an Interval call each 5 sec that logs that the
user is still there.


it'll tell you the page is still open, nothing more.

Bye.
Jasen
Dec 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3653
by: Jane | last post by:
Hello, I get the error Error Occured Reading Records: Server has not yet been opened. when I am trying to view a report using the asp pages for crystal reports. It works fine for access files....
6
15879
by: kaeli | last post by:
Hey guys, This error occurs ONLY in Netscape 7.0. Not in 7.1. So, I think it's a bug. Buuuut... Has anyone had this problem or know of a fix? When attempting to have an onunload function...
13
1534
by: M B HONG 20 | last post by:
Hi all - I have a .NET web service running on a remote machine, and I have Netscape Navigator 7.0 accessing it through javascript on the client side through SOAP javascript coding. Everything...
5
9001
by: jensen bredal | last post by:
Hello, I attended a seminar with scott gu. Microsoft asp.net lead guru, and he mentioned some advanced javascript that let you display an animation while your page is waiting for response from...
1
1067
by: Just D. | last post by:
All, Does anybody know how can I simulate the button click from the JavaScript on ASPX page? Here is the fragment of the ASPX page with a simple JavaScript allowing me to do something before the...
2
5735
by: M B HONG 20 | last post by:
Hi all - I am developing an ASP.NET (C#) application and need some help. I wish to call a server-side function (in the code-behind "file.aspx.cs") upon a user clicking on the "X" to close the...
4
4861
by: babu17 | last post by:
hi, i want to fire an event onunload. in the function for the event i want to use an object created by ASP's server.createobject. eg: <%@language = vbscript%> <% set obj1=...
3
1589
by: Ricardo Vazquez | last post by:
Hi! I have a new problem with this SCENARIO I already described in a previous post: - PBX (a private telephone exchange or switch) - A Telephony Server Application running on computer "A" (it...
3
7351
by: Jimmy | last post by:
It is also possible for popup window to call function in main window by using the opener property. Will "opener.someFunctionInMain(param1, param2)" in the popup window work? It's possible for...
0
7282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6995
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7463
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5581
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5017
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3157
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1515
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
389
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.