You are here:  » Central Tracking Table

Central Tracking Table

Submitted by BargainsOnlineUK on Fri, 2016-09-30 00:45 in

My idea is to have a central table and store various details at the time the button is clicked that takes the user to the affiliate website.

Things such as date and time, perhaps ip or at a minimum, work out their approximate location from their ip and store that. Also which domain the click belongs to, which url the user was on at the time of the click and which button (affiliate) did they visit. Perhaps where they came from (referer) if it is stored and available at the time of the click, and possibly a few other interesting facts and figures, but you get the idea about the main details and probably understand my reasoning behind them.

Because all my domains are on Cpanel and in one main account then the permissions for accessing the database and table isn't an issue. It would be great if you could provide a guide of how I would achieve this though please.

Thanks in advance.

I took advantage of buying your script across 3 months and my final payment was in August so I'm a fully fledged member and convert to price tapestry. My websites are generating clicks and I've already had my first sale through one of my domains using Price Tapestry, although at the rate of that one, it may take roughly another 80 or so sales to cover the cost of PT and even more for the price of my server and domains. :)

On a side note in case you don't mind answering at the same time please David, I've tried adding to the page, mainly a banner but I'm having difficulty working out where to place the html for other items to appear on the main page. I've read various bits on the forum and I've had no luck so far.

All the best.


Submitted by support on Fri, 2016-09-30 09:46

Hello Paul and welcome to the forum, and thank you for your comments!

Comprehensive tracking is something I've not included the script since it is actually quite a complex area and most networks have sophisticated tracking and reporting that takes care of all the "gotchas" such as bad robots, de-duplication etc. Just to point you in the right direction; jump.php is where you would implement such tracking, inserted before the header() / exit() calls to issue the redirection.

If your sites are in different MySQL databases but you wish to have a single tracking table in a different database you would need to close the database connection, override the $config_database variables as required, e.g.

  $config_databaseName = "OtherDatabase";

In terms of data available to log, by default, jump.php only selects the minimum required fields from the products table but you could change this by looking for the following select field list;


...and REPLACE with:


That will give you access to everything in the pt_products table record for the action through the $product array variable e.g. $product["merchant"] etc. (see the products table definition in setup.sql for all field names). The users IP address would normally be in $_SERVER["REMOTE_ADDR"] and the site being used you can gather from $_SERVER["HTTP_HOST"].

To add content to the main page, for example to appear above Featured Products, edit index.php and look for the following code at line 10;


...and break out of PHP at this point into an HTML section, create a Foundation row for your content and insert your banner HTML / any other content as required, so REPLACE with:

  <div class='row'>
    <div class='small-12 columns'>
      <!-- home page banner and other HTML here -->

Hope this helps!