(function($) {
    $.trackEvent = function (namespace, event, details) {
        for (var i in details) {
            var gaValue, gaLabel;
            if (typeof gaValue == 'undefined' && typeof details[i] == 'number') {
                gaValue = details[i];
            } else if (typeof gaLabel == 'undefined' && typeof details[i] == 'string') {
                gaLabel = details[i];
            }
            if (typeof gaValue != 'undefined' && typeof gaLabel != 'undefined') break; 
        } 
        gaEvent = ['_trackEvent', namespace, event];
        if (typeof gaLabel == 'string' || typeof gaValue == 'number') gaEvent.push(gaLabel || '');
        if (typeof gaValue == 'number') gaEvent.push(gaValue);
        _gaq.push(gaEvent);
    }
})(jQuery);
