By Julien PHAM on
Hi,
About all the statistics, the number of pages visited, the number of times a page has been viewed, and the like, is there a way to setup drupal to not count administrator browsing?
Thanks
Hi,
About all the statistics, the number of pages visited, the number of times a page has been viewed, and the like, is there a way to setup drupal to not count administrator browsing?
Thanks
Comments
Ignor administrator (user 1) hits
There are no "settings" to do this. You would need to add some code to the statistics.module in the function statistics_exit(). Since the $user variable is available inside the function just adding something like this just after the global declarations would work.
Here is my patch to
Here is my patch to statistics_exit(), to skip views of administration pages, user pages and captcha images, or skip everything if user #1.
Thanks. btw do you know how
Thanks. btw do you know how to clear the counter? As my site is under development, and i would like all pages to show 0 views once my site goes live.
clear the statistics
The easiest way is to go to the statistics settings page and drop the "Discard access logs older than:" interval to 1 hour. Change it back to where you want it when you go-live.
- or -
The statistics.module runs the following SQL statement via the cron_hook:
So if you have access to your mysql database (phpMyAdmin) you could run this statement to reset everything to 0
I tried to truncate this
I tried to truncate this accesslog, but when I go back to my website I still view, for a node : read 6 times, for example...
Go the easy route...
... by going to the statistics settings page and drop the "Discard access logs older than:" interval to 1 hour.
After one hour check it again. (This assumes that you have a scheduled job running cron.php at least once an hour). If in doubt just run cron.php manually.
If the access log is empty then you should not see any "reads". either the "Truncate" is not correct or the page is cached.
But your solution seems
But your solution seems strange... imagine I want to discard access logs every 2 weeks. Does it mean for example, a page will be shown as read 5 times, then 10, then 20, and after two weeks this page will be shown as read 0 times, so never read? Seems kinda strange, and it makes me doubt this is what I'm talking about...
I think what I'm talking about is more the second page of this statistic settings:
Count content views:
Enabled
Disabled
Increment a counter each time content is viewed.
So I wonder where is stored this counter...
Back up a little bit...
Your question was "how to clear the statistics for a go-live" and my suggestions were to that point. Since you were not able to truncate the table I recommended the "settings" approach. Set the time limit to one hour, go to lunch and when you return after the one hour your statistics should be clear... assuming that there was not any other visits and that your cron.php had been run.
In practice the settings will delete and statisitcs OLDER than the limit set. So after two weeks you will see statistics for only the last two weeks ... not zero - unless of course no one visited your site in those two weeks.
But I was not talking of the
But I was not talking of the statitics where they say what visitor visits a given page, I'm just talking about the counter, you know, the one that is displayed with any node and says how many times this node has been read.
Clearing the counter
The individual node counter statistics are in the table node_counter. Executing the SQL statement
TRUNCATE node_counterwill clear all of your node read totals.Thanks
Thanks
I'm glad you have a patch
I'm glad you have a patch for this. My one question is: Where do you place this in the "statistics_exit()" function. Do you place all inside code inside this logic or .... ? If you would copy / paste the entire function you have that would be VERY helpful to me. Thanks in advance.
» Respectfully, GreenLED
» Download Spybot
Add me to the list of folks
Add me to the list of folks who would like to have some minimal control over what gets added to the statistics tracking. My site is small and robot hits are the majority of what I get, and second to that is my own hits that happen while I navigate around.
It seems like it would be very useful to have the option to exclude your own account from statistics tracking, or possibly exclude the submitter from being tracked for their own content. It seems reasonable and simple enough to at least exclude the submitter from being tracked in their own statistics for viewing their own content since that's a very common thing for people to do as they consider modifications.
Being able to exclude robots through some rule system, which I don't think could ever be 100% accurate given how bots tend to ignore rules, would be helpful in allowing those of us interested in reducing tracking statistics we aren't interested in to affect what data is stored.
IMHO the statistics module should record the statistics the admins are interested in as opposed to logging everything that a statistic could be derived from. My own host charges flat fees based on consumed bandwidth and disk usage and I'd prefer to not persist data unless I expect to use it since there is a very real (albeit small in my case) dollar cost involved.
- Eric Cosky
It appears the
It appears the statistic_filter module provides this functionality. Yay :)
here we go
the statistic module is not working for drupal5. but i found how to acheive this here:
http://drupal.org/node/129971
enjoy;)
Is this a drupal 5 version
Hi,
I solved the recent hits without superadmin/first user logs with the SQL query on function statistics_recent_hits()
changed the sql to:
.
.
Is there any way to exclude sigle IP from statistic?
Hello, thanks for this hint, now i would like to exclude Google IP (66.249.72.5) from my website...
I have activated google analytics module, so Google always visit my website, to check the visitor number i think... and when i go to see statistics there are lot of double entries, one from the visitor, and the other from google... And also in "Recent log entries" i have lot of access denied warnings because of Google, i would like keep using google analytics (because of the localization of visitors), and the statistic module (because of the ip of visitors)
Does anyone can suggest me anything? Thanks
How to prevent certain IP(s) from incrementing the node counter
Hi,
I don't have a patch but hopefully some super easy PHP that you can add to your statistics.module so that the IPs you specify are excluded from incrementing content / node views. I added this to my Drupal 5.2 site (I don't think the statistics code has changed much, so you should be able to use this for 4.x and 6.x, hopefully) and it works. Before the line "db_query('UPDATE {node_counter} ..." in the function statistics_exit, add these two lines:
and then wrap the db_query UPDATE in this if:
so the whole thing looks like:
To customize this snippet all you need to edit are the IPs. Feel free to use only one IP or as many as you like, separated by commas.
Regards, Geoff
Page counts are in node_counter table
SELECT * FROM `drupal`.`node_counter` order by totalcount desc
I'm glad you have a patch
I'm glad you have a patch for this. My one question is: Where do you place this in the "statistics_exit()" function. Do you place all inside code inside this logic or .... ? If you would copy / paste the entire function you have that would be VERY helpful to me. Thanks in advance.
» Respectfully, GreenLED
» Download Spybot
Statistics Advanced Module
There is also the Statistics Advanced module that also provides this functionality.