Currently, node accesses are tallied in {node_counter} and all hits globalized in {accesslog}. However, modules building pages that are not nodes (like a dynamic graph) might want to have its access count tallied too.

Therefore a useful feature would be for statistics.module to include an API for modules to register hits so that they could be tallied and displayed later on just like node accesses.

Regarding storage, various scenarios come to mind, but the simplest seems to be adding a type column to node_counter in order to separately log actual nids for nodes, and virtual nids for module-generated pages. The URL-to-virtual-node mapping could be implemented by modules, or they could just pass the path to statistics.module so it would hash the path to a nid and back.


Dave Reid’s picture

Status: Active » Postponed

Moving feature requests to latest version and marking as postponed. Seems like it could be a good idea, but it needs some code.

Dave Reid’s picture

Title: counters for non-nodes » Add a general counter API
Version: 5.x-dev » 7.x-dev
fgm’s picture

Version: 7.x-dev » 8.x-dev
Status: Postponed » Active

Not in D7 and we're past freeze. Bumping to D8.

geerlingguy’s picture

Subscribe. I'll probably regret doing so later, though.

karschsp’s picture

Seems like this would be useful, especially as there's a movement afoot for node.module to not be required in D8. Also, with the introduction of entities, it probably makes more sense to have a counter table rather than node_counter. I'll try and get started on a patch this weekend.

karschsp’s picture

...and virtual nids for module-generated pages

The concept of virtual nids kind of scares me. I wonder if we can use path as the uuid?

andypost’s picture

Suppose this could be done as part of #1202336: Add a key/value store API

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.