FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » Can we count views as well as posts?
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Can we count views as well as posts? [message #17903] Fri, 23 April 2004 23:52 Go to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
Back several weeks ago, under wwwboard, we could get statistics that showed how many page views each topic received, which also added to the total activity statistics for our overall site. We use a limited version of Urchin, which, evidently, totally ignores php files in presenting statistics. Thus our Urchin report shows no page views of the index.php file (that is, the page is totally missing from the list). Since a high percentage of site traffic is on the forums, everybody wants me to see if I can track the lurking activity too. I did find the statistics report on the control panel, but, of course, it only tracks posts. And yet the number of views of a given topic is being tracked and reported with each topic. Can we not utilize that information to generate a periodic count of the total number of topic views? My folks would be delighted if we could get some data for each month. Even if we could just get a grand total of the number of views in the system, we could do arithmetic from month to month with such a number to get an idea of the viewing traffic. Any recommendations?
Re: Can we count views as well as posts? [message #17909 is a reply to message #17903] Sat, 24 April 2004 20:54 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Some log analysis software only consider .html/.htm pages as 'pages' for the purpose of request counting. What you generally need/can do is set a configure option defining *.php and other pages of this type as valid pages.

The views information is stored inside threads table and you can easily get it from that table to present in whatever format you prefer.


FUDforum Core Developer
Re: Can we count views as well as posts? [message #17923 is a reply to message #17909] Sun, 25 April 2004 19:34 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
Thanks.
Both of these responses seem helpful.
I can probably get my IP to help set the configuration.

How can I "easily" get the views information from the threads table? Do I have to do something in php? Where would I want to put the code? Is there an example of something comparable laying around?
Re: Can we count views as well as posts? [message #17924 is a reply to message #17923] Sun, 25 April 2004 19:38 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
You don't need to do anything special, just retrieve the 'views' column from the threads table. That column contains the number numbers of views for a particular topic, you don't need to do any mathematical calculations.

FUDforum Core Developer
Re: Can we count views as well as posts? [message #17938 is a reply to message #17924] Mon, 26 April 2004 17:37 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
I am not making clear how clueless I am. Mathematics or arithmetic I can handle, although it is nice if there isn't any. My problem is in knowing what to do and how and where to do it in order to retrieve the views value from the threads table (without screwing up my installation). Here is what I would assume:
I would be creating a stand-alone function or utility, in php, which would open the threads table. I think I found the structure of the threads table, so I would be looking for the views value. I don't see a mysql table named "threads", but I can keep looking until I do. Once found and opened, I would loop through the entire table, accumulating the total views by adding in the views value for each thread. I would report this value, close the threads table and terminate.
Am I anywhere close?
Re: Can we count views as well as posts? [message #17939 is a reply to message #17938] Mon, 26 April 2004 18:01 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
All of FUDforum's tables have prefix, if you didn't change it during installation it is probably "fud26_". When I am referring to the "thread" table, I would actually be referring to the table called fud26_thread.

Instead of looping through each thread, you'd execute a single query that would get your either the total number of views for all threads or threads inside 1 forum.

ex. SELECT SUM(views) FROM fud26_thread WHERE forum_id=1;
SELECT forum_id,SUM(views) FROM fud26_thread GROUP BY forum_id;

Beyond that your description is fairly accurate.


FUDforum Core Developer
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Installer Logic
Next Topic: How to Change User Profiles Globally
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 23:34:23 GMT 2024

Total time taken to generate the page: 0.02079 seconds