©2009 Google -
Code Home -
Terms of Service -
Privacy Policy -
Site Directory
Google Code offered in:
English -
Español -
日本語 -
한국어 -
Português -
Pусский -
中文(简体) -
中文(繁體)
This reference describes the methods that you use for customizing all aspects of Google Analytics reporting.
_deleteCustomVar(index)_getAccount()_getVersion()_getVisitorCustomVar(index)_initData() deprecated_setCookiePersistence(milliseconds)_setCustomVar(index,
name, value, opt_scope)_setSampleRate(newRate)_setSessionTimeout(newTimeout)_setVar(newVal) deprecated_trackPageview(opt_pageURL)_deleteCustomVar(index)
pageTracker._deleteCustomVar(1);
Int index The index of the custom variable to delete.
_getAccount()String Account ID this tracker object is instantiated with.
_getVersion()String GATC version number.
_getVisitorCustomVar(index)pageTracker._getVisitorCustomVar(1);
Int index The index of the visitor level custom variable.
String The value of the visitor level custom variable.
Returns undefined if unable to retrieve the variable for the specified index._initData()Deprecated. initData() now executes automatically in the ga.js tracking code.var pageTracker = _gat._getTracker("UA-12345-1");
pageTracker._trackPageview();
_setCookiePersistence(milliseconds)
pageTracker._setCookiePersistence(604800000); //number of milliseconds in 7 days
String milliseconds New visitor
cookie expiration time.
_setCustomVar(index,
name, value, opt_scope)
name and value combined.
pageTracker._setCustomVar(
1, // This custom var is set to slot #1
"Section", // The top-level name for your online content categories
"Life & Style", // Sets the value of "Section" to "Life & Style" for this particular aricle
3 // Sets the scope to page-level
);
Boolean This method returns true if
the custom variable has been set successfully, and false if
it has not (e.g. if your name/value string length exceeds 64 bytes,
or if you use an incorrect slot).
Int index The
slot used for the custom variable. Possible values are 1-5, inclusive.
String name The name for the
custom variable.
String value The value for the
custom variable.
Int opt_scope The
scope used for the custom variable.
Possible values are 1 for
visitor-level, 2 for sesson-level, and 3 for
page-level.
_setSampleRate(newRate)pageTracker._setSampleRate("80"); //sets sampling rate to 80 percent
String newRate New sample rate to set. Provide a numeric string as a whole percentage.
_setSessionTimeout(newTimeout)String newTimeout New session timeout to set in seconds.
_setVar(newVal)String newVal New user defined value to set.
_trackPageview(opt_pageURL)document.cookie.
It also updates or creates cookies as necessary, then writes them back to the
document object. Gathers all the appropriate metrics to send to the
UCFE (Urchin Collector Front-end).var pageTracker = _gat._getTracker("UA-12345-1");
pageTracker._trackPageview("/home/landingPage");
String opt_pageURL Optional parameter to indicate what page
URL to track metrics under. When using this option, use a beginning
slash (/) to indicate the page URL.