Google Analytics

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.

  1. Common Tracking Code Typos/Errors
  2. Common Report Data Issues
    1. Tracking Code Change or Setup Not Detected
    2. Page or Event Doesn't Appear in the Reports
    3. Campaign Tracking Issues
    4. Goal (Conversion) Attribution not Correct
  1. Basic Debugging Steps
  2. Debugging Tools
  3. Debugging with ga_debug.js New!
    1. Using the Google Analytics Tracking Code Debugger
  4. The GIF Request Parameters

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', 'example.com']);       // wrong
    _gaq.push(['_setDomainName', 'example.com']);   // 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.
    Examples:
    _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.

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:

http://www.google-analytics.com/__utm.gif?utmwv=4&utmn=769876874&utmhn=example.com&utmcs=ISO-8859-1&utmsr=1280x1024&utmsc=32-bit&utmul=en-us&utmje=1&utmfl=9.0%20%20r115&utmcn=1&utmdt=GATC012%20setting%20variables&utmhid=2059107202&utmr=0&utmp=/auto/GATC012.html?utm_source=www.gatc012.org&utm_campaign=campaign+gatc012&utm_term=keywords+gatc012&utm_content=content+gatc012&utm_medium=medium+gatc012&utmac=UA-30138-1&utmcc=__utma%3D97315849.1774621898.1207701397.1207701397.1207701397.1%3B...   

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
utmcc
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
utmcn=1
utmcr
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.
utmcr=1
utmcs
Language encoding for the browser. Some browsers don't set this, in which case it is set to "-"
utmcs=ISO-8859-1
utmdt
Page title, which is a URL-encoded string. utmdt=analytics%20page%20test
utme Extensible Parameter Value is encoded. Used for events and custom variables.
utmfl
Flash Version utmfl=9.0%20r48&
utmhn

Host Name, which is a URL-encoded string. utmhn=x343.gmodules.com
utmhid

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

utmipc=989898ajssi
utmipn
Product Name, which is a URL-encoded string. utmipn=tee%20shirt
utmipr
Unit Price. Set at the item level. Value is set to numbers only in U.S. currency format.
utmipr=17100.32
utmiqt
Quantity. utmiqt=4
utmiva
Variations on an item. For example: large, medium, small, pink, white, black, green. String is URL-encoded.
utmiva=red;
utmje
Indicates if browser is Java-enabled. 1 is true. utmje=1
utmn
Unique ID generated for each GIF request to prevent caching of the GIF image. utmn=1142651215
utmp
Page request of the current page. utmp=/testDirectory/myPage.html
utmr
Referral, complete URL. utmr=http://www.example.com/aboutUs/index.php?var=selected
utmsc
Screen color depth utmsc=24-bit
utmsr
Screen resolution utmsr=2400x1920&
utmt
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
utmtci
Billing City utmtci=San%20Diego
utmtco
Billing Country utmtco=United%20Kingdom
utmtid
Order ID, URL-encoded string. utmtid=a2343898
utmtrg
Billing region, URL-encoded string. utmtrg=New%20Brunswick
utmtsp
Shipping cost. Values as for unit and price. utmtsp=23.95
utmtst
Affiliation. Typically used for brick and mortar applications in ecommerce. utmtst=google%20mtv%20store
utmtto
Total. Values as for unit and price. utmtto=334.56
utmttx
Tax. Values as for unit and price. utmttx=29.16
utmul
Browser language. utmul=pt-br
utmwv
Tracking code version utmwv=1

 

Back to Top

Autenticação necessária

Você precisa fazer login com o Google+ para fazer isso.

Fazendo login...

O Google Developers precisa de sua permissão para fazer isso.