3 Replies Latest reply on Mar 26, 2012 4:06 PM by Jason Porter

    How to track site activity

    zeeman Novice

      For reporting purposes. What would be the best way to track views for both logged in and anonymous users to capture site's activity?

       

      I have come up with below possible solutions but not sure which one would work best:

       

      • Use Google Analytics http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html does not give me as much control, have to deal with JavaScript. Data will be kept by Google, will make performance a little slower.
      • Use a filter, simply log the url requested and user info (IP, agent, etc...), if a user is logged in, log it, put all info in DB
      • Use a JSF phase listner, simply log the url requested and user info (IP, agent, etc...),  if a user is logged in, log it, put all info in DB

       

      However, I'm looking for a reliable solution that would tell me what are my site's users doing, time spent on each pag, and te navigation they follow, etc... A way to create a report with this info.

       

      I'm using Seam 3.1 and AS7.

        • 1. Re: How to track site activity
          Jason Porter Master

          If you're in a JSF app you probably want to use the PhaseListener approach as you'll be able to get more information, otherwise a ServletFilter or ServletRequestListener would work.

          • 2. Re: How to track site activity
            zeeman Novice

            Hi Jason,

             

            I like PhaseListener approach. It'll work only for xhtml views but that's fine.

             

            I want to do persistence of user info async. Will that be a problem calling a stateless EJB from a phase listener?

             

            What is a good way of adding my phase listener in Seam? Is it a matter of adding it to faces-config and put my logic for restore view phase? Is that a good phase for logging info?

             

            Last question, what extra information does a phase listener give me over a servlet filter?

             

            Thanks!

            • 3. Re: How to track site activity
              Jason Porter Master

              Yeah, that sounds like a sound way of doing it. There shouldn't be a problem calling a SLSB from a phase listener. From the a PhaseListener you'll be able to get the FacesContext and anything within it, current state may be important to you, maybe not.

              1 of 1 people found this helpful