AWStats Google Chart API plugin

I use AWStats for website statistics for a lot of sites and I'm perfectly happy with the software. AWStats can be run as a CGI or standalone for the creation of static html pages with statistics.

The chart capabilities of AWStats are fairly limited, however. So I searched for a plug-in to replace the complicated tables for barcharts in AWStats with Google Chart API images to reduce the html page size and to provide cleaner charts.

Such a plug-in didn't exist, so I build my own based on the graphapplet.pm which is provided which AWStats, but experimental, and displays charts using a Java applet. I'm not a big fan of using Java in web pages as the plug-in tends to slow down the loading and introduces security troubles.

So here it is, a first version of the Google Chart API plugin for AWStats. It is fairly simple and it works very fast. Also it reduces the main statistic html page from about 70 KB to around 40 KB, so it loads much faster.

Disclaimer: no warranties, use a your own risk, your milage may very, etc., etc.

To use the plug-in, use a AWStats with version 6 or up. To install the plug-in, replace the graphapplet.pm file in the plugin directory of the AWStats installation with the one below. Backup the original file to be safe. I can't add a module with a different name because that would require changes to the core AWStats module itself.

Also activate the loading of the plugin using the following directive in your AWStats config file:


LoadPlugin="graphapplet"

Update 13-12-2010: AWStats 7.0 release with Google charts

Comments or suggestions? Please let me know.

AttachmentSize
graphapplet.pm3.56 KB
Your rating: None Average: 3.4 (17 votes)
Anonieme bezoeker's picture

slight problem

4

Hi, excellent job creating the googlechartapi plugin! Thank you very much for that.
There is slight issue with the operating systems chart. When the OSes are Windows, Linux, Mac then everything is ok, once any other non-standard OS is added (java, playstation etc) the url for the picture changes to: 'http...Linux|Macintosh|

Teri Ticher's picture

Krass

Tja, Sachverhalte können so simpel erscheinen. Danke :)

Mike Kellenberger's picture

Works, with one exception

A great plugin. I always thought that the awstats graphs didn't look sexy, but now they definitely do!

One small problem though: the OS graph does not show as soon as there are OS with links (e.g. Symbian). The link to to graph looks like this:

The HTML of the OS Name would probably have to be stripped before passing the name to the chart URL.

And the localization is not perfect either. In the case above with OS, awstats in German shows "Unbekannt", but the english "unknown" gets passed to the chart URL.

Keep up the good work!

Cheers,

Mike

Anonieme bezoeker's picture

Just noticed your comment, I

Just noticed your comment, I have the same issue:) Already added comment regarding the same topic

George Moses's picture

AWStats Google Chart API plugin in AWStats release

I recently received mail from the author of the AWStats package that the plugin is included in the development version of AWStats (CVS version) under the name of "graphgooglechartapi". I'll update the plugin soon to display all the bars of the AWStats charts.

George Moses's picture

AWStats Google Chart API plugin included in AWStats 7.0

Today AWStats 7.0 was release including the new AWStats Google Chart API plugin. See: AWStats 7.0 release with Google charts.

J Jameson's picture

Plugin

Nice plugin. Glad i can receive it without any problems here. It is very helpful!

Freespacer's picture

Thanks, for this plugin. But

Thanks, for this plugin.

But in my case, I have german umlauts in the name of month (e.g., März = March).

After these lines (near line 19-20):

#use strict;
no strict "refs";

I add follow lines:

use HTML::Entities;
use utf8;

Change this line (near line 133):

# display labels
foreach my $i (1..(scalar @$blocklabel)) {
$b = "".@$blocklabel[$i-1];
$b = substr($b,0,$maxlabellen);
print $b ."|";
}

Into this line:

# display labels
foreach my $i (1..(scalar @$blocklabel)) {
$b = "".decode_entities(@$blocklabel[$i-1]);
$b = substr($b,0,$maxlabellen);
$b = encode_utf8($b);
print $b ."|";
}

Have a nice day. ;-)

urodelomutante's picture

it works!

Hello.
Thank you for sharing your plugin. I've tested it right now on Debian Lenny for sparc + apache2 + awstats 6.95. It's faster than the one which uses java, and doesn't bother if your browser doesn't support or disables java. I could never let the graphapplet working before, this solution has solved my problem :-) Thanks a lot.

About MO6.me

This is a personal blog of George Moses. George is a webdeveloper specialized in Drupal and co-founder, partner and CTO of Dynamic Presentations, an Internet Solutions Provider based in The Netherlands.
More about MO6.me.

MO6 in Dutch: MO6.nl

MO6 on the web

MO6