Web Analytics Made Easy -
StatCounter site statistics in db vs text file - CodingForum


No announcement yet.

site statistics in db vs text file

  • Filter
  • Time
  • Show
Clear All
new posts

  • site statistics in db vs text file

    i currently put my visitor ip info into a db and was thinking about expanding the amount of data i capture by adding os, etc, etc. the few posts i've seen regarding this topic all put their data into a text file. is there a reason for this? is there a reason i shouldn't be putting this info into a db?


  • #2
    not that I can think of!

    Might be most others do it because then you don't need a real DB....

    Some might say a db would be overkill...I say go for it.


    • #3
      I use a txt file and check it in the browser. I track IP address, date, and page that they visit on my site. After a week or so I delete the file and keep an I on the new one. In my case a DB is not needed.

      Most of my viewers go to my index page and then leave.

      Leonard Whistler
      Leonard Whistler


      • #4
        I do both ~

        I log page hits to a text file & then weekly via cron (or manually) I run a script that parses and empties the logfile & updates the DB with processed stats.

        I do not think there is a winner in the DB vs flatfile competition for logging & which is prefereable would depend on the site structure and how dynamic the page content is , e.g. if you have a load of pages that are basically static it seems a waste to connect to a DB just for logging , writing the file is quicker .. however if you already have an open connection for most of your pages then you may as well use it !
        resistance is...

        MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)