Domanda

I have been reading about a variety of ways which I can take to implement a hit counter. The one that I liked the most was having a session/cookie flag for a specific user to indicate if he/she visited a specific page. If the flag is not set, I would set it and increment the page's hits by 1.

I know the above method is fine, but I also understand that it will always have a workaround. But if I use a dedicated table with a unique constraint on a combination of page_id and ip_address, it should work most efficiently when used with a combination of a session flag. But considering the site I am working on has about a 20000 hits a day (which isn't a lot, but enough to flood my hits table), is it worth flooding MySQL with ip addresses just to capture hits?

Also, is there a better way of capturing legit hits other than these?

È stato utile?

Soluzione

I think it is just too much work to have dedicated table for this. Do it only if really required. Otherwise it is just a waste of time and resources. Field in existing table that gets incremented, and eventually a cookie to disable incrementing on refresh is just fine.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top