Track Hits and Show the Most Popular Drupal Content

Drupal hits popular content

Nearly every news and magazine site shows a list of the most popular content.

Drupal can track the popularity of content using only the core features.

Here’s how to track the hits on your Drupal content and how to show those statistics.

Step 1. Enabling Statistics

  • Go the the Modules screen and enable the Statistics module.
media_1379702042672.png
  • Go to Configuration > Statistics.
  • Check the box for Enable access log.
  • Check the box for Count content views.
media_1379702359500.png

Step 2. Viewing the Statistics

Go to Reports > Recent hits and you’ll be able to see a record of which pages have been visited. If the user is logged in, you can also track their username.

media_1379702577334.png

Step 3. Using the Statistics

Once the statistics module has been turned on, it wil then be available in Views.

For example, you can use statistics in the Sort criteria for views. This would allow you to show the most popular content.

media_1379702771732.png

You can also add statistics as a field, so you can see the number of hits on each article. This would be useful for display on some sites but also for internal reports created with Views.

media_1379702859576.png

Author

  • Steve Burge

    Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.

0 0 votes
Article Rating
Subscribe
Notify of
5 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Nijjo
10 years ago

Nice… I had a question some time regarding this.. Thanks so much.

steve
steve
10 years ago
Reply to  JohnMarkMaina

You’re welcome. Thanks for the feedback.

April Wells Rosequist
April Wells Rosequist
9 years ago

Exactly what I was looking for. Followed the directions, but I’m not returning any results. If I go into the view and change the “Total Views” filter to empty (NULL) then I see a list of pages. This is telling me that the “Total Views” for the nodes are not being correctly written/retrieved. However, if I go into Reports I can get a list of most viewed pages there. Not sure why the “Total Views” is showing up as null.

John Allsopp
John Allsopp
7 years ago

It looks to me like Total Views is incremented when, for instance, a node teaser is shown. That stops any use for, for instance, “most popular articles” as all the articles listed would be incremented every time, despite not being clicked.
Off to check whether that’s still true if I just display fields ..

Pratish jha
Pratish jha
4 years ago

I am using solr search api and created a view of solr indexed items but while adding fields in view statiatics fields are not there in list. In Add fields filters Content Statistics is missing. Can you help me with this please

5
0
Would love your thoughts, please comment.x
()
x