Jump to content

Storing hits in the database?


random1

Recommended Posts

Hey All,

 

I have a MySQL database table currently recording a record each time a user visits the site (the date and time, the browser, OS, page they visited etc).

 

I can tell that this will become a very big table when many users hit the site. The ID for the table is currently bigint(255).

 

Is there a better data type I should use? Should I put in place an archiving system for this table since it's going to be so HUGE?

 

What's the best way to handle a table that you know will be full of data? ( > 15000 records)

Link to comment
https://forums.phpfreaks.com/topic/122051-storing-hits-in-the-database/
Share on other sites

most servers and hosting providers already give this information. For my client, I'm more concerned about how many "visits" the site gets instead of each individual page view. So every time I get a new "visit"(basically, when a new session is created) I create a session variable and then on the next page hit, I check if the session variable has been created. if not, I add a database entry. if so, I don't. Of course, a user can just exit the window and revisit the site and it'll count as a new visit so I have a checker to see if xxx ip and yy browser have visited in the last zz seconds. I also validate ip's(make sure they're formatted correctly) bc ip spoofing can render my method useless

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.