In addition to the standard
ga.js
, the Analytics team has deployed an alternative version of the Google Analytics JavaScript called ga_debug.js
. The purpose of this script is to help Analytics users troubleshoot their installations. It's especially useful if you are new to Analytics, or if you are migrating your site to the new asynchronous syntax.
The script provides details about each GIF request and will log warning and error messages when it detects problems in the tracking code. It does this by printing messages to the
window.console
object. You can then use one of the following tools to view these errors:- Firebug (for Firefox)
- Built-in tools for Chrome and/or Safari
- Firebug Lite (for other browsers)
To use the ga_debug.js script, you can modify the tracking code reference for a webpage that you have access to and can edit. To do this, replace all references to
/ga.js
with /u/ga_debug.js
in the tracking code for that page. We recommend that if you are using the debug script for a large-scale website, you use this only on your testing environment. Alternatively, if you are debugging a smaller site, we recommend that you test only select pages rather than the entire site in this way.
Important: You should not modify your production site to use this version of the JavaScript. The
ga_debug.js
script is larger than the ga.js
tracking code and it is not typically cached. So, using it in across your production site will slow down your site for all of your users. Again, this is only for your own testing purposes.Using the Google Analytics Tracking Code Debugger
The Google Analytics Tracking Code Debugger is a Chrome browser extension that enables
ga_debug.js
for you without requiring coding changes on your part. It is probably the simplest way to use ga_debug.js
is to troubleshoot and analyze tracking behavior for your website. Simply turn on this extension and you can check your production pages for errors without having to modify tracking references in the code itself.
To use this extension, turn it on by clicking its icon to the right of the address bar. Then open the Chrome JavaScript console to see messages in the console.
- On Windows and Linux, click [Page Icon] -> Developer -> Javascript console or press Control-Shift-J.
- On Mac, click View -> Developer -> Javascript console or press Command-Option-J.
Комментарии
Отправить комментарий