Welcome to WebmasterWorld Guest from 18.104.22.168
where productId=1 changes for each of your products (productId=2, productId=3, .....)
$randid = rand(0,100000); - generates rand number from 0 to 100000
using the productId you can query your products DB and get the product's price and store in variable $productPrice
Using such a query you can add all the data in your track DB
INSERT INTO track_table ('$randid', now(), '$productId', '$productPrice')
so if someone clicks on track.php?productId=1 it will write in your DB the ID=1, product price, current time and random ID
if you want to track every click you will need every link to go through a script that can insert the info into the db before you send them off to the desired page.
every link on your site will then go to this tracking script
have you looked into a log analyzer, maybe clicktracks, as that is probably a better option.