Just disable JS by default and it will be good for 99.99% of the cases you don't allow explicitly allow it.
Thanks to gzip compression, this shouldn't even take much data to transfer.
Oh, and as I think of it, would this here still work?
<a href="http://reddit.com"><span class="tracker" /></a>
a#mylink span.tracker { background-image: url(http://myservice.onion/track.php?uid=xxx&trackedsite=reddit.com); }