A new module that squeezes some more information out of the accesslog table.

It adds a new page 'usage' under admin/logs that shows visitors/node views/page views for the last 24 hours/last 30 days/last 16 weeks and total visitors/node views/page views for the days of week and hours of the day. The naked numbers are accompanied by simple bars to visualize the usage of your site.

Additionally it adds some tabs to the already existing pages 'referrers' and 'recent hits' from the core statistics module. Now you can view the top referrers separated into website referrers and search engine refererres (along with the keywords of the search query) and you can list recent referrers (again all/website/search engine). The page 'recent hits' provides a new tab 'by visitor' where you can view the recent hits grouped by visitor.

Starting from the 'recent referrers' pages and the page 'recent hits by visitor' you can track the way of a visitor through your website by clicking on the 'track' link.

You can download the module from here.

Please try it out and if you like tell me what is missing, not clear, not working or could be done better.

Comments

patrickharris’s picture

this looks good - I like the idea of recent hits by visitor. However, when I click on this tab "recent hits - by visitor" I get Fatal error: Call to undefined function format_name() in C:\......modules\statistics_details\statistics_details\statistics_details.module on line 470
I'm using 4.7b ... I changed "format_name()" to "theme()" which removed the error, but the "by visitor" tab doesn't list the name of the visitor, under the "visitor" column.

tenrapid’s picture

The module is written for Drupal 4.6. However, it seems that this is the only issue with running it on 4.7, where format_name() has become theme_username().

So if you change format_name($visitor) to theme('username', $visitor) it will work.

Thanks for testing.

stefano@tipic.com’s picture

Works perfect on 4.7 with format_name() patched.
The time intervals (24 hours, 30 days, 16 weeks) should be written this way:

t('%count hours', array('%count'=>24))
t('%count days', array('%count'=>30))
t('%count weeks', array('%count'=>16))

tenrapid’s picture

Thanks for the tip.

Uploaded an updated version.

patrickharris’s picture

Thanks for that (I had been using theme_username incorrectly). BTW, I re-downloaded the module, but the format_name() isn't updated yet.

tenrapid’s picture

Uploaded a version that runs on Drupal 4.6 & 4.7.

chrisv-1’s picture

Great work!

One improvement though: The calls to the function tablesort_pager() should be removed in 4.7, because it doesn't exist anymore. Otherwise some pages (e.g. logs/hits/visitor) would not work. According to the information laid out here, it is safe to simply remove this parameter from the call to theme():

--- statistics_details.module	(revision 44)
+++ statistics_details.module	(revision 45)
@@ -254,7 +254,7 @@
   while ($referrer = db_fetch_object($result)) {
     $rows[] = array($referrer->hits, '<a href="'. check_url($referrer->url) .'">'. check_plain(_statistics_column_width($referrer->url)) .'</a>', t('%time ago', array('%time' => format_interval(time() - $referrer->last))));
   }
-  if ($pager = theme('pager', NULL, 30, 0, tablesort_pager())) {
+  if ($pager = theme('pager', NULL, 30, 0)) {
     $rows[] = array(array('data' => $pager, 'colspan' => '3'));
   }
 
@@ -302,7 +302,7 @@
   while ($referrer = db_fetch_object($result)) {
     $rows[] = array($referrer->hits, check_plain(urldecode($referrer->query)), t('%time ago', array('%time' => format_interval(time() - $referrer->last))));
   }
-  if ($pager = theme('pager', NULL, 30, 0, tablesort_pager())) {
+  if ($pager = theme('pager', NULL, 30, 0)) {
     $rows[] = array(array('data' => $pager, 'colspan' => '3'));
   }
 
@@ -473,7 +473,7 @@
       array('data' => $visitor->pages, 'align' => 'right'),
       l(t('track'), $visitor->uid == 0 ? 'admin/logs/hits/visitor/track/'. $visitor->hostname : 'user/'. $visitor->uid .'/track/navigation'));
   }
-  if ($pager = theme('pager', NULL, 30, 0, tablesort_pager())) {
+  if ($pager = theme('pager', NULL, 30, 0)) {
     $rows[] = array(array('data' => $pager, 'colspan' => '5'));
   }
 
@@ -498,7 +498,7 @@
       check_plain($visitor->title) .'<br />'. l($visitor->path, $visitor->path),
       l(t('details'), "admin/logs/access/$visitor->aid"));
   }
-  if ($pager = theme('pager', NULL, 30, 0, tablesort_pager())) {
+  if ($pager = theme('pager', NULL, 30, 0)) {
     $rows[] = array(array('data' => $pager, 'colspan' => '5'));
   }
chrisv-1’s picture

_statistics_column_width doesn't exist any more, must be replaced with _statistics_link. Too lazy to create a diff right now, but you can download patched version of module here.

madhatter’s picture

I want to make sure that I understand the terminology here correctly.

The number of visitors is the number of IP addresses, unique IP addresses or registered users?
For node views, the same IP address viewing the same node twice is counted as 1 or 2 views?
Does the number of page views include the number of node views?
Since comments are not considered nodes, they are counted in the page views, correct?

Vincent....

www.buzzcn.com

madhatter’s picture

When I look at the 30 days view (18/6/2006 to 17/7/2006) at /admin/logs/usage/recent/days I do not see the statistics for per day usage. I get a sum at the bottom which is the 30 days sum.

When I look at the 16 weeks view at /admin/logs/usage/recent/weeks, I do see the statistics for each week from week 25 to week 29 which is the same period as (18/6/2006 to 17/7/2006)

How come I cannot see the daily statistics total? I am running 4.7 rc3

Vincent.....

www.buzzcn.com

marcoBauli’s picture

I couldn't find it in the project pages..

i was interested in a module that could enable statistics for particular node types defined by admins (similarly to how nodes are enabled as events for example).

These statistics could then be visible by those nodes authors.

Any plan to commit this to cvs?

thx

madhatter’s picture

Fatal error: Maximum execution time of 180 seconds exceeded in C:\NewDocs\wamp\www\includes\database.mysql.inc on line 101

Fatal error: Maximum execution time of 180 seconds exceeded in C:\NewDocs\wamp\www\includes\session.inc on line 50

What's going on here? This happens when I try to access admin/logs/usage/recent/weeks

marcoBauli’s picture

It would be very interesting also to integrate this module with the simple but effective Ip2Country module, so to obtain also statistics about the country of origin of visitors.

If interested in developing this, let me know: i can offer testing and eventually a bounty donation for this to see the light

cheers

kthagen’s picture

Great module. I note, however, that it contains a subquery (the count query in the function statistics_details_top_referrers_searchengine).

Since subqueries aren't supported in versions of MySQL before 4.1, since many hosting companies are still running MySQL 4.0, and since Drupal is supposed to support MySQL >= 3.23.17, this query should probably be rewritten to use a temporary table.

I'd take a stab at fixing it myself, but I'm a PHP novice and don't want to embarrass myself.

summit’s picture

Hi,

Will this module be available for drupal 5.5?
Will it be possible to show the ip-adresses from users instead of showing the username of administred users?
I have a need for that.
Thanks for your reply!

greetings,
Martijn