简体   繁体   中英

How do I show “daily hits” in any URL (visits/page loads)?

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

Yeah. The easiest way is to use Google Analytics .

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/

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM