An Introduction to the User Stats Module for Drupal

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.


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.

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:

  1. Enable Count content views on the statistics settings page (Configuration > System > Statistics)
  2. Add the Popular Content block from the Block Layout page (Structure > Block Layout)
  3. Configure how many results to show for each statistics list.
  4. 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.