What's the best way to track clicks for outbound traffic?
I'm wondering what the different options are for tracking outbound traffic. If someone could point me to modules or other solutions, that would be awesome. It would be great if the solution allowed google analytics to "see" the clicks so that reporting could be integrated.
Why I need this
It would be great to know how much people are clicking on various outbound links, but my main purpose is because I have Buy Ticket links that take the user to an outside ticket vendor (Vendini). It would be really great to be able to track how many times each of the outgoing links were clicked and from where.
Making the process automatic for the administrator
Here are the needs for this proposal:
- logging and redirection - we need a way to log the information about: (I would imagine this part already exists in some form)
- outbound link
- referring page
- timestamp
- input filter identifies outbound links
- jQuery redirects outbound links to outbound link processor
If the module needs to be developed, I was thinking it would be possible to create a filter that automatically picks up all outbound links, and adds a class to the link identifying it as outbound. Then when a user clicks on one of these links, some form of JavaScript could intercept it and pass the user through a link counter which would invisibly pass the user to the requested url. Thickbox seems to intercept links using this method, so I assume it's something easy to do in jQuery. Note: To me, this just sounds like a simple, yet powerful approach to this problem but I'm not really familiar with the code for jQuery, nor with how to build a filter module that would identify the outbound links and add the class to the anchor.
Any thouhts?

easier solution
Have the each link point to a callback defined by your module with the path and/or query-string elements defining the actual destination.
When the user clicks on the link, you can then save the information you want in a table in the DB, and use drupal_goto to redirect them to the real destination.
Thanks
I've never written module code for drupal before, but would love to dive in. You mention defining a callback - I assume you mean an address that would carry out whatever actions I define. Could you point me in a good direction to get started?
I also discovered the Links Package project http://drupal.org/project/links and will spend some time looking into how it works.
I would really love to have tracking data handled by google analytics as well as storing the data in the local database. The local copy allows better presentation of data to the users with link popularity weighting/sorting. The google analytics however would allow for marketing goal tracking and better analysis of which parts of the site are most successful.
Here's an update to this posting that I made in the Links Package issues: http://drupal.org/node/146956
Google method exists, but changes needed to Analytics module
Google has a way to track outbound links by adding code to the link tag itself. Refer to:
http://www.google.com/support/googleanalytics/bin/answer.py?answer=55527...
However, this method will not work with the existing Analytics module because Google requires that the Analytics tracking code (the script tag) come before the links being tracked. If you look at the page source Drupal generates with the Analytics module installed and activated, you'll note that the tracking code is placed at the end of the page, just before the
</body>tag.It would be great to have an option in the Analytics module that would allow the user to specify if the tracking code should be placed at the top or bottom of the generated page code.
...dtw