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?
3 Answers
Try using the Statistics modules. It come with Drupal core.
Documents from d.o: http://drupal.org/documentation/modules/statistics
UPDATE BELOW: (SCREENSHOT)
-
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? Jan 16, 2012 at 17:21
-
1
-
2@JasmineAhmed Don't forget that statistics is a performance hog as it makes an
INSERT
query on each page viewed.– tostinniJan 16, 2012 at 17:52
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.
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.