Tracking 301 Redirected Links With Piwik

Dear all. I was trying to set a Goal with Piwik, where when a user clicks on a link that redirects to an external webpage this would be recorded as a goal. But I realised that Piwik does not track or record this click to an external website in any way.

Is there a way around tracking 301 redirects?

Thanks,
Chiappa

see JavaScript Tracking Client: API Reference - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3

Thank you for the link Matt! This solved my problem! Adding the css class to menu items in Wordpress to record the clicks required a bit of code. I wrote a post about it here:

http://www.elftronix.com/2014/04/add-css-class-directly-to-wordpress-menu-item-link/