开发者

php unique hit count

i have a 开发者_如何学Pythonhit count on various parts of my site (profiles, news items, etc). At the moment it will increase the count if you refresh the page even though it's been visited. How can I stop going up if its visited? I was considering a cookie but once the site has a lot of articles/profiles the cookie will get big?


Cookies will do the job and unless you have 1000's pages and a users visits them all then the size of the cookie will remain well within acceptable limits if you store a page id and a visit timestamp. Another alternative would be to store unique ip addresses in a DB and do some DB level work.

That said...

Are your tracking for the purposes of displaying the hit count to users? Or any you tracking for your own administrative/curiosity reasons?

If the latter I would strongly suggest that you don't reinvent the wheel and get a Google Analytics account (free). This will give you considerably more useful information that a simple hit counter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜