do it with php, so that if somebody does go to your page, or follows from source to destination, they won't be able to repeat or find patters.
best is to pull values from DB and use one redirect that does the job multiple times and does all of the tracking in the background, so that somebody clicking on the link, will never get the same redirects, and you should also track num of clicks and how often they come.
something like this:
you'd have it set up somewhere like this: domain.com/track.php
then from the external source (like your advertisement) you would link to it
http://domain.com/track.php?c=xyzabc
the "c" stands for "campaign", so in the database, you'd look up campaign "xyzabc" and all of the variables associated with it. track the specific user (from where, browsers, ip, etc), if the user passed a few key checks, i'd generate a new URL and "url key" for this user (in this example, say the urlkey was "987654321"), and put it into another table in the database.
then redirect to your script again,
http://domain.com/track.php?u=987654321
at this point grab the URL from the database that's associated with urlkey 987654321 and redirect to final destination
if you have a few servers, bounce them around..
http://domain.com/track.php?c=xyzabc redirects to
http://someothersite.net/track.php?u=987654321
which redirects to final destination
few other things to consider:
1 - run all of your links through bit.ly or something, so that somebody can google "domain.com/track.php" and find all your shit
1a - make a bunch of bit.ly urls and store them in the db, so the redirect won't lag or error out if you can't get a new bit.ly link
2 - have track.php run on all your domains (if you have many), but remotely connect to one databases (on amazon aws??

) to have global tracking for all your shit
3 - create a database with as many affiliate/marketing/leads companies you can, with a bunch of random campaign like keywrds (acai, berry, leads,pplead,abs,rx90,mobi), then randomly attach those to the links, they won't do shit when you process, but it'll be another way to throw off somebody when they're trying to track your shit. on top of that, cookie the fucker, and present the same random junk to the same user, so he won't think it's totally random when he clicks through a couple of times.
example:
http://domain.com/track.php?c=xyzabc&p=clickb&o=ebook
http://domain.com/track.php?c=xyzabc&p=cj&o=exercise3
http://domain.com/track.php?c=xyzabc&p=hg&o=newvirtual
php redirect is done with "header", and make sure not not output anything to the browser before doing the redirect, docs:
PHP: header - Manual