I use Wp-StatTraq for Wordpress stats. The downside is that it’s not updated very quickly for new versions of Wordpress. Luckily, the same version of WP-StatTraq that was patched for Wordpress 1.5.2 will work almost perfectly for Wordpress 2.0 as well without any changes. But there is one issue.
The one issue is that surfing around in the admin screens will occasionally register as a view to the site in StatTraq. For example, when editing a post the rich text editor apparently does a standard request of the post’s page to pull in the contents of the post. You can’t filter that the same way, because the request itself is the same as any other request for that post. At least, that’s the way it appears in the logs.
Also, whenever there’s a request for the rich text editor Javascript code (stored in a separate file) from the admin panel, StatTraq counts that as a hit as well, because it’s outside the wp-admin directory path and therefore doesn’t match any of the directories that it knows to exclude from the stats.
A possible fix would be to add a check to the stattraq.php file in the plugins directory. Line 54 filters out a few requests that shouldn’t be counted, such as requests containing wp-admin. A new line after that to check the HTTP referer, and not count it if the referer contains “wp-admin/post.php”, should take care of any extra hits like these.
Actually, I might prefer doing a fix where I just filter out wp-admin from the referer all the time. That would fix these issues, and also filter out some actual hits if you clicked a “view” link from the admin panel, but that’s ok with me. I don’t mind filtering out my views from the statistics.
In fact, I’d prefer it to never count my requests. I keep thinking I might patch it to do that by hardcoding my IP address in that location in the file and telling it to not count any requests from me.
Obviously, a “robust” and “good” solution would be to make it a configuration option and allow a list of IPs to ignore, but since it’s not my plugin and I just care about hacking it to do what I want, I don’t think I’ll actually do that.
Short version of this post: 1.5.2 version of the plugin works well, just with some extra hits from admin access. If you can live with that, cool. If not, there are some quick (1 or 2 line) edits you can make to the plugin. Those are all left as an exercise for the reader.