Statistics module overview
Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites
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.
Use
Configuring statistics
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 turns on, an extra database query is added for each node displayed, which increments a counter.
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
Permissions
To access statistics one needs the proper permissions.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion