Installation of the system counter
It's necessary to install a system counter at the website's pages to collect the statistics about the traffic at this website.
Counter code is inserted into the HTML document body, i.e. between the tags <boby> (<boby>counter code</boby>).
You are recommended to locate the counter as close to the beginning of the page as possible.
In case clicks analysis feature is used, the counter should be installed in accordance with
the following instructions.
There are several allowed types of website pages:
1. HTML pages (http://domain.com/index.html?trader=ID)
SSI is used to insert the system counter into HTML pages.
The code of the following type
<!--#INCLUDE VIRTUAL ="/cgi-bin/cacount.cgi?cafn=load" -->
Setting group for traffic analyzed at a given site or page (GROUP - name of the group):
<!--#INCLUDE VIRTUAL ="/cgi-bin/cacount.cgi?cafn=load&grp=GROUP" -->
Imagine that the page with the counter is located at the Web-address http://mydomain.com/index.html,
and the system is installed into http://mydomain.com/cgi-bin/ is inserted into the HTML code of the page.
As soon as the system counter is installed, the image will appear at the pages containing it.
If there is no image at these pages after the installation of the counter, the following options are possible:
- There is an inscription saying [an error occurred while processing this directive] at the place where the image has to be.
This means that the SSI is working but there's a mistake in the code.
For instance, there may be extra spaces or the stated cacount.cgi directory is wrong.
- Nothing at all appears. You should re-check the initial document code - if it contains the line saying
<!--#INCLUDE VIRTUAL ="/cgi-bin/cacount.cgi?cafn=load" -->, it means that the Web-server does not support SSI or SSI
is not working in the html (htm) files. Frequently SSI is not supported in the html (htm) files because the shtml or shtm are used.
The make SSI work in HTML files, do the following: create a text file named .htaccess (with no expansion stated and with the dot in the beginning of the file name)
in the root of the site or edit the existing one. Add the following line into this file: "AddHandler server-parsed .html"
("AddOutputFilter INCLUDES .html").
If after that SSI is still not working, contact the support service of the hosting.
2. PHP pages (http://domain.com/main.php?trader=ID)
For the system counter to be inserted into a PHP page successfully, the code of the PHP file opening the HTML
(http://domain.com/main.php->main.php) should be open, i.e. the PHP file should not be coded (Zend).
You should edit the PHP file and find the part of the code responsible for the display of the page's HTML .
After that you should insert the following PHP code between tags <boby> (and change the cacount.cgi directory into your own one).
<?php
virtual("/cgi-bin/tca/cacount.cgi?cafn=load");
?>
Setting group for traffic analyzed at a given site or page (GROUP - name of the group):
<?php
virtual("/cgi-bin/tca/cacount.cgi?cafn=load&grp=GROUP");
?>
Counter code with system() command (this method may work incorrectly at some servers):
<?php
if( isset($HTTP_SERVER_VARS) ) { $SERVER_VARS=$HTTP_SERVER_VARS; }
if( isset($_SERVER) ) { $SERVER_VARS=$_SERVER; }
foreach ($SERVER_VARS as $k => $v) {
if( strstr($k,"HTTP_") || strstr($k,"REMOTE_") || strstr($k,"QUERY_") ||
strstr($k,"REQUEST_") || strstr($k,"SERVER_") || strstr($k,"GEOIP_") ) {
putenv("$k=$v");
}
}
system("./cgi-bin/tca/cacount.cgi load");
?>
Setting group for traffic analyzed at a given site or page (GROUP - name of the group):
<?php
if( isset($HTTP_SERVER_VARS) ) { $SERVER_VARS=$HTTP_SERVER_VARS; }
if( isset($_SERVER) ) { $SERVER_VARS=$_SERVER; }
foreach ($SERVER_VARS as $k => $v) {
if( strstr($k,"HTTP_") || strstr($k,"REMOTE_") || strstr($k,"QUERY_") ||
strstr($k,"REQUEST_") || strstr($k,"SERVER_") || strstr($k,"GEOIP_") ) {
putenv("$k=$v");
}
}
system("./cgi-bin/tca/cacount.cgi load GROUP");
?>
If the image does not appear as soon as the installation of the counter is over, the following options are possible:
- You should re-check the cacount.cgi directory at your drive. Create a file (test.php) with the counter code stated above and place
it next to the other PHP files. Change the directory in the "system()" command until the image appears during the launch from the Web.
After that, insert the corrected code into your PHP file.
- If the directory is correct but the cacount.cgi is still not working, it may be due to the fact that the launch of the "system()"
command is forbidden at the PHP server. Contact the support service of the hosting to solve this problem.
3. Perl pages (http://domain.com/cgi-bin/main.cgi?trader=ID)
To insert the system counter edit the cgi-file (pl) and find the section of the code responsible for the display of the page's HTML.
Insert the launch of the counter into the script's Perl-code with the help of the following "system()" command (but change the
cacount.cgi directory into your own one).
system("./cgi-bin/tca/cacount.cgi load"); # run script of counter
If the image does not appear as soon as the installation of the counter is over, the following options are possible:
- You should re-check the cacount.cgi directory at your drive. Create a file (test.cgi) with the counter code stated above and place
it next to the other cgi-files, assign permissoin 755 (rwx r-x r-x). Change the directory in the "system()" command until the image
appears during the launch from the Web.
After that, insert the corrected code into your cgi-file.
- If there's a call "system(..)" seen in the HTML instead of the image, it means that you've inserted the Perl counter script
launch code into the displayed HTML. This is not a right thing to do - you should insert the counter script launch code into
the Perl-code and not into the displayed text.
- If the directory is correct but the cacount.cgi is still not working, it may be due to the fact that the launch of the "system()"
command is forbidden at the Perl server. Contact the support service of the hosting to solve this problem.
The contents of test.cgi:
#!/usr/bin/perl
print "Content-type: text/html\n\n"; # output header
system("./cgi-bin/tca/cacount.cgi load"); # run script of counter
Home