﻿
//GOOGLE TRACKING FOR ALL A Tags with HREF
jQuery("document").ready(function() {
    jQuery("a[href]").click(function() {
    try {
            var closestId = jQuery(this).closest("[id]").attr('id');
            var _port = window.location.port;
            var _protocol = window.location.protocol;
            var _host = window.location.host;
            var _destination = this.href.toLowerCase();

            var _urlHeader = _protocol + "//" + _host;

            _destination = _destination.replace(_urlHeader, "");

            var _event = "_trackEvent";
            var _type = "Hyperlink Click";
            var _subtype = _urlHeader;
            _gaq.push([_event, _type, _subtype, _destination]);
            //Can't have two events back-to-back.
            //_gaq.push([_event, "BetaTracking", _destination, window.location + "@#" + closestId]);

            
        }
        catch (err) {
        }

    });
});
