Statistics module overview
The Statistics module shows you how often a given page is viewed, who viewed it, the previous page the user visited (referrer URL), and when it was viewed. These statistics are useful in determining how users are visiting and navigating your site. It provides a customisable "Popular content" block that can be added to your theme.
Be cautious about using this module on a high traffic website as each page view is written to the database which can have a negative effect on performance, a third-party analytics service is often more suitable.
In Drupal 7 configure statistics via configuration > system > statistics.
To enable collection of statistics, the Enable access log checkbox on the Statistics settings page must be checked. This access log is used to store data about every page accessed, such as the remote host's IP address, where they came from (referrer), what node they've viewed, and their user name. Enabling the log adds one database call per page displayed by Drupal.
The Discard access logs older than setting on the settings page specifies the length of time entries are kept in the log before they are deleted. This setting requires a correctly configured cron maintenance task to run.
Enable Count content views 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, which increments a counter.
In Drupal 8 configure statistics via configuration > system > statistics.
To enable collection of statistics, the Count content views checkbox on the Statistics settings page must be checked.
Viewing site usage
The Statistics module can help you break down details about your users and how they are using the site. The module offers four reports:
- Recent hits displays information about the latest activity on your site, including the URL and title of the page that was accessed, the user name (if available) and the IP address of the viewer.
- Top referrers displays where visitors came from (referrer URL).
- Top pages displays a list of pages ordered by how often they were viewed.
- Top visitors shows you the most active visitors for your site and allows you to ban abusive visitors.
Displaying popular content
The module includes a Popular content block that displays the most viewed pages today and for all time, and the last content viewed. To use the block, enable Count content views on the statistics settings page, and then you can enable and configure the block on the blocks administration page.
Page view counter
The Statistics module includes a counter for each page that increases whenever the page is viewed. To use the counter, enable Count content views on the statistics settings page, and set the necessary permissions (View content hits) so that the counter is visible to the users.
Statistics administration pages
To access statistics one needs the proper permissions.