Jordban Posted March 6, 2008 Share Posted March 6, 2008 Hello, I know of many solutions to the classic unique vistors script. My question is: Which is most efficient? I want to do unique visitors per page per day. Should I just place all the data in one table with the columns (id,ip, page). User visits page: Checks if there is a match to ip / page. If no match insert into db ip / page and update unique visitors. Recreate table every night. (I realize this isn't a "true" 24 hour visitor check, but It's more efficient) Problem I would think with this is if you have 10,000 users visit your site in a day you would have 10,000 of rows in the mysql que. Can anyone think of a method that would be more efficient then this? Possibly not using MySQL? Thanks! EDIT: Please keep this here, I'm not sure if MySQL is the best solution or not. Quote Link to comment Share on other sites More sharing options...
deadonarrival Posted March 7, 2008 Share Posted March 7, 2008 One (very much not foolproof) method would be to store a cookie on the visitor's machine, then everytime someone visits, add one to a field (probably a text file, for speed) if they don't have the cookie, and set the cookie. Most people tend to have cookies enabled, so it's fairly good, but nowhere near foolproof. Quote Link to comment Share on other sites More sharing options...
Jordban Posted March 7, 2008 Author Share Posted March 7, 2008 One (very much not foolproof) method would be to store a cookie on the visitor's machine, then everytime someone visits, add one to a field (probably a text file, for speed) if they don't have the cookie, and set the cookie. Most people tend to have cookies enabled, so it's fairly good, but nowhere near foolproof. Thanks for taking the time to reply! I don't want to use this solution because deleting your cookies or changing browsers is way too easy. I would like to at least make users use a proxy. The unique visits count is actually significant in this situation. Quote Link to comment Share on other sites More sharing options...
deadonarrival Posted March 7, 2008 Share Posted March 7, 2008 Fair enough, I just thought of that as an alternative to storing several thousand fields in a database. Make sure you index the IP on the sql table for searching. (Apologies if I'm teaching you to suck proverbial eggs, but better to mention to someone who knows than ignore it for someone who doesn't) Quote Link to comment Share on other sites More sharing options...
Jordban Posted March 7, 2008 Author Share Posted March 7, 2008 Fair enough, I just thought of that as an alternative to storing several thousand fields in a database. Make sure you index the IP on the sql table for searching. (Apologies if I'm teaching you to suck proverbial eggs, but better to mention to someone who knows than ignore it for someone who doesn't) Just googled indexing, looks awesome! So congrats to us both I just create my table like usual but add this at the end of the que. ,INDEX (ip) I'd still love to hear some better ways of doing this. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.