Statistics module overview
The Statistics module has changed since Drupal 7. It now only shows you how often a given page is viewed, and when it was viewed. There is no information anymore about who viewed it or the previous page the user visited (referrer URL).
The 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.
This documentation uses the generic word "page", however, the Statistics module only tracks node page views. It does not track views on taxonomy term pages, views pages or any other type of pages.
Use
Configuring statistics
In Drupal 9, configure statistics via Configuration > System > Statistics.
To enable collection of statistics, check the Count content views checkbox on the Statistics settings page.
Display 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 (Configuration > System > Statistics)
- Add the Popular Content block from the Block Layout page (Structure > Block Layout)
- Configure how many results to show for each statistics list.
- Choose which roles to show the statistics to
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.
Views
The Statistics module also provides data that appears within the Views module. A "content statistics" category should appear when you go to a view (in "fields", "filter criteria," and "sort criteria") which provides three items: "Most recent view", "Total views", and "Views today". For instance, one would create a view of most popular content based on views today, or total views (additional ways to limit this would be to filter for particular content, or content created within a certain time frame).
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