• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

4. Measuring Web Site Usability > 55. Measuring Clicks the Old-Fashioned Way

Measuring Clicks the Old-Fashioned Way

If your particular web measurement application doesn’t provide you the ability to measure which links your visitors are clicking, use this simple JavaScript hack to track them yourself.

Before browser overlays, many vendors used JavaScript to track clicks on pages. Since the script is not very complicated and is used in other contexts in this book [Hack #13] , it is also worth presenting as a standalone hack.

The Code

To track clicks the old-fashioned way, you simply hijack JavaScript’s onClick event handler, instructing it to fire off a message to a custom variable [Hack #31] in your measurement application right before the click is processed. The JavaScript for this is pretty straightforward; simply include this JavaScript in any page you want to track clicks on.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint