I am searching for the easiest way to track wether particular user has read particular group of nodes (training material) and did the quizes that are related to those nodes. In success case I would like to grant user some points and a badge and for the site administrator to have a list of all the training material with "read"/"not read" results per user. I know that there could be various ways to do this, but I am not sure, which one would be the easiest one.

  • using Goals + Rules (but I can't find how exactly can I track wether user has visited particular node).
  • using Activity module?
  • using Heartbeat module?

None of these looks like it is possible to do such thing without coding, or I am missing something?


1 Answer 1


I'd use the Goals module (disclosure: I'm its maintainer) to "track wether user has visited particular node" (as in your question). No need for custom coding. Read on for details how to do so ...

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, only 1 time.

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

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 (eg: node=123).
  • 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 which 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]"

The above gets you started for a single node like node/123. To enhance it to also verify node/124, node/125 and node/126 (it doesn't matter in which order they are viewed ...), this is how to do so:

  • Add 3 similar tasks to be tracked (for the 3 other nodes), with a machine name that includes the relevant node id.
  • Duplicate the above rule for each of the other nodes (only difference is the node id in the Rules Condition and the machine name of the Task in the Rules Action). As an alternative, use the Conditional Rules module to consolidate those 4 rules in a single rule.
  • Thank you! And in case I would like the user to read the section (couple of nodes, let's say 4 - node/123,node/124,node/125,node/126) - should I repeat the same rule with different node id in rules events? I need to grand a badge to a user only if he/she reads all the nodes from the section, so as I understand there should be on Goal per Section, and the amount of tasks would depend on the amount of nodes, right? Commented Mar 12, 2018 at 13:40
  • @BenasPlentas check my updated answer (near the end) Commented Mar 12, 2018 at 13:59
  • Perfect, all works, thank you very much! I have combined view condition with additional flag, where user also has to confirm, that he/she has understood the theory. At the end after all the nodes are read and marked as understood, I'm granting the badge to them. Now I just have to integrate results of quizes to the same goal. Commented Mar 12, 2018 at 14:11

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.