Administration Interface / Menu / Parameters  

Parameters

Parameters

Here you can set properties for the pre-defined parameters and define custom parameters to gather information and get reports on them. After installation your database will contain three configured parameters named "PLT_OS", "PLT_BROWSER", and "O_KEYWORD". Here is how they are defined:



The "PLT_OS" and "PLT_BROWSER" parameters belong to the "Platform" type, so they will be present in the reports' "PLATFORM" menu.

The "Platform" type parameters consist of the following four groups:

  • PLT_OS and PLT_BROWSER are present in ActiveStat by default. They are also present in the "PLATFORM" menu and in the "visit details" popup window;
  • PLT_NVPLUGIN will appear in the "PLATFORM" menu and in the "visit details" popup only if you set $stat_store_plugins to be equal to 1 in stat.cfg.php. You can set this value to 0 to disable plug-in information storing. This has been done to let you save up disk space if you aren't interested in plug-in information;
  • Hard-coded platform parameters like "JavaScript", "Screen resolution", etc. The reports.cfg.php file defines whether or not these parameters should be present in the "PLATFORM" menu and in the "visit details" popup: the $statPltMnuFields array contains parameters to be included in the menu, $statPltFields contains parameters to be displayed in the popup;
  • User-defined parameters. If you define your own "Platform" parameter, it will appear in the menu as well as in the popup window.

User-defined parameters of other types will appear just in the "visit details" popup window. But you can extend ActiveStat application to get standard reports on these parameters (they will appear in the menu for you to be able to get standard reports).



Note: the order of parameters in the visit details popup corresponds to the one in the "Parameters management" table.

If the "PHP VAR TO SEARCH" field is set for a parameter, it will be calculated using corresponding rules (OS, Browser, etc. rules) along with a specified PHP variable value.

You can store PHP variable values without calculation. To do this you need to add these variables to the $statHttpVars array in the stat.cfg.php file:

$statHttpVars = array(
     "HTTP_X_FORWARDED_FOR" => PT_ORIGIN //HTTP params to be stored without calculation
     ); //leave this array empty to disable storing of such parameters

Starting from version 2.3, ActiveStat does not use global variables to calculate parameters or to store values without calculation. Parameter values are taken from an array which is a result of merging two "superglobal" PHP arrays: $_REQUEST and $_SERVER.

Operating System, Browser, Keyword...

When you define a "PHP VAR TO SEARCH" value for a parameter, a new menu item will appear in the "PARAMETERS" menu. This item can be used to define rules to calculate the parameter using the specified PHP variable value.

E.g., look at the default definition of rules for PLT_BROWSER, "default" site.



The PLT_BROWSER value will be calculated using a set of rules and the "HTTP_USER_AGENT" variable value (as defined in the "Parameters" menu). This variable contains the information a browser sends in its own requests to the web server. Using this information we can determine which browser has sent it.

For this we need to define a set of rules as "Pattern (perl regular expression) -> String". As soon as a visit is logged to the database, the "HTTP_USER_AGENT" value is checked on whether it matches any pattern starting from the first one on till a match is found. If a matching pattern is found, a corresponding string will be assigned to the PLT_BROWSER parameter concerning the visit. If a string contains variables like $1, $2, etc., they will be replaced with the ones matching the corresponding parentheses content of a matching pattern. If some rule does not match a PHP variable value, the value can be stored as a "temporary" parameter with the variable's name. To have ActiveStat store such values, set the "Store original value" flag for a calculated parameter.

When you define a pattern, you can check its syntaxes. Press the "Check" button and you'll see result in a popup window that will appear.



You can also test your rules. Type a string to be matched into the "value" field and press the "Test" button. For example:

test string: Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.02 [en]