I want to have this feature that for each user logs the nodes that the user viewed.

In another words, recent nodes viewed by each user. I want have a block that shows each nodes user viewed , something like imdb.com user history view.

How can I achieve this job? Do you know good module for Drupal 7? Do you think it is possible achieve that with views or my custom query? Or I should write custom simple module and get help hook_node_view .... ?

  • Core statistics module tracks user visits .. Did you try checking that.. I believe it has integration with views too.. – Anil Sagar May 5 '14 at 8:32
  • I know it , but it track all user activity , I just want recent log of some content type that user views, as example recent 'blog' and 'story' user views only. – Yusef May 5 '14 at 8:33

You can try using Recently Read module...

Recently read allows site administrators to enable blocks displaying a history of recently read content (nodes) both to anonymous and authenticated users. For logged in users, each user has its own history. For anonymous users, the history is based on sessions. This module may be useful i.e. for displaying recently viewed products on the e-commerce site.

  • It create a block in view,and I can change it , customize it by my desire, add filter to it ...., good, tnx – Yusef May 5 '14 at 9:39
  • 5
    Big warning - using this module means you can't cache your pages any more. It's...not great. – Clive May 5 '14 at 11:00

Logging the nodes visited by a user

Here are some modules that might be a possible fit for logging the nodes visited by a user (quotes are from their project pages):

  • Visitors:

    Comes with a set of Visitors Reports, such as:

    • User activity report (hits, nodes, comments).
    • A Visitor tab that is added to each node, with details about Referrer, Date, User, IP address, User agent.

    It also comes with a Visitors Block, which includes data about:

    • Total Visitors.
    • Unique Visitor.
    • Registered Users.
    • Last Registered User.
    • Published Nodes.
    • Your IP.
  • 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.

  • Node view count:

    ... 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.

Reporting about the logged nodes

Typically all modules suggested above come with their own set of (fixed) reports, whereas these reports are about data stored in the tables these modules maintain.

If the reports they come with don't meet all your reporting requirements, you could use something like the Views or Forena modules to create custom reports (and charts) about the data stored in any of these tables. Another option is to create a custom module (with custom queries) for this kind of reporting.

Disclosure: I'm the maintainer of the Visitors, and co-maintainer of Forena.

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.