Reputation: 33966
I need to count page views (from any url on my site including search pages) and show them on my site but I can't manage to make it work. I wanted to show the numer of times a page is loaded daily but at this point I don't really care whether I get pageviews, single visitors, or any kind of visits, as long as I do have some kind of counter.
Is there an easy way to do it?
Thanks
Upvotes: 0
Views: 1106
Reputation: 2871
Back on Visonary Software Solutions' track. I would use a Google Analytics-based solution too, perhaps you will use it on your site anyway. I did a quick search and found a tutorial on how to create counters like you wanted, displaying Analytics data. It doesn't look so complicated.
http://www.webresourcesdepot.com/feedcount-like-google-analytics-counter/
As far as I can tell, there are quite a lot of extensions for this purpose for the popular CMSs: For Drupal: http://drupal.org/project/google_analytics_counter For WordPress: http://analytics.blogspot.com/2009/05/share-your-google-analytics-data-with.html
Upvotes: 0
Reputation: 5240
First, I'd have to say it: displaying number of views is SO 2000.
Well, now to the actual question, you'll have to identify each page and find out how flexible that can be:
/?p=1
/?p=1&q=2
/?p=1&s=1
Those might be the paths and might be referring to the same object, so you'll have to grab it and parse it if necessary. Now, just save it to a table in your database and increase the counter each time a new view is there.
Upvotes: 0
Reputation: 1258
I would suggest one of the free web statistics programs out there to just analyze your web logs. They'll be more fully featured than just counting visits, and there will be no overhead of database transactions just because someone is visiting a page.
http://awstats.sourceforge.net/
Upvotes: 0
Reputation: 3848
Yeah. The easiest way is to use Google Analytics.
Upvotes: 2