logging user visit

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Francis Dhaenens

    logging user visit




    I am building an ASP application, in this application, one of the
    functions is that I have to know exactly how long a user has used a
    certain page of the application. so I need a way to long the time a user
    enters a page and when he leaves again.

    the problem is when the user closes the browser, no time for leaving is
    recorded...

    Is there a way to run a web service that can read cookies of all the
    users and write them to a database? Or am I looking too far for the
    solution.

    I'd like a clean solution, not with popups, or opening other windows in
    order to run extra asp code..

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • Pete

    #2
    Re: logging user visit

    You could trap this *sometimes* by writing some javascript in your
    pages, trapping the onBeforeUnload event and maybe posting something to
    your server then.

    But there are ways the user can get past this, e.g. physically bringing
    down the connection before they close the browser (disconnecting the
    phone line if its a dialup connection), or even (a bit extreme!) just
    switching the machine off at the wall without exiting anything.

    I'm fairly sure there is no 100% reliable way to achieve what you want.
    You can only really record when the user comes back to your site.

    HTH,
    Pete


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

    Comment

    • CJM

      #3
      Re: logging user visit

      The most common approach I have come across is to track each time someone
      requests a page and record it in a db. Any entries less than 20 mins old
      (for default time-out settings) are considered 'live'. That is, if you can
      just accept that you are potentially 20 minutes out-of-date when you query
      the DB, life is a lot easier.

      As Pete has stated, there is currently no guarranteed way of tracking your
      users accurately.

      I'm not sure if this is helpful to you... Why are you trying to track the
      length of time they are on your site? Is it for billing for a provided
      service? Or just for your information?

      If it just informational, then my method may well be OK. If you need to be
      more accurate, I think you will be disappointed..

      hth

      Chris


      "Pete" <anonymous@devd ex.com> wrote in message
      news:OwhxGcJnDH A.2500@TK2MSFTN GP10.phx.gbl...[color=blue]
      > You could trap this *sometimes* by writing some javascript in your
      > pages, trapping the onBeforeUnload event and maybe posting something to
      > your server then.
      >
      > But there are ways the user can get past this, e.g. physically bringing
      > down the connection before they close the browser (disconnecting the
      > phone line if its a dialup connection), or even (a bit extreme!) just
      > switching the machine off at the wall without exiting anything.
      >
      > I'm fairly sure there is no 100% reliable way to achieve what you want.
      > You can only really record when the user comes back to your site.
      >
      > HTH,
      > Pete
      >
      >
      > *** Sent via Developersdex http://www.developersdex.com ***
      > Don't just participate in USENET...get rewarded for it![/color]


      Comment

      • Tim Williams

        #4
        Re: logging user visit

        Have some client side js (assuming it's enabled) make a request for an image
        from your server every x minutes, or faster if you need more resolution in
        your timings. Put the page name in the img url as a querystring and log it
        in a db.

        Tim



        "Francis Dhaenens" <fran@pointx.be > wrote in message
        news:OPGIh3HnDH A.2652@TK2MSFTN GP09.phx.gbl...[color=blue]
        >
        >
        >
        > I am building an ASP application, in this application, one of the
        > functions is that I have to know exactly how long a user has used a
        > certain page of the application. so I need a way to long the time a user
        > enters a page and when he leaves again.
        >
        > the problem is when the user closes the browser, no time for leaving is
        > recorded...
        >
        > Is there a way to run a web service that can read cookies of all the
        > users and write them to a database? Or am I looking too far for the
        > solution.
        >
        > I'd like a clean solution, not with popups, or opening other windows in
        > order to run extra asp code..
        >
        > *** Sent via Developersdex http://www.developersdex.com ***
        > Don't just participate in USENET...get rewarded for it![/color]


        Comment

        Working...