Awstats plugin



This is a simple plugin that retrieves information from Awstats log files, currently only popular pages, search phrases, referrers and browser statistics. It provides template functions for including this information on your WordPress site.

Awstats is a web server statistics package that maintains a set of monthly statistics summaries (default in /var/lib/awstats). These files are used by this plugin to extract information that can be included in your web pages.

Installation

  1. Download the zip file.
  2. Drop the awstats.php file in your plugin directory.
  3. If necessary change the few lines at the top of the file to reflect the location of your awstats log files and the site string in the log filenames.
  4. Activate the plugin.

Usage

Insert something like

 <li id=\"popular\">Popular:
        <?php awstats_popular(); ?>
 </li>

in your template where you would like to have an overview of popular pages.

Insert something like

 <li id=\"searchwords\">Search words:
        <?php awstats_searchwords(); ?>
 </li>

in your template where you would like to have a search phrase overview.

Insert something like

 <li id=\"referrers\">Referrers:
        <?php awstats_referrers(); ?>
 </li>

in your template where you would like to have an overview of referrers.

Insert something like

 <li id=\"browsers\">Browsers:
        <?php awstats_browsers(); ?>
 </li>

in your template where you would like to have browser statistics.

The month for which the information is retrieved is the same as the month used in the get_calendar template function.

Update (12 May 2005)

I bumped the version to 1.0.

You can also add the heading string as parameter and omit the <li>-headers, e.g.

       <?php awstats_popular(10, 'Popular'); ?>
       <?php awstats_searchwords(10, 'Search phrases'); ?>
       <?php awstats_browsers('Browsers'); ?>
       <?php awstats_referrers(10, 'Referrers'); ?>

where 10 is the maximum number of items to be shown.

And you can invoke the template functions via do_action like:

       <?php do_action('awstats_popular', 10, 'Popular'); ?>
       <?php do_action('awstats_searchwords', 10, 'Search phrases'); ?>
       <?php do_action('awstats_browsers', 'Browsers'); ?>
       <?php do_action('awstats_referrers', 10, 'Referrers'); ?>

The extra parameters only work in WordPress 1.5.1 and higher.

Leave a Reply