How can i detect the actions of person visiting my site ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KhannaNeeta
    New Member
    • Feb 2008
    • 3

    How can i detect the actions of person visiting my site ?

    I have seen in this site that you can find out wether the person is online or offline or if he is online on which page he is ? How can I do that for my site ?
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    #2
    Originally posted by KhannaNeeta
    I have seen in this site that you can find out wether the person is online or offline or if he is online on which page he is ? How can I do that for my site ?
    I don't know about this site, but if you have to do something like this.
    • Make a table, say current_activit ies, in the database with three fields, user_id, status and last_activity.
    • When a user logs on to your site, update the status field.
    • Every time a user visits a page, you may be doing a cookie validation thing. While you do that, update the last_activity field.
    • And when a user logs out of your site, turn off the status flag.


    Thats what I can suggest. Actual algorithm may be something else.

    Comment

    • Markus
      Recognized Expert Expert
      • Jun 2007
      • 6092

      #3
      Originally posted by hsriat
      I don't know about this site, but if you have to do something like this.
      • Make a table, say current_activit ies, in the database with three fields, user_id, status and last_activity.
      • When a user logs on to your site, update the status field.
      • Every time a user visits a page, you may be doing a cookie validation thing. While you do that, update the last_activity field.
      • And when a user logs out of your site, turn off the status flag.


      Thats what I can suggest. Actual algorithm may be something else.
      That's good logic, and exactrly how i'd go about it.

      But what if the user doesn't log out and just exists the browser?

      You'd be smart to take the time of the users last activity, and when showing a page which shows said users last activity, check this time in your database with the current time, and if it is greater than, say, 1hour, declare the user offline and update the status accordingly.

      Comment

      • hsriat
        Recognized Expert Top Contributor
        • Jan 2008
        • 1653

        #4
        Originally posted by markusn00b
        That's good logic, and exactrly how i'd go about it.

        But what if the user doesn't log out and just exists the browser?

        You'd be smart to take the time of the users last activity, and when showing a page which shows said users last activity, check this time in your database with the current time, and if it is greater than, say, 1hour, declare the user offline and update the status accordingly.

        Yeah, you are right :)

        Actually I didn't think about in deep. :p

        Then we can also do one change. Instead of status flag, use time only. Don't update the status field with YES or NO, but update it with time. After one hour (or how much required), if user not logged out, declare him logged out. Else if he actually logs out, clear the time.

        Comment

        • Markus
          Recognized Expert Expert
          • Jun 2007
          • 6092

          #5
          Originally posted by hsriat
          Yeah, you are right :)

          Actually I didn't think about in deep. :p

          Then we can also do one change. Instead of status flag, use time only. Don't update the status field with YES or NO, but update it with time. After one hour (or how much required), if user not logged out, declare him logged out. Else if he actually logs out, clear the time.
          Indeedy, doody.

          See what we can do when we work together?
          It's beautiful!

          Comment

          • hsriat
            Recognized Expert Top Contributor
            • Jan 2008
            • 1653

            #6
            Originally posted by markusn00b
            Indeedy, doody.

            See what we can do when we work together?
            It's beautiful!

            Yeah, it is...

            PS: What's doody?

            Comment

            • Markus
              Recognized Expert Expert
              • Jun 2007
              • 6092

              #7
              Originally posted by hsriat
              Yeah, it is...

              PS: What's doody?
              Urm, well... it just rhymes :D

              Comment

              • hsriat
                Recognized Expert Top Contributor
                • Jan 2008
                • 1653

                #8
                Originally posted by markusn00b
                Urm, well... it just rhymes :D

                oh... ok.. thats goody doody!

                Comment

                • Markus
                  Recognized Expert Expert
                  • Jun 2007
                  • 6092

                  #9
                  Originally posted by hsriat
                  oh... ok.. thats goody doody!
                  This thread has officially been h i j a c k e d

                  :P

                  Comment

                  • harshmaul
                    Recognized Expert Contributor
                    • Jul 2007
                    • 490

                    #10
                    Thats the third thread hijak that i've witnessed in two days!

                    Comment

                    • hsriat
                      Recognized Expert Top Contributor
                      • Jan 2008
                      • 1653

                      #11
                      Originally posted by harshmaul
                      Thats the third thread hijak that i've witnessed in two days!
                      I know, and the first one was mine!!

                      So taking revenge here. :D

                      Comment

                      • Markus
                        Recognized Expert Expert
                        • Jun 2007
                        • 6092

                        #12
                        Originally posted by harshmaul
                        Thats the third thread hijak that i've witnessed in two days!
                        You better watch it!
                        Or we'll be hijacking you
                        *evil*

                        Comment

                        • ronverdonk
                          Recognized Expert Specialist
                          • Jul 2006
                          • 4259

                          #13
                          Could we please all get back to the problem here?

                          moderator

                          Comment

                          Working...