Winn Tracker

It’s time to start tracking everything! Now you can with Winn Tracker; track downloads, page views, how many times a link or image was clicked, and keep track of incoming links.

The system only takes one database table, and you can add this table to a current database so no need to make a whole new database for this. Developer friendly, the system is object orientated using one class. Once the class is called it will send the information provided to the database; after that it’s all yours!

Install

  • Download the zip file below
  • Unpack the files to the server or local computer
  • *Create or add tables to a current database
  • **Connect the db_class.php file to your database

*Database structure

It is very important to follow the directions in the db_schema.txt file. If you are creating a new database you may use the database install script provided.

Creating a new database ONLY

Create your database first, then edit the db_class.php file located at: “/path/to/tracker/classes/db_class.php”. After that follow the steps below.

I have provided a script that will create the proper tables on a new database; this script is untested on current databases. To activate the script you will need to rename the file from “create_db.php.backup” to “create_db.php” then simply visit: “/path/to/tracker/classes/create_db.php”. This will give you an error or success message.

Hook it up to the database

Open the db_class.php (“/path/to/tracker/classes/db_class.php”) file in a text editor and change the following lines:

$dbhost = "localhost";
$dbuser = "DB USERNAME";
$dbpass = "DB PASSWORD";
$database = "DATABASE NAME";

Upload that file to the server where you found it (“/path/to/tracker/classes/db_class.php”).

How to use

  • Ajax Link
  • PHP Link
  • Direct Link
Before using, take note of the reserved functions.

Ajax Link

I have provided the proper javascript for this in the /js folder.

<script src="pathto/winn_tracker/js/prototypejs.js" type="text/javascript"><!--mce:0--></script>
<script src="pathto/winn_tracker/js/winnjs.js" type="text/javascript"><!--mce:1--></script>
 
Winnjs.countHit('Test_page','',['username:Bob','sessionid:']);

PHP Link

//Include the following file:
include 'classes/hit.php';
 
// Call the class
$h = new track_this();
 
$Var2Value = "Some Value";
 
// Make the call that sends the data
$h-&gt;hit('name_of_page',$_SERVER['PHP_SELF'],
array(
"AnyVarName" =&gt; "TheValue",
"AnyVar2Name" =&gt; $Var2Value
));

Direct Link

<a href="http://winn.ws/path/to/tracker/classes/hit.php?hit_type=Direct_link&amp;headers=mysite.com&amp;options=username:Bob;  sessionid:&lt;?=$session;?&gt;;  sendto_url:../sample.php;  responce:true">
Download Here
</a>

Reserved Functions

I have pre-built some options so there are some reserved keys that will overwrite. All of the reserved functions go in the options area of the call.

  • sessionid – Feed this option key the session id of the user. It will also not allow the same session id to place two hits to the database.
  • sendto_url – Feed this option a url where the user should go once the hit is tracked. This will function if the user is tracked or if the user is blocked by ‘sessionid’.
  • response – *Needs ‘sendto_url’ to work* Feed this option ‘true’ and leave blank or do not use for ‘false’. After the user is tracked or blocked, it will use the ‘sendto_url’ to attach a ‘?stat=true’ for hit saved or ‘?stat=false’ for a hit blocked.

Building the call basics

The standard is the same whether it’s PHP or Ajax; Direct Link is the only odd one.

// Basics for PHP, Ajax
 
// PHP
$h-&gt;hit('*','**',array('***' =&gt; '****'));
 
// Ajax
Winnjs.countHit('*','**',['***:****']);

Direct Link:

# Direct Link
<a href="/path/classes/hit.php?hit_type=*&amp;headers=**&amp;options=***:****">Some Text</a>
  • * – The name of what your tracking
  • ** – The headers such as the page address or $_SERVER['PHP_SELF']
  • *** – The key or name of the option
  • **** – The value of the Key

As always, this is 100% supported so email me any time and I will try to get back with you as soon as possible!

Download

Download the latest version of this here:

Also coming soon is a SourceForge Project Page for nightly dumps and more.