Tracking Resources
Links, Actions, Downloads
To track links, actions, downloads (for both types of embedding),
you should insert the calling of the sslogres()
JavaScript function. The function takes two parameters, being:
- 1st - type of resource tracked (which also predefines parameter 2 below): 'ssln' - link, 'ssdn' - download, 'ssfn' - action;
- 2nd - value based on the above, respectively: form/link/string objects to be tracked as a link, string object to be tracked as a download name, integer(action's ID) or string(action's name) object to be tracked as an action.
You can also use the sstrlnk() function to track links.
It takes one parameter - link (form, link or string object).
For example:
Link:
<a href="http://www.softerra.com" onclick="return sslogres('ssln', this)">Softerra, LLC</a>
OR
<a href="http://www.softerra.com" onclick="return sstrlnk(this)">Softerra, LLC</a>
<form action="http://site.com" onSubmit="return sslogres('ssln', this)">
...
function FormSubmit(form) {
sslogres('ssln', form.action); //or sslogres('ssln', form); or sstrlnk(form.action); or sstrlnk(form);
}
Action (let's assume the "search" action's ID is 3):
<a href="javascript:void()" onclick="sslogres('ssfn', 3)">Search</a>
or
<a href="javascript:void()" onclick="sslogres('ssfn', 'search')">Search</a>
Download:
<a href="http://download.domain.com/?name=filearc.zip" onclick="return sslogres('ssdn', 'filearc.zip')">Download File Archive</a>
|
Downloads
To track downloads, you can write your own wrapper or use the one provided by
ActiveStat's getfile.php. It must be placed
on the ActiveStat's server part (or a
site with ActiveStat embedded as
PHP+JavaScript code). The script takes two parameters:
- ssdn - download file name - REQUIRED;
- sssid - to specify a site ID of the web site where the download link is placed (i.e. if you want to track downloads from different sites that have links to some physical files placed on a certain site with a statistics database installed).
Example:
Assume you have site1 (ID=10) with ActiveStat's
server part installed, site2 (ID=2) which has a download link and
site3 (ID=33) with the same download link.
Site2:
<a href="http://site1/getfile.php?ssdn=product.arc&sssid=2">Download the Product</a>
Site3:
<a href="http://site1/getfile.php?ssdn=product.arc&sssid=33">Download the Product</a>
|
Note: if you are using a download link on the site that has ActiveStat's
server part installed, you don't have to specify the site ID variable -
the $stat_site_id value from stat.cfg.php will be
used automatically.
In addition to the above example: if the download link is placed on
site1 ($stat_site_id=10):
Site1:
<a href="http://site1/getfile.php?ssdn=product.arc">Download the Product</a>
<!-- site ID is presumed to be equal to 10 -->
|
Non-existent resources (404-URLs)
* To track requested resources that do not exist on your site
(referred to by other pages), you should configure your server
so it uses a custom page to display the 404 error.
Apache web server.
You should specify the following configuration directive in your
.htaccess file or your web site configuration section.
| #Embedding as PHP-code |
| ErrorDocument | 404 | /stat/404.php?ssru=1& |
| |
| #Embedding as JS-code |
| ErrorDocument | 404 | /stat/404.html |
IIS
Use Internet Service Manager. Open the "Web Site Properties"
dialog for your site (or the Properties dialog for your site's root
directory). Switch to the "Custom Errors" sheet. Select "404 error"
from the list and edit its properties (For both types of embedding the
"Message Type" property should be set to "URL"):
| #Embedding as PHP-code |
| URL | /stat/404.php?ssru=1& |
| |
| #Embedding as JS-code |
| URL | /stat/404.html |
Make sure that the "Check that file exists" option is set for .php
mapping in the host's properties in
Home Directory->Configuration->App Mappings.
When embedding "as JS-code", you should place the 404.html
file to the tracked site and edit it there - make sure you specify all
the parameters in accordance with your web-site settings:
| ssscript='http://dedicated.site.with.stat/stat/sss_main.php'; - actual location of the sss_main.php script |
| sssid=1; - actual site ID |
| Then specify these parameters within the <noscript> tag. |
Please note that you can either use a 404.html page
included in the ActiveStat package,
or create your own 404-page and embed the JS tracking code
(placed in the /external/cut_n_paste404.js file)
inside it. Then copy the code to paste it inside your custom
404-page just like it's done for the 404.html supplied.
|