CNStats 4.2 User Manual
In Case of First CNStats Installation:
1. Download the last version of CNStats STD distribution kit at the official site.
Note: To obtain CNStats PRO distribution kit upon the purchase, please contact "CN-Software" Ltd. support team. (As a rule, the distribution kit is sent by e-mail).
2. Unpack the obtained archive (/cnstats folder with files and sub-directories ('sub-folders') will be created);
3. Copy /cnstats with its contents to the root directory of your web-site. As a rule it is executed with the help of an FTP-client.
As a result, /cnstats directory will appear on the server.
Note: We strongly recommend renaming /cnstats folder with the name that does not contain frequently used words for website counters and stats recording systems. Thus, you will avoid content blocking systems such as firewalls and antivirus programs. For example, some versions of Kaspersky antivirus blocks access to all addresses containing /cnstats/, /cnt/, /counter/, /stats/. These are poor words for the directory with the statistics system installed. Such names as "/mike-stats/","/mstat/", "/s-mysite/" and so on are fine.
Further in the manual we will still use "/cnstats" for the statistics folder.
Note: CNStats can function in any directory or even in the server root.
The directory structure should be as follows:
- root directory of the web-site/
4. Run installation script by indicating /install/index.php location in the address box of your browser, for instance: http://yours.server.com/cnstats/install/. As a result, a dialogue box will appear on the screen;
5. Enter the following data:
- MySql: server, login, password – data, required for the MySql server connection. The fields "Server", "Login" and "Password" are filled in with standard values ("localhost", "root" and blank password correspondingly) by default. Enter your own data or data given by your hosting providers or database administrators.
- MySql: database name – name of the database, where tables for statistics storage will be created by the MySql server. Default name is "cnstats"; it is possible to choose any.
- MySql: prefix for CNStats tables – prefix for CNStats tables names. Owing to it, you can use CNStats even if your hosting-provider supplied you with access to only one database;
- Registration domain – Domain, for which the register key is given (or will be given);
- Login – Login for the statistics interface;
- Password – Password for the statistics interface;
- Administrator's e-mail – E-Mail for receiving CNStats errors notifications; the specified address will be also used as the return address for reports, sent by e-mail;
- Save statistics for the period of – period of full data storage in days (40 days by default). Summary statistics is stored for the whole period of the site existence;
- Type of the counter – For detailed information, please, refer to "Counter Types";
Later, you will be able to change necessary data by editing config.php file.
6. After clicking the Next button, all necessary tables will be created in the database. If the database does not exist, the installation script will try to create it.
Then the contents of the configuration file will be displayed; you should create 'config.php' file in /cnstats folder on the web-server and insert these data.
7. Delete ./install/ folder from the server.
8. Indicate the path to the installed program in the browser, for instance http://yours.server.com/cnstats/. Select CNStats interface language from the pop-up menu, then enter E-Mail and password which you have specified during installation: the application's main window should appear in the browser.
10. Enter the obtained register key into the corresponding field at the registration page;
11. Further you should get the statistics code (mandatory) and the counter code (optionally) from the menu section "Configuration" -> "Counter code" and install it into all web-pages of your web-site. (For detailed information about types of counter code, please, refer to "Counter Types")
12. Open any web-page where you have installed the code. Check the correctness of the installation visually.
13. Enter menu section "Miscellaneous" -> "View log". Make sure that your visit has been counted and the system has started accumulating statistics.
The following installation steps should be performed only for CNStats PRO edition.
14. Set rights for files cnstats/reports/cnstats_midnight.pl and cnstats/reports/cnstats_night.pl. These files should be run by a task planner, for example, crontab. These files sould not be run by outside visitors. In Unix systems these rights are usually set with the help of chmod command:
chmod 700 /path/to/your/site/cnstats/reports/cnstats_midnight.pl
chmod 700 /path/to/your/site/cnstats/reports/cnstats_night.pl
15. Add the following tasks to the task planner (for example, crontab):
0 0 * * * /path/to/your/site/cnstats/reports/cnstats_midnight.pl
18 0 * * * /path/to/your/site/cnstats/reports/cnstats_night.pl
Note: Perl-script cnstats_midnight.pl should be executed exactly at midnight, it does not make vast amount of calculations and almost does not overload the server.
Perl-script cnstats_night.pl should be executed right after cnstats_midnight.pl, but it may load the server; therefore, it is recommended to run the script at the time of minimum workload of the server. As a rule, it is 3-5 a.m. In the given example cnstats_night.pl is run at 0.18 a.m. - it is the optimal time.