©2012 Google -
Code Home -
Site Terms of Service -
Privacy Policy -
Site Directory
Google Code offered in:
English -
Español -
日本語 -
한국어 -
Português -
Pусский -
中文(简体) -
中文(繁體)
The _gat global object is used to create and retrieve tracker ojbects, from which all other
methods are invoked. Therefore the methods in this list should be run only off a tracker object created
using the _gat global variable. All other methods should be called using the _gaq global object
for asynchronous tracking.
_getTracker(account) deprecated_createTracker(opt_account, opt_name)_getTrackerByName(opt_name)_anonymizeIp()_getTracker(account)_gat._createTracker(opt_account, opt_name) instead._gat._getTracker('UA-65432-1');
String account The full web property ID (e.g. UA-65432-1) for the tracker object.
Tracker The created tracking object._createTracker(opt_account, opt_name)_getTrackerByName.
If two trackers are created with the same name, the second will overwrite the first and the first will no longer be retrieveable via
_getTrackerByName.
_gat._createTracker('UA-65432-1');
_gat._createTracker('UA-65432-2', 't2');
String opt_account The full web property ID (e.g. UA-XXXXX-X) for the tracker object.String opt_name Optional name to store the tracker under. Use this name to retrieve the tracker via _getTrackerByNameTracker The created tracking object._getTrackerByName(opt_name)_gat._getTrackerByName();
_gat._getTrackerByName('t2');
String opt_name Optional name of the tracker to retrieve. Defaults to the empty string ('').
Tracker The retrieved or created tracking object.
_anonymizeIp()Tells Google Analytics to anonymize the information sent by the tracker objects by removing the last octet of the IP address prior to its storage. Note that this will slightly reduce the accuracy of geographic reporting.
When using this function to anonymize tracking, you must use the
push
function and properly associate the function with the tracker object, as
illustrated below.
var _gaq = _gaq || []; _gaq.push (['_setAccount', 'UA-XXXXXXX-YY']); _gaq.push (['_gat._anonymizeIp']); _gaq.push (['_trackPageview']);
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try{
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
_gat._anonymizeIp();
pageTracker._trackPageview();
} catch(err) {}</script>