|
|
|
|
stats_write.php Libraries
TechNotes
|
|
Library stats_write.php | Language: PHP
|
The purpose of this PHP script is to save tracking information on a server.
This script can be used with the library stats.js or with the function mioxml_download.
The tracking information can be retrieved as XML with the script stats_write.php.
URL Arguments
The script receive the tracking information via the arguments sent with the URL.
.../stats_write.php?pid=...
| |
This URL will record a hit for the specified software ID.
pid is the product ID.
|
.../stats_write.php?tid=...&gid=...
| |
This URL will record a hit for the specified tracking ID, in the specified group ID.
tid is the tracking ID.
gid is the group ID. Most of the time, the GID of a tracking ID is the product ID.
|
How the information is stored
The information is saved in files stored in sub folders. The sub folders are located where the script stats_write.php is.
Databases are not used because the data stored is very small. The library stats.js stores individual information on the local computer to respect privacy and save both server resources and bandwidth.
/software/YEAR/PID/MONTH.mem
| |
YEAR is the year.
PID is the product ID
MONTH is the month (two chars).
In the files are stored the number of users for each day of the month. The size of a file is less than 1 kb (12 kb / year / software).
|
/trackingID/YEAR/GID/TID.mem
| |
YEAR is the current year.
TID is the tracking ID.
GID is the group ID.
In the file are stored the number of hits for each month of the year. The size of a file is less than 300 octets and is valid one year.
|
Getting feedback
When called, the script build a simple XML document to return the result to the caller.
The result is returned in a tag <R>.
In case of success, the script returns:
In case of failure:
|
|
|