Using jQuery for creating database outgoing links custom events. You obviously need to replace the 'a.db_name' with whatever class you wrap your database links in. If you are using this in Drupal, as I am, use instructions here to make your life easier when creating jQuery objects: https://drupal.org/node/171213#comment-4686396.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
|<!--Database custom events-->|
|var db_name = $(this).text();|
|_gaq.push(["_trackEvent", "linkOut", "database", db_name]); // create a custom event|