Sounds easy, but it is a bit tricky. Once one have to now that this:
function test(){
do();
test();
}
ends in a recursion, because the function pointer test, only will be resolved to the value at runtime.
I ends with this:
var tmp = fn;
fn = function(){
if(!!pageTracker){
pageTracker._trackEvent("category","value")
}
return tmp.apply(this, arguments);
}
With this snippet you can add a Google Tracking Event, just by wrap it in another js-function.