id just store the actual link in a db column such as:
http://clkuk.tradedoubler.com/click?...XXXXX&g=XXXXXX
then when you come to printing it out you would just have
echo "<a href=\"$link\">$text</a>";
all the javascript stuff isnt really needed. and you can pick up the text links from the link matrix which is quicker than going into each program page and getting them from there.
also you could then just add tracking to the end on links if you wanted like...
echo "<a href=\"$link&epi=FooterLink\">$text</a>";
the link you have there (in your post) should track as it goes through the
td tracking thing but the
Code:
<script language="javascript">var uri = 'http://impgb.tradedoubler.com/imp/inv/XXXXXX/XXXXXXX?' + new String (Math.random()).substring (2, 11);document.write('<img src="'+uri +'">');</script>
after the actual link isnt of much use.