I'm looking for a way to count the number of times each user has viewed a particular node. I have many nodes but I need that number to give user points to the viewing user if he or she has accessed that node X number of times over a time span of 24 hours and this on a daily basis.

Is there anything that can do (track) this or is there a way that I could create this feature "without" writing my own module and without writing php code? I'm no Drupal Ninja ...

I've been looking at the node view count module but that doesn't allow the users themselves to see their view count. The best way of displaying that number would be through Views (obviously). I've been thinking about creating an integer field on the user account settings page but that wouldn't actually not show me which node that user has accessed.

Any ideas?

Update: The Node View Count module (suggested in one of the answers) is unstable (throws errors, breaks the site), has no documentation and simply does NOT provide a count of how many times 1 particular user has viewed each node (of a certain content type).

  • Again, Pierre, this might be exactly what I'm looking for. I'm going to study and try it and get back to you as soon as I can. Thanks again!
    – BassPlaya
    Commented Dec 8, 2016 at 6:09

2 Answers 2


Using the Rules module to solve this challenge is part of the solution you're looking for. But the key part of your challenge is that your question is about something (= access that node) which:

  1. has to be repeated (= X number of times).
  2. within a specified timeframe (= over a time span of 24 hours).
  3. don't all happen at the very same moment.

Rules is great (amazing), but it does not support any of the 3 bullets above. So far the bad news ...

However, your question seems like a pretty good fit for using the Goals module (disclosure: I'm its maintainer), together with the Rules module. Below is a possible configuration to achieve your Goal, using Goals.

Configure a goal

Navigate to the relative path admin/config/goals/manage and use the link "Add a goal" to define just 1 goal, with a description (say):

View some node, 8 times within 24 hours with a limit of 1 view per hour.

Obviously, you can replace the 8 by whatever value of X you'd want.

Configure a task

To achieve the above goal, define the Task(s) to be completed. Even though there could be multiple tasks to be completed for a single goal, in your case you just need 1. It's simply View a node (assume we use a machine name like view_a_node).

Obviously, that doesn't take into account the 8 times within 24 hours-part of your question. For that you would use some of the more advanced ways to use (configure) Goals, i.e. by using these optional configuration options for this specific task:

  • this task has to be repeated multiple times: in your case 8 times.
  • this task requires some amount of time to expire in between any 2 similar tasks: in your case, if a user performs multiple refreshes of the same page in just a few seconds, only the first one of them should count. That why I'd use a limit of 1 view per hour.
  • this task must be completed within a specific time frame (a number of times, expressed in hours, days or weeks): in your case 24 hours.

Track progress while performing tasks

To track the progress made by a single user to complete this task, you only have to write an appropriate rule, using the Rules module, to record relevant events happening in your site, which are related to the completion of the task to reach the goal.

For the goal/task described above, you'd only need 1 (extremely basic) rule, which would look like so:

  • Rules Event: Content is viewed.
  • Rules Events:
    • Check user has role "authenticated" (how else would you know which user it is ...).
    • Check the node id of the node being viewed.
  • Rules Action: Record a task for Goals (obviously, the task to be recorded is "View a node"). This is where part of the Goals magic happens, such as verifying the requirements in the optional task configuration options for a task (only once an hour, etc).

Here is a rule that you could probably use for this (if you have a "task" defined with the exact machine name view_a_node, just use the Rules UI to import it in your own site to get you going, if not adapt that machine name prior to starting such import):

{ "rules_record_task_view_a_node" : {
    "LABEL" : "Record task view_a_node",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "TAGS" : [ "goals" ],
    "REQUIRES" : [ "rules", "goals" ],
    "ON" : { "node_view" : [] },
    "IF" : [
      { "user_has_role" : {
          "account" : [ "site:current-user" ],
          "roles" : { "value" : { "2" : "2" } }
      { "node_is_of_type" : { "node" : [ "node" ], "type" : { "value" : { "article" : "article" } } } },
      { "data_is" : { "data" : [ "node:nid" ], "value" : "123" } }
    "DO" : [
      { "goals_task_record" : {
          "task_name" : "view_a_node",
          "user_to_save_for" : "[site:current-user]",
          "task_id" : "Node ID of viewed node = [node:nid]"

Use Rules to process completed goals

After all tasks specific to a goal are completed by a user, the goal is automagically marked as completed. But, that's where it gets really interesting: you can also create additional rules that will be triggered (Rules Event) when a goal is completed by a user.

With that, the answer to your question is extremely easy. You actually have 2 possible answers to pick from:

  1. Just let the Goals grant the user points (if you have the Goals Extras submodule enabled).
  2. Perform a Rules Action to "... grant user points to the user who completed the goal" ... which is exactly what your question is about, no?

More info

Refer to my answer to "How to implement gamification in a Drupal site and award incentives?" for additional details about the Goals module.

Note: Using Goals only requires typical administration tasks (configuration), though it does come with various hooks also for custom module development (if you want to).

  • I am going to do this. Thanks Pierre! You're an inspiration! I'll keep you posted!
    – BassPlaya
    Commented Dec 10, 2016 at 5:36

I think You've missed something from the Node View Count module.

Node View Count module 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.

Note: Make sure to give permission for users to see their node view count.

  • This module is unstable (throws errors, breaks the site), has no documentation and simply does NOT provide a count of how many times 1 particular user has viewed each node (of a certain content type). So, sorry to say but your quick response was probably a bit too fast, bro.
    – BassPlaya
    Commented Nov 14, 2014 at 15:17

Your Answer

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

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