Active
Project:
jStats
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
18 Jan 2012 at 21:14 UTC
Updated:
12 Mar 2013 at 14:14 UTC
Now that jstats.php returns before booting up drupal, you could have an option to have real time stats or bulk updated stats (what it currently does).
Another option is to populate the accesslog as well. In this case get the referrer via document.referrer, set the internal path via a drupal_add_js settings call, set the location via document.URL, and the title via document.title. Not really sure about the timer though.
Comments
Comment #1
DeFr commentedThe main problem with completely real time stats really the end user perceived performance as much as the load on the server(s) and letting MySQL cache warms a bit for the queries involving the jstats_node. I'm not sure how many real world installations both uses a reverse proxy in front of their page and are lowly loaded enough to be able to handle live stats.
With regards to the second option, in fact, in early versions of jStats, we were populating both
{accesslog}and{node_counter}of the core statistics module, but the results were not that good: you either need to have the core statistics module enable, and then the request that generates the page on the drupal side is counted two times (once by statistics_exit, once by the JS callback) or you need to have the core statistics module disabled and stole its tables, but then a bunch of contrib modules wisely suppose that if the statistics module is disabled, those tables don't exist, and you can't use the data e.g. in Views.Comment #2
DeFr commentedSpeaking about populating the core statistics table with @jcisio on IRC, we came up with a possible solution: having the core statistics module enabled, but with both variables 'statistics_count_content_views' and 'statistics_enable_access_log' set to 0 to prevent statistics_exit from logging them, and then having two variables jstats_count_content_views and jstats_enable_access_log should be enough to ensure the tables are in the database, and showing up in Views and without double records. It starts to sound like a plan !
Comment #3
jcisio commentedAnd we can also implement hook_exit, so that if statistics_count_content_views = 1, we decrease it by 1 in jstats_exit(). A penalty for users who do not read README nor go to module settings page. But more correct stats.
Comment #4
smoothify commentedI've been working on adding this functionality to jStats, earlier today I started adding the node_counter and access_log functionality.
#1414220: Functionality from unreleased module statistics_js
I just commited to my github repository a implementation of hook_init() which simply disables the core statistics access log and node_counter. (this is for 6.x, but it should be pretty much the same for 7.x)
https://github.com/smoothify/jstats/commit/fcaf9126b3075f9bbc54e1a663a2f...
https://github.com/smoothify/jstats/commits/
Once the rest of the functionality is in place, this will avoid duplicate inserts. It does however need some work on the UI aspects....
In this state, the options in Access Log settings would not work correctly any more - you try to enable them but it wouldn't stick. So, either they need to be hidden with a link to the jStats settings page, or they could be replaced with identical looking controls that control the jStats variables (e.g. jstats_count_content_views) instead.
Both are straightforward to do using form_alter but which would be the most intuitive behaviour ?
Comment #5
jcisio commented@smoothify I can see many good things in your github repository. Could you post it as separate patches? I think some could be committed right away, some will need works so that continue with smaller patches.
About your question, I think we can add an option to "Modify core access log options" in jstats to directly change and save these variables so that we won't have to change it in hook_init() and the Access Log settings page is still correct.
Comment #6
smoothify commented@jcisio - it is my intention to post some smaller patches, but the module is left in a not fully working state at the moment and I just haven't had time to complete. Also most of the changes are made are dependent on each other, if you add one bit you need to change the other. (unless there was something specific you saw)
The reason i suggest forcing the variable to change in hook_init, is because it could be confusing if site owners see the access log option disabled, but the access log still get populated (by jstats) - alternatively if its enabled then that would result in duplicate logs. Rather than have to document and explain this, it makes sense to me, to hide the process and work in the way it would be expected to.
Comment #7
sokrplare commentedAny ETA on this? Would love to use jStats (7.x), but need Views integration.Ignore - hadn't realized the "Recent count" field was already exposed - that'll do the trick!
Comment #8
playfulwolf commentedAre there any plans for this? I was looking for similar module, because my server is cached at multiple stages, and there are no solution for this situation.