On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Similar to and inspired from the Spongestats Plugin I looked into other statistic solutions and found FireStats

    Installation:

    * Download and unzip the zip file into your preferred directory under your web root (ie : /firestats).
    * In your browser, open the root FireStats directory, and follow the rest of the instructions in the database configuration tab.
    * Optional: To add a site: go to the Sites management tab, create a new siteand click the help button next to the new site in the table for further instructions.

    In MODx, create a new plugin with the code below, check ’OnWebPagePrerender’ in the System Events tab, and save it as FireStats:

    $e = &$modx->Event;
    switch ($e->name) {
            case 'OnWebPagePrerender':
    	@include_once( $modx->config['base_path'].'firestats/php/db-hit.php');
            fs_add_site_hit(1);
            break;
            default :
                return;
            break;
    }
    


    Thanks to Laurent, and obviously Perrine too, who helped him coming up with that code.

    Configuration:

    Make sure the integer value in fs_add_site_hit(1) matches the ID you created in the Site Managment of FireStats for your site. You can track statistics for several sites on the same server with one installation. (Though for that case, you have to use an absolute path to db-hit.php in the plugin, untested)

    License:

    FireStats is only free for non-commercial use. You can however test it for 30 days on commercial sites

    Troubleshooting:

    On OpenSolaris, I was running into troubles during the installation, getting the following error:

    Error installing tables: Operation already in progress

    In that case, open /firestats/php/db-setup.php and comment out lines 15 - 19 and line 24.

    I found this bug in the stable version 1.3.6 stable as well as in the 1.4.3 RC1 version.
      René