Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How do I detect a user leaving the site?

Reply
Thread Tools

How do I detect a user leaving the site?

 
 
Andy
Guest
Posts: n/a
 
      04-28-2008
As per the question really.

Not trying to stop them leaving, but just detect WHEN they leave the site

 
Reply With Quote
 
 
 
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      04-28-2008
You can set up JavaScript on a page, but you will have to make it elaborate
enough to distinguish page unload from page unload to another site. This is
how sites that try to get you to download trojans work, popping up a modal
popup when the user leaves a page, except they do it on any unload.

Storing that they have left will require an AJAX like solution, as you will
have to have the JavaScript contact the server.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

*************************************************
| Think outside the box!
|
*************************************************
"Andy" <> wrote in message
news:ACD6882F-B1B0-4D59-A5B7-...
> As per the question really.
>
> Not trying to stop them leaving, but just detect WHEN they leave the site
>



 
Reply With Quote
 
 
 
 
George Ter-Saakov
Guest
Posts: n/a
 
      04-28-2008
Due to disconnected nature of the Web applications it's a bit hard (and
always not reliable).

First you need to define for yourself "exit time".
Then you need to define precision. For example "We need 1 hour timeframe".
Meaning that if user left 8:50 and we detected it by 9:00 then we fine... .
-------------------------------------------------
Here are some thing you can test if they going to work for you.

1. You can get last time user has requested anything from your site. And
call it your "exit time". Basically update exit time everytime user had send
a request to aspx. At the end when user closes the browser you will have
last "exit time".

Problem: if user requested page "article.aspx" and then sitting there
reading it for 30 minutes and then closes browser you will have exit time 30
minutes before user actually closed the browser...

But this comes does to definition of what is "exit time".

2. To reduce lag time specified in #1 you can have a JavaScript that would
refresh a tiny image on your page every minute. then if user looked at your
page for 30 minutes you will have exit time within one minute range...

But this comes down to the precision... And obviously will have a problem if
JavaScript is disabled.

Check out this on how to do that with an image...
http://www.codeproject.com/KB/aspnet...onForever.aspx


----------------------------------------------------

George.


"Andy" <> wrote in message
news:ACD6882F-B1B0-4D59-A5B7-...
> As per the question really.
>
> Not trying to stop them leaving, but just detect WHEN they leave the site
>



 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      04-28-2008
there is no surefire way. the most common is a lightweight ajax call on page
unload (which will fire on every page referesh), then run a timer on the
server to detect that the user did not return to the site. you can also use a
session timeout for this (20 minutes of no site hits).

-- bruce (sqlwork.com)


"Andy" wrote:

> As per the question really.
>
> Not trying to stop them leaving, but just detect WHEN they leave the site
>

 
Reply With Quote
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      04-28-2008
Client side JavaScript is the most surefire, but one can easily circumvent
it by killing the browser. LOL

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

*************************************************
| Think outside the box!
|
*************************************************
"Mark Rae [MVP]" <> wrote in message
news:%...
> "Andy" <> wrote in message
> news:ACD6882F-B1B0-4D59-A5B7-...
>
>> Not trying to stop them leaving, but just detect WHEN they leave the site

>
> As per the other replies, there is no 100% reliable way of doing this...
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Warn user before leaving page with unsaved changes markalroberts@gmail.com ASP .Net 7 02-28-2011 08:37 PM
Detecting user leaving page daveh551 ASP .Net 4 08-06-2008 06:51 PM
Is there a way to tell if a user is leaving the page? Chris Roden ASP .Net 4 12-13-2007 07:51 PM
Cannot log out user when leaving and coming back to app Sacha Korell ASP .Net 6 03-09-2005 04:23 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57