Proper Link Tracking Strategy and Exit Page viewing time method?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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.

Also, is there any way to track how long a visitor leaving your site was on
a the last page they were viewing?  I know that most tracking packages can
track a visitor as they move around your site, but how about the page right
before they leave?  I've been told that you can do it in the
"onbeforeunload" or "beforeunload" event handlers because any HTTP requests
made during the event handlers will not be processed by the browser.  Tests
I have run seems to bear this out (or at least it's _very_ erratic).  Is
there a way to do this kind of exit page view tracking?



Re: Proper Link Tracking Strategy and Exit Page viewing time method?

Typo correction:

"I've been told that you can do it in the..."

should be

"I've been told that you can't do it in the..." (can't not can)


Site Timeline