*** Please note: This contribution is no longer supported; phpTrafficA is obsolete. It is provided for historical reference only.
Installing phpTrafficA in your Zen Cart
Relevance: Any version of Zen Cart™Donate: This is free software. Show your appreciation by supporting my efforts.
The package phpTrafficA is an open source web analytics tool, written in php and MySQL. It can track access counts to your website, search engines, keywords, and referrers that lead to you, operating systems, web browsers, visitor retention, path analysis, and a lot more! A full demo is available on the home page.
Requirements:
Your system must have GD. To determine whether it does, go to Admin > Version (at the top right hand side of the screen), and scroll down until you see GD Support. The value should be "enabled."
Installation Instructions:
- Download zip or tarball from http://soft.zoneo.net/phpTrafficA/index.php
- Unzip or untar the package and copy to the home directory of your shop. In these instructions we will assume the new folder is called YOUR_SHOP/traffica, but you should pick another name (the same way you did for your admin folder).
- cd to YOUR_SHOP/traffica
- edit Php/config_sql.php, and set the parameters using the values
from your
includes/configure.php
- edit Php/config.php and set the admin password to one of your own choosing.
- Set these permissions:
chmod 666 Php/sites.php:
chmod 777 tmp:
- open YOUR_SHOP/traffica/Php/install.php in a web browser and follow the
instructions. Specifically, be certain to erase these files from
YOUR_SHOP/traffica/Php/ directory:
rm confDB.sql.php confDBUpgrade.sql.php install.php upgrade.php
(This is just like deleting zc_install after installing Zen; it ensures that bad guys can't re-install your system.) Note that confDBUpgrade.sql may not exist. - Point your browser to YOUR_SHOP/traffica
- Login (using the password you set back in step 5.
- Press the "Config" button at the top of the screen.
- In Domain Address, enter yourshop.com. If your shop is in a subdirectory called shop, enter yourshop.com/shop
- In Table Name, I suggest using "phpTrafficA_" so that all tables are grouped together.
- Set "Trim" to "No".
- Press the "Submit" button.
- At the top of the screen, press the "Reminder" button.
- Keep this screen up; you will need it for the next step.
- Open up the file
includes/application_top.php
. Find $autoLoadConfig in this file. You want to paste in the code from the first row in the web page you opened in the previous step right before this. It will look something like this:---- $sid="281677"; // DO NOT COPY - example only include("/var/www/html/mysite/traffica/write_logs.php"); // DO NOT COPY $autoLoadConfig = array(); ... -----
You're done. Go to the admin screen www.yoursite.com/traffica and poke around. It takes a while for data to build up of course. - If you have a test cart, and you don't want to run phpTrafficA on your
test cart, take advantage of the fact that the hook for phpTrafficA was
inserted after configure.php was included, so you can use your
configuration to determine where you're running. For instance, on
my cart, I say
if (DB_SERVER_USERNAME != "scw") { $sid="281677"; include("traffica/write_logs.php"); }
- If you have a test cart and you do want to run phpTrafficA in both
test and production, remember that the file
traffica/Php/sites.php
will be different on each site, just like your configure.php files are.
This tip was developed in April 2007.