9

i am trying to create a most viewed posts page using views. I know how to create a page with most commented post but I can't seem to find the view count option. Any suggestions. Do i need to add a relationship?

15

Try using the Statistics modules. It come with Drupal core.

Documents from d.o: http://drupal.org/documentation/modules/statistics

UPDATE BELOW: (SCREENSHOT) enter image description here

enter image description here

  • thanks, i have activated the module and added 'Content statistics: Views today' under sort. Do i need to add anything under filter or relationships in order to get today's most viewed posts? – Jasmine Ahmed Jan 16 '12 at 17:21
  • 1
    No, you don't. The count is globally on all node. – gilzero Jan 16 '12 at 17:39
  • 2
    @JasmineAhmed Don't forget that statistics is a performance hog as it makes an INSERT query on each page viewed. – tostinni Jan 16 '12 at 17:52
3

I know that Statistics module is in the core but I think Radioactivity module creates a more realistic solution to check the activity of a node. You can add decay profiles and you can assign energy for the different events. For example you can add 1 energy if someone view the node, you can add 5 energy if someone commented on the node and you can add 15 energy if someone flagged as favorite.

I hope it helps.

From the project page:

This module provides a field type which can be used as a hotness metric or a regular view counter for entities and for much much more. In essense, entities receiving attention (views or actions defined by Rules) are heated while inactive ones slowly cool down.

2

You generally should avoid using the statistics module as it adds unwanted write queries to the database and won't be accurate while using reverse proxy caching such as Varnish.

The recommended solution would be to use Google Analytics to track your pages statistics and then the Google Analytics Statistics module to retrieve the data and expose it to views.

protected by Clive Feb 15 '13 at 9:07

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.