From 8d2b1238b4d8ebd57848fde665b7f93c3a03cd90 Mon Sep 17 00:00:00 2001
From: Dries Buytaert This Drupal module keeps track of numerous statistics for your site. Be warned, statistical collection does cause a little overhead, thus everything is disabled by default when this module is first installed. The statistics module counts how many times each of your nodes is viewed, also tracking where each link to the node came from (HTTP referrer). The number of times a node has been viewed can be displayed in the node's link section (next to "# comments" etc). This module also adds a configurable block that can display the day's top stories, the all time top stories, and the last stories read. Each of these supports a configurable header and number of stories. This module also adds a configurable user page that can display the day's top stories, the all time top stories, and the last stories read. Each of these supports a configurable header and number of stories. This module also adds a configurable block that displays counts of how many users and guests are currently accessing your site, as well as a list of the names of the users currently accessing your site. If you enable the node view counters, this adds 1 database query for each node that is viewed (2 queries if it's the first time the node has ever been viewed). Finally, the statistics.module allows for a congestion controlling auto-throttle mechanism. If you have enabled the throttle.module, you can read more about this mechanism . If you enable the access log, this adds 1 database query for each page that Drupal displays. Logged information includes: HTTP referrer (if any), node being accessed (if any), user ID (if any), the IP address of the user, and the time the page was viewed. As with any new module, statistics.module needs to be enabled before you can use it. Also refer to the permissions section below, as this module supports four separate permissions. This admin page gives you an at-a-glance look at your top nodes. It is useful for understanding what content on your Drupal site is the most popular. Also on this page are links to the referrer statistics for each listed node. This admin page shows you site-wide referrer statistics. You can see 'all' statistics, 'external' statistics or 'internal' statistics. Default is 'external'. There are a couple of configuration options added to the main admin page. The first option, enable access log, allows you to turn the access log on and off. This log is used to store things like referrers and who's online. Enabling the log adds one database call per page displayed by Drupal. The second option, discard access logs older than, allows you to configure how long an access log entry is saved, after which time it is deleted from the database table. The next option, enable node view counter, allows you to turn on and off the node-counting functionality of this module. If it is turned on, an extra database query is added for each node displayed, as a counter is incremented with each node view. The next option, display node view counters, allows you to globally disable the displaying of node view counters. Additionally, a user group must have 'access statistics' permissions to view the counters. The final option is to reset the day counter. Every twenty four hours, all the day's totals are automatically reset to 0, and started again. Whatever time you click this link is the time each day that the day's totals will be reset. This requires cron. Note that clicking this link will reload the site configuration page without saving any other changes you might have made. This module creates a block that can display the day's top viewed nodes, the all time top viewed nodes and the last nodes viewed. Each of these links can be enabled or disabled individually, and the number of nodes displayed for each can be configured with a drop down menu. If you disable all sections of this block, it will not appear. The administrative "top nodes block" screen also allows you to assign a name to the block. Don't forget to enable the block . This module creates a user page that can display summaries of the day's top viewed nodes, the all time top nodes and the last nodes viewed. Each of these summaries can be enabled or disabled individually, and the number of nodes displayed for each can be configured with a drop down menu. The administrative "top nodes page" screen also allows you to assign a name for the automatically generated link to the user page. If no name is set, the link will not be displayed. This module creates a block that can display how many user's and guests are currently online. You are able to configure the name of the block, the name of a sub-block for displaying names of user's currently online, how recently a user must have been active to be considered online, the maximum characters to display from a user's name and the maximum number of user names to display. Don't forget to enable the block . This module has four permissions that need to be configured in
-. If 'administer statistics' and 'access statistics' are both enabled, the user will see a link from each node to that node's referrer statistics (if enabled). To get a node's view statistics make a call to the function statistics_get($nid). When you pass in a $nid, the function returns an array with three entires: [0]=totalcount, [1]=daycount, [2]=timestamp. For example, you could use this function call to add node view counts to your theme. The module automatically adds '# reads' to each node's link section (if enabled). The statistics.module provides a function 'statistics_title_list($type)' to return an array of links to any of the following: the top viewed nodes of all time, the top viewed nodes of today, the last viewed nodes. You can pass in: The function To implement the throttle, you should do something like this:
- The statistics.module keeps track of numerous statistics for your site but be warned, statistical collection does cause a little overhead, thus everything comes disabled by default. ";
+ $output .= " The module counts how many times, and from where -- using HTTP referrer --, each of your nodes is viewed. Once we have that count the module can do the following with it: Notes on using the statistics: As with any new module, the statistics.module needs to be ". l("enabled", "admin/system/modules") ." before you can use it. Also refer to the ". l("permissions section", "admin/user/permission") .", as this module supports four separate permissions. This admin page shows you site-wide referrer statistics. You can see 'all' statistics, 'external' statistics or 'internal' statistics. Default is 'external'. This admin page gives you an at-a-glance look at your top nodes. It is useful for understanding what content on your Drupal site is the most popular. Also on this page are links to the referrer statistics for each listed node. There are some configuration options added to the main ". l("site configuration", "admin/system/modules/statistics") ." section: This module creates a block that can display the day's top viewed nodes, the all time top viewed nodes and the last nodes viewed. Each of these links can be enabled or disabled individually, and the number of nodes displayed for each can be configured with a drop down menu. If you disable all sections of this block, it will not appear. The administrative \"top nodes block\" screen also allows you to assign a name to the block. Don't forget to enable the block ". l("here", "admin/block") .". This module creates a user page that can display summaries of the day's top viewed nodes, the all time top nodes and the last nodes viewed. Each of these summaries can be enabled or disabled individually, and the number of nodes displayed for each can be configured with a drop down menu. The administrative \"top nodes page\" screen also allows you to assign a name for the automatically generated link to the user page. If no name is set, the link will not be displayed. This module creates a block that can display how many user's and guests are currently online. You are able to configure the name of the block, the name of a sub-block for displaying names of user's currently online, how recently a user must have been active to be considered online, the maximum characters to display from a user's name and the maximum number of user names to display. Don't forget to enable the block ". l("here", "admin/block") .". This module has four permissions that need to be configured in ". l("user permissions", "admin/user/permission") .". If 'administer statistics' and 'access statistics' are both enabled, the user will see a link from each node to that node's referrer statistics (if enabled). To get a node's \"view statistics\" make a call to the function statistics_get(\$nid). When you pass in a Node ID (\$nid), the function returns an array with three entires: [0]=totalcount, [1]=daycount, [2]=timestamp. For example, you could use this function call to add node view counts to your theme. The module automatically adds '# reads' to each node's link section (if enabled). The statistics.module provides a function 'statistics_title_list(\$dbfield, \$dbrows)' to return an array of links to any of the following: the top viewed nodes of all time, the top viewed nodes of today, the last viewed nodes. You can pass in: \$dbrows is the number or rows you want returned in your array. The function To implement the throttle, you should do something like this:Introduction
-
- View statistics
-
- View referrers
-
- Configuring the statistics module
-
- Top nodes block
-
- Top nodes page
-
- Who's online block
-
- Permissions
-
-
-Statistics module (for developers)
-
-Accessing statistics
-
-
-Top stories
-
-
-
-
- Example: statistics_title_list("totalcount");
- Example: statistics_title_list("daycount");
- Example: statistics_title_list("timestamp");
Throttle
-throttle_status()
will return a number from 0 to 5. 0 means that there is no throttle enabled at this time. Each number above that is a progressively more throttled system... To disable a feature when a site first begins to get busy, disable it at a throttle of 2 or 3. To hold on to the bitter end, wait until 4 or 5. $throttle = 0;
+ $output .= "
Introduction
";
+ $output .= "
";
+ $output .= "referrers log
", "admin/statistics/referrers")."access log
", "admin/statistics/log") ."Configuring the statistics module
";
+ $output .= "Top nodes block
Top nodes page
Who's online block
Permissions
";
+ $output .= "Statistics module (for developers)
Accessing statistics
";
+ $output .= "Top stories
Example: statistics_title_list(\"totalcount\", \"5\");
Example: statistics_title_list(\"daycount\",\"5\");
Example: statistics_title_list(\"timestamp\",\"5\");
Throttle
throttle_status()
will return a number from 0 to 5. 0 means that there is no throttle enabled at this time. Each number above that is a progressively more throttled system... To disable a feature when a site first begins to get busy, disable it at a throttle of 2 or 3. To hold on to the bitter end, wait until 4 or 5. \$throttle = 0;
/* verify that the statitistics module is installed */
if (function_exists(throttle_status) {
- $throttle = throttle_status()
+ \$throttle = throttle_status()
}
- if ($throttle >= $my_throttle_value) {
+ if (\$throttle >= \$my_throttle_value) {
// throttle limit reached, disable stuff
}
else {
// throttle limit not reached, execute normally
- }
Note: Even though the configuration for the throttle is handled by the 'throttle.module', the throttle logic itself is part of the 'statistics.module'. The configuration has been separated in order to make things easier for the average site that will not be utilizing the throttling mechanism. More information about how the throttle works can be found on the throttle.module help page. Find the throttle help page if you have enabled the throttle.module).
+ }"; + $output .= "Note: Even though the configuration for the throttle is handled by the 'throttle.module', the throttle logic itself is part of the 'statistics.module'. The configuration has been separated in order to make things easier for the average site that will not be utilizing the throttling mechanism. More information about how the throttle works can be found on the throttle.module help page. (Find the throttle help page ". l("here", "admin/help#throttle") ." if you have enabled the throttle.module).
"; + return t($output); -