locked
How many Times users spend in my site? RRS feed

  • Question

  • User-1122077206 posted

    Guys,

    I need to save how many times (seconds / minutes) each user spend in my site from his enterance to my site till exit it. How can I do this?

    Saturday, January 29, 2011 12:38 AM

Answers

  • User2019981500 posted

    Hi,

    In case you didn't know Above Techniques Then, IIS (Internet Information Server), as with most Web servers, keeps a very thorough record of every request made against it. Each time a page or an image is requested a new record is added to the log file. We know that tracking visitors and customers on our Web sites is important, but what kind of information can we learn from them? People often talk about how many hits they get on their site; however, this isn't very instructive without some additional information to accompany it.

    article by Wayne Plourde that explains how to track web pages in ASP.NET Along with source code download

    NEXT OPTION IS

    Then you can use session to track users like done here

    Track your users with session objects


    Regards

    SHABIR


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, January 30, 2011 5:52 AM

All replies

  • User2019981500 posted

    Hi,

    You can see table structure from <cite>dotnetslackers.</cite>

    This article is available along with source code/explaination

    Tracking User Activity

    Figure 1: The ActivityLog table models the activity log.

    The ActivityLog table models the activity log.

    Regards

    shabir

    Saturday, January 29, 2011 6:33 AM
  • User-693248168 posted

    Hi,


    You can achieve this in this way.

    1. Create a new SessionVariable as soon as the user logs in. Save the timestamp .

    eg. Session["LogginTime"]=DateTime.Now;

    2. In your global.asax page, there is a method called On Session Timout

    In this method find the time span the user was logged in.

    TimeSpan ts=DateTime.Now-(DateTime)(Session["LogginTime"]);

    ts.TotalMinutes --> will give you the overall time spent by the user on the site.

    3. In your logout button click, put the same code as in (2) to find out the time spent.


    Also note that if the user does not log out and directly closes the window, then his session will timeout after the default timeout specified in web.config file.


    So you can say that the time spent has an error margin of +SessionTimeOut duration

    Saturday, January 29, 2011 6:34 AM
  • User-1122077206 posted

    Thanks shabirhakim, I know its db structure, I mean server side codes to achieve the time

    Thanks lateef, But I mean  anonymous users that visit my site note registerde user.

    Sunday, January 30, 2011 12:03 AM
  • User2019981500 posted

    Hi,

    I have also provided url/link of article along with source code/explaination.click on below link and see server side codes

    Tracking User Activity

    Regards

    shabir

    Sunday, January 30, 2011 1:00 AM
  • User510401362 posted

    With the help of google analytics you can do the same thing.

    Sunday, January 30, 2011 1:52 AM
  • User-1122077206 posted

     Yes, it seems the best way while I need to tracking my users with my own codes

    thanks

    Sunday, January 30, 2011 2:31 AM
  • User-693248168 posted

    The only other option I can think of is Cookies.

    Set a cookie for you users.

    Store useful information in those cookies. 


    Sunday, January 30, 2011 5:39 AM
  • User2019981500 posted

    Hi,

    In case you didn't know Above Techniques Then, IIS (Internet Information Server), as with most Web servers, keeps a very thorough record of every request made against it. Each time a page or an image is requested a new record is added to the log file. We know that tracking visitors and customers on our Web sites is important, but what kind of information can we learn from them? People often talk about how many hits they get on their site; however, this isn't very instructive without some additional information to accompany it.

    article by Wayne Plourde that explains how to track web pages in ASP.NET Along with source code download

    NEXT OPTION IS

    Then you can use session to track users like done here

    Track your users with session objects


    Regards

    SHABIR


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, January 30, 2011 5:52 AM
  • User1867929564 posted

    give a try to Lateef045's first post.
    Also you can maintain individual page hit data

    I hv no idea about 
    google analytics.any example ?

    Wednesday, February 2, 2011 5:28 AM