Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

accurate page view count in Django

What is a good approach to keeping accurate counts of how many times a page has been viewed?

I'm using Django. Specifically, I don't want refreshing the page to up the count.

like image 918
Johnd Avatar asked May 10 '09 07:05

Johnd


1 Answers

As far as I'm aware, no browsers out there at the moment send any kind of message/header to the server saying whether the request was from a refresh or not.

The only way I can see to not count a user refreshing the page is to track the IPs and times that a user views a page, and then if the user last viewed the page less than 30 minutes ago, say, you would dismiss it as a refresh and not increment the page view count.

IMO most page refreshes should be counted as a page view anyway, as the only reason I have for refreshing is to see new data that might have been added, or the occasional accidental refresh/reloading after a browser crash (which the above method would dismiss).

like image 180
henrym Avatar answered Sep 20 '22 15:09

henrym