When a user edits any content the number times it has been read increase by blocks of three. This artificially inflates the statistics.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | stats.patch | 1 KB | svemir |
When a user edits any content the number times it has been read increase by blocks of three. This artificially inflates the statistics.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | stats.patch | 1 KB | svemir |
Comments
Comment #1
svemir commentedThis patch skips the 'statistics_count_content_views' part of statistics_exit function when the secod argument it receives is 'edit'. This solves the reported issue itself, but I think that a more general change may be needed here.
While tracking (statistics_enable_access_log) should be done for every click, multiple "reads" by the same user in the same session probably should not. User's session could remember what the user recently read and the counter would not be increased for those articles again. Please note that I am saying this without having checked the way Drupal deals with sessions. Of course we could also check the access log, but that would mean more database queries, or even a dependency on other variables set by the same module (currently it is possible to have counting on without other stats being tracked.)
Actually this brings me to one feature that would be very useful - recently viewed nodes block. That is VERY useful in some non-Drupal systems I worked on. I even wished Drupal.org had it had while I was preparing to post this very patch... It could even be a block provided by statistics module itself, as it already provides similar things. But again, maybe that already exists in some way, or it could be better provided by some other module?
Comment #2
chx commented4.5.x most probably won't see another release and Dries has reworked statistics for 4.6 so setting to Won't fix.
Comment #3
chx commentednode/nid/my/module/definies/something/here could be an edit or a view. So it's by design, regardless of 4.5 or 4.6. And Dries' rewrite did not effect this part.