Troubleshooting the Tracking Code

If you want to troubleshoot issues with Google Analytics tracking, first ensure your basic setup is correct as described in the Help Center under Verifying Your Setup.

Troubleshooting your Analytics tracking will center around two key issues:

  1. Errors/typos in your tracking code syntax (e.g., whitespace, incorrectly spelled customizations, incorrect parameter names)
  2. Data missing from your reports

The rest of this document covers how you can use troubleshooting tools to help identify and correct these two basic issues.

Common Tracking Code Errors

Whether you are using the asynchronous or traditional syntax, keep in mind the following to avoid the most common errors when you customize or adjust the tracking code. To learn how to easily check for these errors, see Debugging with ga_debug.js.

  • Method names use incorrect case.
    Remember that methods are case-sensitive. If you use a method name without the proper casing, your method calls will not work. Examples:
      _gaq.push(['_trackpageview']);   // wrong
      _gaq.push(['_trackPageView']);   // wrong
      _gaq.push(['_trackPageview']);   // correct
  • Incorrect method names.
    If your tracking is not working correctly, check to make sure you are using the correct name for the method. Examples:
      _gaq.push(['_setDomain', '']);       // wrong
      _gaq.push(['_setDomainName', '']);   // correct
  • Passing a non-string value using quotes.
    Only strings should be passed in with quotes. All other types should be left unquoted.
    Any value that is not a string, such as a booleans, object literals, functions or arrays, should be passed in without quotation marks. Use only quotation marks when you are passing in something that is meant to be interpreted as a string. If you are migrating from the traditional syntax, any function parameter that was passed in without quotation marks should remain unquoted in the asynchronous syntax. Examples:
      _gaq.push(['_setAllowLinker', 'false']);    // wrong
      _gaq.push(['_setAllowLinker', false]);      // correct
  • Strings contain leading or trailing whitespace.
      _gaq.push(['_setAccount', ' UA-65432-1']);    // wrong
      _gaq.push(['_setAccount', 'UA-65432-1']);     // correct

Back to Top

Common Report Data Issues

If you have data missing from your reports, read this section to help identify the most common errors and recommended actions.

Tracking Code Change or Setup Not Detected

When installing tracking code for the first time on a page, or adding additional tracking code functionality (such as for ecommerce), you can easily verify that the page request is set up correctly by checking for the following elements:

  • The page requests the ga.js JavaScript
  • The page requests the __utm.gif
  • The utmac and utmcc variables are being sent in the __utm.gif request
  • All relevant tracking parameters are available for additional data you expect to be sent (see the GIF Request Parameter list below).

If all of these elements are being sent correctly, the data should appear in your reports within 24 hours at the latest. However, you can also check to see if data appears sooner by changing the date range in your reports to "today."

Back to Top

Page or Event Doesn't Appear in the Reports

If a page that contains the tracking code does not appear in the Content reports, check the following:

  • Are you looking for the correct page?
  • Google Analytics uses the value of the utmp parameter as the page requested, so if your page URL is /test/myPage.html, make sure you are looking for myPage.html in the Content reports. Check the value of the utmp parameter to see what page request is being sent.
  • Are you looking for the correct event?
  • Google Analytics uses the value of the utme parameter to track events in the form of 5(object*action*label)(value):
    • 5 is a constant
    • object and action are required
    • label and value are options
    For more information, see the Tracking Events documentation.
  • Are you tracking more than 50,000 unique URLs or virtual pages per day?
  • Google Analytics collects all sent from a website, and reports on the top 50,000 pages (sorted by pageviews) per day. All remaining pages are aggregated into a separate section which is labeled (other) in the content reports. To view detailed reporting information for lower-traffic pageviews, you can set up a new view (profile) with a filter to remove all the higher traffic pageviews, which effectively allows the remaining pages to be included in the top 50,000 URLs.
  • Make sure you are accessing the correct account and view (profile) in the reporting UI.
  • Google Analytics distinguishes different accounts by domain IDs, which take the form of UA-123456-1. This domain ID is inserted in the tracking code, which is how data from a page gets associated with a given account. Make sure that the account and view (profile) you are looking at (Analytics Settings -> edit -> check status) has the same domain ID as the one being sent in the utmac parameter for the GIF request.

Back to Top

Campaign Tracking Issues

In order for an ad campaign to be tracked in Google Analytics, advertising links to your website must have tracking parameters appended to them. The GATC code then uses a combination of page URL and referral parameters to identify the campaign being sent. This information is then is stored in the cookie for your site and sent in the utmcc parameter of the GIF request. In many cases, website URL redirects will strip either the tracking parameters or the referral data from these links, and this leads to incorrect campaign reports.

To test if redirects are causing campaign tracking issues, click a referral or tagged link pointing to your website and look for the proper campaign data in the utmcc parameter. To learn more about how to find and read the utmcc parameter, see The GIF Request Parameters and Debugging with ga_debug.js.

Goal (Conversion) Attribution not Correct

A conversion is a goal that is associated with a specific campaign. To make sure that you have correctly associated a goal to a given campaign or referral, do the following:

  1. Click on a referral to your site—this sets the campaign cookies.
  2. Click through your site to the conversion or goal page.
  3. Check the data sent in the utmcc parameter to ensure that the campaign cookie is maintained.

After the tracking code captures all of the campaign information, it is stored in a cookie that persists with the user over multiple sessions. For each page that executes the tracking functions, the campaign information is sent in the GIF request. Therefore, each page view has campaign/referral data associated with it. If one of these page views is configured as a goal, the associated page view campaign is then associated with the goal. To learn more about how to find and read the utmcc parameter, see The GIF Request Parameters and Debugging with ga_debug.js.

Back to Top

Basic Debugging Steps

Each time the Google Analytics Tracking Code executes, it requests a single-pixel GIF image from the Google Analytics collection servers called __utm.gif.  Appended to the request string for the image are all the parameters Google captures about a particular page request, including:

  • URL pageview information
  • Campaign information
  • Ecommerce data
  • Browser properties
  • Client IDs

The data contained in the GIF request corresponds exactly to the data sent to the Google Analytics servers, which then gets processed and ends up in your reports. So by viewing the data sent in the __utm.gif request, you can determine if the tracking code is working and, more importantly, whether it's sending incorrect data to your reports.

To debug your tracking code, follow these basic steps:

  1. Use a 3rd-party debugging tool to inspect the GIF request to Google Analytics by clicking on the relevant link on your website.
  2. Verify the tracking code doesn't contain any of the common tracking code errors.
  3. Ensure that the utmp parameter is present.
  4. Ensure that the utmcc parameter is present and non-empty.
    In the case of an empty utmcc parameter, no cookie data is sent, and the request is ignored.
  5. Repeat the test several times to ensure the GIF request is sent every time.

Back to Top

Debugging Tools

The GIF request has number of name/value parameters attached to its URL. Rather than trying to look at this string in its entirety, you can use a free tool to display the GIF request in a more readable form. The following table lists a number of tools for use with the most common browsers.

For convenience, we have developed the Google Analytics Tracking Code Debugger, which helps you to troubleshoot tracking code issues without requiring coding changes on your part. Simply enable this extension and you can check your production pages for errors. Read more about ga_debug.js.

Browser Tool
All Firebug Lite
Chrome Google Analytics Tracking Code Debugger New!
Chrome Built-in Developer Tools (e.g. Resources)
Firefox Live HTTP Headers
Firefox Firebug
Firefox Charles
Internet Explorer Fiddler
Internet Explorer Charles
Safari Built-in Activity window
Safari Charles

Once you install the tool and have it set up, you can open the web page you want to troubleshoot and see the GIF analysis in the tool. First you want to make sure that the page in question is indeed sending a __utm.gif request. As long as you see the request, you can be sure that the Google Analytics servers are collecting data from that page. The rest of this section gives basic instructions for using Live HTTP Header and Firebug, to give you a sense of how easy it is to use built-in tools or add-ons with your web browser.

Using Live HTTP Headers

  1. Download and Install LiveHTTPHeaders for Firefox; Restart your browser.
  2. Open Live HTTP Headers (Tools > LiveHTTPHeaders).
  3. Click on the Generator tab.
  4. Navigate to your site (or any page that has Google Analytics Tracking code installed).
  5. Verify that a request is made for either urchin.js or ga.js
  6. Check that a request is made for __utm.gif.

Using Firebug

The Firebug extension presents a more structured view of both the tracking code request (urchin.js or ga.js) as well as the GIF request (__utm.gif).  These steps show how to use Firebug to view the details of the GIF request.

  1. Download and Install Firebug for Firefox; Restart your browser.
  2. Navigate to your site.
  3. In Firefox, select Tools> Firebug > Open Firebug > "Enable Firebug for this web site".
  4. Click Net then Images.
  5. Reload the page and check that a new request for __utm.gif appears in the list.
  6. Verify the components of the request in the Params tab.

Back to Top

Debugging with ga_debug.js

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.

If you use the Universal Analytics (analytics.js) to track your sites, you can enable analytics_debug.js, the debug version of analytics.js, to troubleshoot the tracking code. For more information on analytics_debug.js, see Debugging.

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.

Back to Top

The GIF Request Parameters

The GIF request is quite long. Here is an example of only a part of a GIF request:   

This table contains a listing of the many of the parameters passed in via the GIF Request. Not all parameters are passed in with every execution of the tracking code, since some apply only to certain conditions, such as campaign referrals or shopping carts. When using this reference, keep in mind that you will be looking for those variables that most commonly apply to the page/request you are investigating.

Variable Description Example Value
utmac Account String. Appears on all requests. utmac=UA-2202604-2
Cookie values. This request parameter sends all the cookies requested from the page.
utmcc=__utma%3D117243.1695285.22%3B%2B __utmz%3D117945243.1202416366.21.10. utmcsr%3Db%7C utmccn%3D(referral)%7C utmcmd%3Dreferral%7C utmcct%3D%252Fissue%3B%2B
utmcn Starts a new campaign session. Either utmcn or utmcr is present on any given request. Changes the campaign tracking data; but does not start a new session
Indicates a repeat campaign visit. This is set when any subsequent clicks occur on the same link. Either utmcn or utmcr is present on any given request.
Language encoding for the browser. Some browsers don't set this, in which case it is set to "-"
Page title, which is a URL-encoded string. utmdt=analytics%20page%20test
utme Extensible Parameter Value is encoded. Used for events and custom variables.
Flash Version utmfl=9.0%20r48&

Host Name, which is a URL-encoded string.

A random number used to link Analytics GIF requests with Google AdSense. utmhid=2059107202
Product Code. This is the sku code for a given product.

Product Name, which is a URL-encoded string. utmipn=tee%20shirt
Unit Price. Set at the item level. Value is set to numbers only in U.S. currency format.
Quantity. utmiqt=4
Variations on an item. For example: large, medium, small, pink, white, black, green. String is URL-encoded.
Indicates if browser is Java-enabled. 1 is true. utmje=1
Unique ID generated for each GIF request to prevent caching of the GIF image. utmn=1142651215
Page request of the current page. utmp=/testDirectory/myPage.html
Referral, complete URL. utmr=
Screen color depth utmsc=24-bit
Screen resolution utmsr=2400x1920
Indicates the type of request, which is one of: event, transaction, item, or custom variable. If this value is not present in the GIF request, the request is typed as page. utmt=event
Billing City utmtci=San%20Diego
Billing Country utmtco=United%20Kingdom
Order ID, URL-encoded string. utmtid=a2343898
Billing region, URL-encoded string. utmtrg=New%20Brunswick
Shipping cost. Values as for unit and price. utmtsp=23.95
Affiliation. Typically used for brick and mortar applications in ecommerce. utmtst=google%20mtv%20store
Total. Values as for unit and price. utmtto=334.56
Tax. Values as for unit and price. utmttx=29.16
Browser language. utmul=pt-br
Tracking code version utmwv=1


Back to Top