|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):
Attach an event to the document "onclick" handler.
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
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.