/*
	#note_multiple_profiles => This is required when tracking is being done for more than one Google Analytics Profile in the same request.
*/

/*
	Intended for tracking links by specifying special 'addresses' to track.
	Could also be used as a page tracker instead of or in addition to an empty urchinTracker() call, for renaming or aggregating requests based on the url or specified string.
	track_imr_tab_click(anal_code, code_name)
	track_imr_tab_click('UA-XXXXXX-XX', '/imr/summary/dyeraa') => Adds an '/imr/summary/dyeraa' entry for supplied Google Analytics Profile. As if that page exists. 
*/
function ga_track_custom(anal_code, code_name){
	_ga_set_profile(anal_code); // #note_multiple_profiles
	_ga_tracker(code_name);
}

/*
	Helper function for using urchinTracker().  Sets the profile as specified, and then runs urchinTracker() to log the page.
*/
function ga_track_page(anal_code){
	_ga_set_profile(anal_code); // #note_multiple_profiles
	_ga_tracker();
}

// Are you sure you want one of these, you probably want a wrapper from above.
var _uff, _uacct;
var _ga_tracking_count = 0;
var _ga_tracking_limit = 2; // limit the number of blank urchinTracker() calls that will register a hit.  #note_multiple_profiles

function _ga_reset_tracker(){
	if (_ga_tracking_count < _ga_tracking_limit){
		_ga_tracking_count++;
		_uff=0; // #note_multiple_profiles
	}
}

function _ga_set_profile(anal_code){
	if (anal_code && anal_code != ""){ _uacct = anal_code; }
}

function _ga_tracker(track_this){
	if (typeof(urchinTracker) == "function"){
		if (!track_this || track_this == ""){ _ga_reset_tracker(); }
		urchinTracker(track_this);
	}
}
