0

I am trying to find a way to display basic site statistics in a block. I have enabled the core "Site Statistics" module but I cannot find a block that would provide me this functionality. I do not want to display anything fancy; just some pageviews and unique pageviews and perhaps, optionally, the 5 most visited pages in the website.

Am I missing something here or do I need a separate module (that I can't find) to add this functionality to my website?

Thanks in advance.

2 Answers 2

1

This is a job for the views module. Using views in its most basic form you could have a block for the below in under 30 secs.

Content statistics: Most recent view

The most recent time the node has been viewed.

Content statistics: Total views

The total number of times the node has been viewed.

Content statistics: Views today

The total number of times the node has been viewed today.

Install views module, add new view, view name = stats, uncheck create a page, check create a block, continue and edit. Add fields and add the 3 above. Remove title. Add a contextual filter under advanced and use Content: nid, provide default value = content ID from url. Get rid of any filter and sort criteria and you should be good to save the view. You will now have a view block that you can place in any region to display this info.

The 5 most visited block would be similar except you would keep the content published filter and add a sort (descending) on Total views. You could use the "Use pager: Display a specified number of items | 5 items" to get a list of the top 5 most viewed nodes.

0

You also need Views module to make a block of 5 most visited page.

Check here: drupal 7.10: View of Most viewed posts

1
  • Hm... It seems that this may be a performance hog. So, since it's optional I'd rather not add it. What about the total page views and unique visits? Is there a way to do that?
    – user4979
    Commented Jan 17, 2012 at 8:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.