NAME
WWW::Statistics - Perl extension for genarate and manage web site statistics
SYNOPSIS
use WWW::Statistics;
blah blah blah
DESCRIPTION
This module allow you to simply manage statistics for web site. It generate a really simple database, and give you all methods to manage it easily. With WWW::Statistics you can make your own statistics admin interface really simply.
EXPORT
None by default.
METHODS
new : constructor. Arguments are : DB_HOST : IP adress or hostname of the database (default is 127.0.0.1)
DB_USER : A username wich is authoryzed to connect to database (default is undef) DB_PASSWORD : The password associates with DBUSER (default is undef) DB_DATABASE : the database name (default is undef) DB_TYPE : the DBI driver name (default is 'mysql') IMAGES_DIR : the directory where we can found images for using in HTML graph generation. (optionnal)
Moreover, you can pass all arguments wich are definable by followings accessors.
setMSTN(VALUE) :
accessor for setting MAIN_STAT_TABLE_NAME
getMSTN :
accessor for getting value of MAIN_STAT_TABLE_NAME
setBACKUP_TABLE_NAME(VALUE) :
accessor for setting BACKUP_TABLE_NAME
getBACKUP_TABLE_NAME :
accessor for getting value of BACKUP_TABLE_NAME
setBACKUP_DESCRIPTION(VALUE) :
accessor for setting BACKUP_DESCRIPTION
getBACKUP_DESCRIPTION :
accessor for getting value of BACKUP_DESCRIPTION
setIMAGES_DIR(VALUE) :
accessor for setting IMAGES_DIR
getIMAGES_DIR :
accessor for getting value of IMAGES_DIR
addMainPages :
Add a page to the main stats table (MAIN_STAT_TABLE_NAME)
dropMainPages :
drop a page to the main stats table (MAIN_STAT_TABLE_NAME)
getIDfromPage(PAGE_NAME) :
return the id of PAGE_NAME. Be carefull with this because if you have 2 pages with same name thereturned result will random...
initDataBase :
create and initialyzed the main database. Arguments are : PAGES_LIST : a list of pages you want to manage statistics for. Pass arguments as string (ex: 'index.pl,news.pl,pub.html'). Separator is the coma (','). If you don't have set it before : MAIN_STAT_TABLE_NAME the main statistics table (where are record current stats).
initBackupDatabase :
create the backup database
decrMainPage(ID_PAGE) :
decrement the page identified by ID_PAGE
incrMainPage(ID_PAGE) :
increment the page identified by ID_PAGE
updateBackupDBschema :
update the backup table's schema from the main table one.
backupStats :
backup statistics.
generateHTMLBackupGraph :
generate (and return) an HTML <TABLE> wich contain a graph of the specified backup is (see generateHTMLMainGraph method for explanation of arguments)
generateHTMLMainGraph :
generate (and return) an HTML <TABLE> wich contain the graph of main table. Arguments are : IMAGES_DIR : if you don't have set it before, the directory where we can find images wich we use to generate the graph. TABLE_NAME_FONT : opening HTML tag <FONT> wich determine the font of text inside <TD> TABLE_TAG : HTML tag <TABLE> you can specify special tag here TR_TAG : specify your <TR> tag here TD_TAG : specify your <TD> tag here TH_TAG : specify your <TH> tag here IMAGES_CYCLING : 0 or 1. If enable module choose one per one the different images wich are present in IMAGES_DIR. Else the module choose the first image. IMAGES_LIST : specify a list of images you want to use (as a string like 'img1.png,image.gif,logo.xpm' separator is a coma). (OPTIONNAL) IMG_TAG : specify your <IMG> tag here. Default is : <IMG SRC=__IMGSRC__ ALIGN=__IMGALIGN__ WIDTH=__IMGWIDTH__ HEIGHT=__IMGHEIGHT__>. You can use __IMGSRC__, __IMGALIGN__, __IMGWIDTH__ and __IMGHEIGHT__ as variables. Default values are : __IMGSRC__ : IMAGES_DIR/first image in directory. Accessed by IMAGES_DIR and IMAGES_LIST __IMGALIGN__ : CENTER. Accessed by IMG_ALIGN_TAG __IMGWIDTH__ : 4 * number of hits. Accessed by POINT_FOR_PIXEL __IMGHEIGHT__ : 9. Accessed by IMG_HEIGHT_TAG You can access to thoses variables by followings parameters and use them as variables in your own <IMG> tag. PIXELS_FOR_POINT : specify the number of pixels you want for a point in statistics. Default is 4 pixels. For example, if you have 10 hits on a page, the image wich represent this value may have 40 pixels long.
WARNING : all *_TAG options accept a string as HTML tag but ONLY THE OPENNING ONE !! Tags are closed by the module. Moreover, they all are optionnals.
generateGDGraph :
use the GD module to generate a graph (freshmeat like) of the statistics from the backup table.
reIndexBackupTable :
re-index the id_backup column of BACKUP_TABLE_NAME.
getMaxFromBackup :
get the maximum id of BACKUP_TABLE_NAME all columns included.
Heritage
WWW::Statistics heritate from DB::DBinterface so read this module manpage to having a description of his own methods and functions.
SEE ALSO
DB::DBinterface
AUTHOR
DUPUIS Arnaud, <a.dupuis@infinityperl.org>
COPYRIGHT AND LICENSE
Copyright (C) 2004 by DUPUIS Arnaud
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 979:
'=item' outside of any '=over'
- Around line 1121:
You forgot a '=back' before '=head2'