Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello my dears
How can I add ++1 to node's visit counter after request a page and before read the node's cache file?
the node' counter don't work properly after enable and use filecache! :(
best regards
Comments
Comment #1
rwohlebThis is a problem with ALL cacheing modules and external caches such as Varnish. You should take a look at the Better Statistics module (https://drupal.org/project/better_statistics) since it allows view counting via AJAX. However, the count on each page will still be stale during the lifetime of the cache. For example, if your cache time is 5 minutes, the count will only be out of date for 5 minutes, but the number will be correct once refreshed since it was continually collected.
If you really need the count to be fresh on every page load, you could write a custom module that serves the count via AJAX. Check the issue queue for Better Statistics to see if someone has already written one.
Comment #1.0
rwohlebCorrection syntax
Comment #2
ogi CreditAttribution: ogi commented