Correct way to implement visitor tracking?

Giganews Newsgroups
Subject: Correct way to implement visitor tracking?
Posted by:  Robert Oschler (no_replies@fake_email_address.invalid)
Date: Thu, 04 Sep 2003

This is my current strategy for tracking hyperlink clicking by a site
visitor (Internet Explorer example):

Using Javascript I:

Attach an event to the document "onclick" handler.
When a click occurs, the Javascript "onclick" event hander I assigned,
checks to see if the event srcElement (or its parent in the case of a "font"
element) is a hyperlink (tagName = "A" or "a").
If so, I build a URL with the search arguments set to the information I wish
to record.
I find a specific IMG element on the page and set it's SRC property to the
URL I built.

If the hyperlink opens a new window using the "_blank" target, this works
flawlessly.  If however a new window is not opened, the transaction is lost.

It's as if the IMG element SRC property setting never actually happens.

Is there a way to make this work?  Or do I have to create tracking codes for
each hyperlink and change all the URL's to go to a pre-emptive document that
records the click, before showing the desired web page.