5

I'm using Drupal 6 and I need to display a block with the most viewed nodes from the last 7 days. I've tried using views + statistics but I can only get the total count of views. How can I get a count of node views from the last X days?

11

You may want to take a look at the Radioactivity module and see if it works for you. It defines a "hotness" for a node, and a "halflife" that the "hotness" wears off at. This attempts to account for popularity over time, instead of raw page views.

For example, a popular blog post from a few days ago will be more "hot" than a wildly popular blog post from last year that had more page views.

Time-decay is configurable, and it integrates with Views.

1

Here are some modules that might be a possible fit, all of them have a D6 version too (quotes are from their project pages):

  • Visitors (*)

    One of the things you get from it is a Visitors Block, which includes, among others, data about:

    • Total Visitors.
    • Unique Visitor.
    • Registered Users.
    • ...
  • Statistics Advanced (*).

    Provides a few advanced options to the core Statistics module. Once enabled, these options can be found under "Administer >> Reports >> Access log settings."

  • Statistics Filter

    ... allows customizable filtering of hits from particular user roles or from crawlers.

    For sites with light traffic (i.e., most sites), a large percentage of the gross hits recorded by statistics.module are either from the site administrator or from search engines. Filtering out these hits makes the collected statistics more accurately reflect traffic from real, human visitors.

  • Counter

    ... counts how many visitors on your website. This module provides real time counting. All data saved to database.

  • User Visits (with related User Visits Advanced).

    ... tracks visits and referrer from other users on a user's profile page. It displays the latest visitors on a user's profile page and provides two blocks one with the latest visitors on a user's profile page and one with the latest visitors on own profile page.

    See User Visits Advanced for additional functionality.

  • Better Statistics.

    ... introduces a Statistics API, allowing developers and contributed modules a way to collect, limit, and route custom access statistics and data.

This question is about D6, but for D7 there is also the Node view count module. Some more details about it:

... allows to count node views. Unlike statistics module, this module records each view of node with user uid and timestamp. So now you can know how many times a user viewed node by day, week, month and etc.

This module is integrated with Views module. You can use it to create different statistics pages, output new not viewed nodes for user and many more.

Disclosure: I'm the maintainer of the modules marked with (*).

1

The Drupal Most Popular module uses the core statistics module, which has several shortcomings. For starters, it won't count any "reads" of cached content, so if you use the page cache or a reverse proxy cache, you are out of luck. Additionally, statistics module is a huge drain on performance, and only keeps counts of reads for a period of time (say, 30 days).

The Radioactivity module seems like the way to go - it is a really great idea in concept, and will work great for Drupal 6. Unfortunately it does not actually count page views in Drupal 7! There is something included that's supposed to do that, but it doesn't work. Several people have reported that they were able to work around this deficiency by using the Rules module (but I do not recommend it).

There's also the Scoville module for Drupal 7 which is a funny hybrid of the two.

0

In addition to Radioactivity (already mentioned by MPD), you may also want to consider the Drupal Most Popular module. Some details from its project page:

The module is pre-packaged with several services including:

  • Drupal - Most Viewed pages (using Statistics module)
  • Drupal - Most Commented pages (from simple database query)
  • Google Analytics - Most Viewed pages
  • AddThis.com - Most Shared pages
  • Disqus.com - Most Commented pages

The system defines Drupal hooks to allow new services to be created, which can pull data from third party providers or internally from Drupal. The system also provides an API to help service plugins normalize their results and exclude certain pages, as configured by the administrator.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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