ref : https://developers.google.com/analytics/resources/articles/gaTrackingTroubleshooting?hl=zh-CN#utmParameters
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:
The rest of this document covers how you can use troubleshooting tools to help identify and correct these two basic issues.
|
|
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.
_gaq.push(['_trackpageview']); // wrong _gaq.push(['_trackPageView']); // wrong _gaq.push(['_trackPageview']); // correct
_gaq.push(['_setDomain', 'example.com']); // wrong _gaq.push(['_setDomainName', 'example.com']); // correct
_gaq.push(['_setAllowLinker', 'false']); // wrong _gaq.push(['_setAllowLinker', false]); // correct
_gaq.push(['_setAccount', ' UA-65432-1']); // wrong _gaq.push(['_setAccount', 'UA-65432-1']); // correct
Back to Top
If you have data missing from your reports, read this section to help identify the most common errors and recommended actions.
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:
ga.js
JavaScript__utm.gif
utmac
and utmcc
variables are being sent in the __utm.gif
requestIf 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
If a page that contains the tracking code does not appear in the Content reports, check the following:
utmp
parameter as the page requested, so if your page URL is /test/myPage.html
, make sure you are looking for myPage.htmlin the Content reports. Check the value of the utmp
parameter to see what page request is being sent.utme
parameter to track events in the form of 5(object*action*label)(value)
:
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 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
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 visitor 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.
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:
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 visitor 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
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:
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:
utmp
parameter is present.utmcc
parameter is present and non-empty.utmcc
parameter, no cookie data is sent, and the request is ignored.Back to Top
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.
urchin.js
or ga.js
__utm.gif
. 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.
Back to Top
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 thewindow.console
object. You can then use one of the following tools to view these errors:
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.
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.
Back to Top
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