More updates for the wp-shortstat plugin

After upgrading to WordPress 2.01 the wp-shortstat plugin doesn’t work anymore. A google session later I found the reason for this problem in http://wordpress.org/support/topic/34905/page/2. The Goolge Sitemap plugin includes some WordPress admin functions and now wp-shortstat always thinks, you are admin and does not count any page. The suggested solution was to fix the sitemap plugin, but I think this plugin behaves correctly. So I fixed wp-shortstat the way that it does not test for admin functions anymore.

Meanwhile there are a couple of changes made to the plugin. Please send me your patches, if you want them included.

I created a special page for wp-shortstat now. Please move to https://www.happyarts.de/wp-shortstat/. The old german article is here.

30 Kommentare zu „More updates for the wp-shortstat plugin“

  1. I happen to get an error in the line: $url = parse_url($r->referer);
    is that a bug or is it only me. Thanks for the fixes.

  2. Pingback: Retro-PC » WordPress WP-ShortStat Plugin Fix

  3. Thanks for this fix. But interstingly, my stats are now off by several hours. Meaning, it’s logging hits as „February 6“ when it’s still „February 5.“ It’s almost as if it were on German time…
    Any idea how to get it back into my time zone?

  4. Oh, just to clarify, this is only affecting the „Hits in the last week“ box. The „Recent Referrers“ shows proper times, as does the „Just today as of…“ stat. But those hits were being atributed to the 6th instead of the 5th in the „Hits in the last week“ panel. Maybe that will sort itself out now that it’s past midnight here. The gap of time my wp-shortstat wasn’t working seems to approximate the time the stats are off by.

  5. Thanks for all the comments. I’ve fixed the date/time handling for the Todays Hits box. The other boxes where fixed already by someone other. You have to configure the correct time offset in the WordPress|Options|Date and Time section. In the new version I also included the CSS changes from WebKeyDesign (Thx!). I don’t now something about the parse_url-Error reported by blimmer.

  6. for the admin check I’d suggest an addon, as there are blogs out in the wild where you can’t post comments without logging in as a spectator – and these spectators should be counted. So my suggestion is to check whether the current user has admin privileges.
    Another idea would be to change the filter where ShortStat steps into the action. Currently it fires at each html response (resulting in being started in admin panel as well) – it would be advisable to use another filter like the page-footer, coz this way there’d be no problem anymore with the admin panel.
    Another issue isn’t fixed yet as well – the post preview. As there exists a conditional tag is_preview() – as far as i know at least ;) – it should be applied as well to make sure that no previews get into account by accident.

  7. CountZero: you are right, sometimes logged in users should be counted. I changed the code in the next version to:

    if($wpdb->is_admin()
    || is_404()
    || is_preview()
    || isset($_COOKIE[‚wordpressuser_‘.$cookiehash])
    || strstr($_SERVER[‚PHP_SELF‘], ‚wp-login.php‘)
    )return;

    Your suggestion is_preview is now included. But about the filter: wp-shotstat hooks in as shutdown code:

    add_action(’shutdown‘, array(&$wpss, ‚track‘));

    Do you see a better solution?

  8. I’m not that deep into the WP sources yet, but I assume that this shutdown filter is applied near the end of all code that is parsed in the process of a response generation (i.e.: rendering a page). One should find a filter that’s not fired up in the admin panel at all – this would result in the effect that there’d be no need to check against that area anymore.

    another nice suggestion would be a complete localization of the plugin with the .po/.mo facilities ;) it looks harder than it is, actually; I got that stuff working fine for my theme thanks to the good documentation on the wordpress sites almost instantly. :D

  9. Pingback: Anonymous

  10. Pingback: Renew Your Mind » Upgrades

  11. I’ve upgraded to 1.3.6 but the time-shift problem is still there, sort of. My time zone is set correctly in the options and is working for posts, comments, etc. WP-shortstat is reading it properly in all places except the „Hits in the last week“ section where it attributes hits to the wrong day. Here’s a screen shot for an example.

    http://www.davidvanwert.com/wp-content/uploads/wpss-shot.jpg

    The stat counts match now, however. Previously, the „Just now as of time/date“ number would be different than the number in the Current Day (tomorrow!) slot. But you can see that short stat gets my time/date right in the „Just now as of“ slot.

    Perhaps I’m just a man ahead of my time. By a day. Or am I behind the times? I can’t tell.

  12. Hi and thanks for updating this wonderful plugin. I wish to know how could i reset my shortstat stats and to inform you that even with this 1.3.6 vesrion, my WP 2.0.1 still cannot determine the visitors‘ country origin…..anyway of fixing it?

  13. Pingback: 880012: A Ship and a Dream » The Fix is In: wp-shortstat in Wordpress 2.0.1

  14. Markus, with regards to the parse error I mentioned earlier, it has been resolved after I reverted to php4 from php5. It was a server side error, nothing whatsoever to do with your plugin fix.

    danke

  15. Thanks for the plugin! It’s very useful and its port for 2.0 was very apreciated!

    But is there any chance to know why on my 2.0.1 installation of WP which is upgrade from 1.5.1.3 the page generation time for the statistics page is about 40 (FORTY!!!!!) seconds?

  16. I’ve added the calculation of unique users and expanded the statistics to two weeks, this is very slow on some old MySQL servers. I’ll change this in a future version.

  17. Pingback: aBlogByGus » Stats Plugins for WordPress

  18. Pingback: Confessions of a Geeky Mama » Blog Archive » Shortstat for WP 2.01 and other stat miscellany

Kommentar verfassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.