| 1) | Create a directory named "stat/" in the root directory of a web site you are going to place ActiveStat on; |
| 2) | Unpack the activestat-2.3.tar.gz file content into the directory; |
| 3) | Specify MySQL database (to be used as statistics storage) credentials: host, database name, user and password in the stat/cfg/database.cfg.php file; |
| 4) | For Windows - also specify database settings in the /stat/external/setup/setup.bat file; |
| 5) | Change to the stat/external/setup/ directory; |
| 6) | Fix paths to mysql.exe and php.exe in the setup.bat file (for Windows) or to mysql and php binaries in the setup.sh file (for Linux); |
| 7) | Execute (Note! If the specified database already exists it will be dropped!) |
| | for Linux:
| ./setup.sh test | - optional: to make sure your settings are OK |
| ./setup.sh install | - to create a database, fill it with initial data |
for Windows:
| setup.bat install | - to create a database, fill it with initial data |
|
| | If you wish to install the ActiveStat tables into an existing database without it being recreated, please use:
| ./setup.sh instsafe | - for Linux |
| setup.bat instsafe | - for Windows |
|
| 8) |
Schedule automatic execution of the stat/cron/daily.php script to run it repeatedly (e.g., every 5 minutes). |
| |
For Linux, you should edit your crontab as shown in stat/cron/crontab.example.txt:
| crontab -e | - to edit your crontab |
For Windows, use another scheduler (you can use a cron ported to Windows or a built-in scheduler).
For example, in Windows XP:
Go to Control Panel -> Scheduled Tasks. Press 'Add scheduled task'.
In the wizard, press 'Next' and then 'Browse'.
Select the path_to\stat\cron\jobs.cmd script, press 'Next'.
Name the task (e.g. 'ActiveStat Jobs').
Set the 'daily' option, then press 'Next' twice.
Specify username/password of an account the task will be run under.
Check the 'Open advanced properties for this task when I click Finish' option.
Click Finish.
This will display the 'ActiveStat Jobs' task property dialog. Then:
Switch to the 'Schedule' sheet.
Set Start Time = 12:00 AM.
Press 'Advanced' to display the 'Advanced Schedule Options' dialog.
Check the 'Repeat task' option.
Set an interval (Every 5 minutes).
Set 'Duration'-'Until': 24 hours.
Press 'OK' to submit your advanced options.
Switch to the 'Settings' sheet.
Uncheck the 'Stop task...' option
Press 'OK' to store your scheduled task.
|
|
| 9) | Edit ActiveStat's configuration files: |
| | Stat/cfg/stat.cfg.php
The most important constants you must set in this file are:
| $stat_site_id |
- default SITE ID for statistic information collected. Mainly used by the "EMBEDDING STATISTICS AS PHP-CODE" method; or by the other method if for some reason SITE ID was not defined in the JS-code.
Note: site IDs are defined in the Definitions/Sites menu of the administration interface. |
| $stat_visit_ttl |
- max delay between visitor's clicks to be assigned to the same visit
(you may choose to keep the default value of 10 minutes). |
Other parameters may keep their default settings, but to adjust
the behavior of ActiveStat so it better
suits your needs, you'll have to change them. Here is how you can do it:
| $stat_write_unk_site | - if the parameter is set to 0, all visits from non-defined sites (see: Administration Interface/Definitions won't be recorded; if set to 1 - all visits will be recorded with unknown sites defined automatically. |
| $stat_redirect_url | - represents the URL to which a visitor with 'access denied' will be redirected by default. |
| $stat_store_plugins | - whether or not to store navigator plug-in information: 1- yes, 0 - no. |
| $statHttpVars | - array containing definition of parameters to be stored without any transformation: array(PHP_variable_name => parameter_type_name) |
|
| | Stat/cfg/cron.cfg.php
This file is used to configure the jobs.php scheduled script,
responsible for marking of visits and sending reports on marks, newly
requested non-existent resources and referrers. It also performs delayed
deletion of data if scheduled from the administration interface.
| The following parameters determine who's to receive a task status report and in which form. |
| $stat_cron_admin_as | - specify if the script will produce the admin's report. Available are the following constants: STAT_CR_NO - no report, STAT_CR_MAIL - send mail, STAT_CR_FILE - save report to file. |
| $stat_cron_admin_to | - this variable contains either an email address the report will be sent to, if… $stat_cron_rpt_as = STAT_CR_MAIL; or the name of a file the report will be saved to, if … $stat_cron_rpt_as = STAT_CR_FILE |
| $stat_cron_admin_subj | - subject of the report |
| |
| The following parameters determine who’s to receive reports on a certain task and in which form. |
$stat_cron = array(
JOB_MARKING => array (
"as" => ... // like stat_cron_admin_as
"to" => ... // like stat_cron_admin_to (comma separated list of emails)
"subj" => ... // like stat_cron_admin_subj
),
JOB_REQ_URL => array (
... // like for a previous task
),
JOB_REFERRER => array (
...
),
JOB_CLEANUP => array (
...
)
);
|
'Daily' parameters determine common settings for the JOB_MARKING, JOB_REQ_URL and JOB_REFERRER jobs,
'Cleanup' parameters are related to delayed deletion of information scheduled from the administration interface:
| $stat_cron_params = array('daily' => ..., 'cleanup' => ...) contains additional job parameters related to schedule. |
| |
'daily' => array(
'starttime' => '06:00', // time for a 'daily' task to start (24 hour format)
'timeout' => 2 * 60 * 60 // timeout in seconds for resetting task status
),
'cleanup' => array(
'timeout' => 30 * 60 // timeout in seconds for resetting task status
)
|
|
| | Stat/cfg/reports.cfg.php
Contains constants that influence the reports interface. Here you can
change the following parameters:
| $statPreselectedSites | - IDs of sites to be pre-selected in reports (see Reports/Options); |
| $stat_list_separator | - to change a separator for CSV-export; |
| $statSBY array | - to specify your own values for the "Show by" list box to be able to get reports by desired periods of days; |
| $statSBYN | - to change it in accordance with the changes in $statSBY - allows you to set a count of periods to be displayed on a page for each period you have defined in the $statSBY array; |
| $statPltMnuFields, $statPltFields | - to configure menu items in the "PLATFORM" menu and the Platform fields in the "visit details" popup window respectively. |
| $statBShowCount, $statWShowCount | - default count of records in the "Visits list" and "Detailed visits list" respectively. |
|
| 10) | Protect administration and reporting interfaces by means provided by your web server. For example: |
| |
For Apache, you can set passwords using the "htpasswd" tool from the Apache bin/ directory and then configure .htaccess file.
(For more information on how to protect an application, please turn to your server documentation, namely, Authentication, Authorization, and Access Control sections).
For IIS, you can grant access to the application for specified domain users (Your_server_properties/Directory Security). |
|
| 11) | Define your sites that statistics will be gathered on
(if $stat_write_unk_site variable has been set to 0 in stat.cf.php): |
| |
Log in to the administration interface of the ActiveStat application (having just been installed) (http://your.web.site/stat/admin/).
Select the "Definitions/Sites" menu item.
Add your sites to the "Site Management" page. |
|