4

I’m trying to create a hit counter for each published node. I’ve been googling this feature for Drupal 6.x and tried a few hits but with no luck.

I’ve enabled the Statistics module for my site and under admin/reports/settings I’ve enabled the counter but can’t seem to figure out how to put a hit counter on each overview page and node page.

I found a post explaining that I could use a customize query as such SELECT count(*) from accesslog where node = node but when I navigate to my database, the access log is empty (don’t know if it require to some time to enable the page / hit counter).

I want to count every hit and not only unique hits so each time a person access a node it should “just” increment a visitor number and I want to show it within my node-templates (not block) for some specific node content types.

I might miss something but any help or suggestions would really be appreciated.

1
  • What theme are you using? This should come out of the box. If you don't see the number of hits, switch to garland theme and check whether it's there.
    – BetaRide
    Commented Jan 30, 2012 at 14:18

3 Answers 3

6

There is a settings page at admin/reports/settings, try looking there first.

Also, look in the node_counter table instead of accesslog. The query should actually be as follows ($nid being the node ID of the node which you want records for).:

SELECT totalcount FROM {node_counter} WHERE nid = $nid;

On another note, I'm pretty sure if you enable the Statistics module, you can simply pull the node's page view count out in Views.

2
1

Also, if not doing sql's yourself and instead relying on the module putting in the links in your pages, after turning on the settings mentioned above, be aware of the permission view post access counter so users less than admins can see the information as well.

1

Maybe the visitors module might be a valid alternative to consider? Refer to its community docu for some more details.

Be aware: I'm the new maintainer of this module, it was unsupported until recently ...

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.