gaAddonsgaAddons - Google Analytics Addons by Stéphane Hamel

Documentation: Calls Reference

_setHourOfDay (Deprecated)

Note: since GA offers the "Hour of the Day" Dimension by default, this call will be deprecated in futur releases of gaAddons.

_setHourOfDayCreate a new session-level custom variable with the current hour of the day (24 hours basis, based on client local time). This is particularly useful for segmentation.

Caveat

_setHourOfDay is initialized only on the 1st page view of the visit - therefore, if you want to use this feature, make sure it is included on every pages of your site.

The number of custom variables slots is limited to five. Be careful if you use this feature alongside other gaAddons features also making use of custom variables (namely, _4Q, _setDayOfWeek and _setHourOfDay).

_gaq.push(['_setHourOfDay', {
	index: 2, // optional [1-5]
	name: 'HourOfDay', // optional string
	value: (new Date()).getHours(), // optional integer
	scope: _GA_SCOPE_SESSION // optional _GA_SCOPE_PAGE|_GA_SCOPE_SESSION|_GA_SCOPE_VISITOR or use 3,2,1 respectively
	}]);
      

Parameters

index [1-5]
The custom variable slot number. The default value for this parameter is 2. Refer to Custom Variables in Google Analytics Help.
name 'HourOfDay'|string
The custom variable name. Refer to Custom Variables in Google Analytics Help.
value (new Date()).getHours()|integer
Will hold the current hour of the day (base on 24 hours format). This parameter would typically not be overwritten..
scope _GA_SCOPE_SESSION|_GA_SCOPE_PAGE|_GA_SCOPE_VISITOR
The scope of this custom variable - page (3), sesion (2) or visitor (1). Since this event pertains specifically to a session, this parameter shouldn't be overwritten. Refer to Custom Variables in Google Analytics Help.