Google Analytics Configuration Mistake #2: Query String Variables

September 21, 2006 by Justin Cutroni

In my previous post I discussed how an incorrect Default Page setting can cause a single page on your website to be counted as two different pages. That same concept is the driving force behind Common Google Analytics Configuration Mistake #2. If your website uses query string parameters you may be creating hundreds or thousands of unique page views which don’t actually exist.

Google Analytics creates a unique page view using the path name, the file name and any query string parameters present in the location bar of the browser. Remember, the query string parameters are all the junk after the question mark. GA strips the domain name from the URL and the remaining info becomes a unique page.

This URL:
http://www.mysite.com<strong>/dir/index.php?sess=1234&ocId=3&var1=foo&var2=bar</strong>
Results in this page view:
<strong>/dir/index.php?sess=1234&ocId=3&var1=foo&var2=bar</strong>

And this URL:
http://www.mysite.com<strong>/dir/index.php?sess=4567&ocId=6&var1=bar&var2=foo</strong>

Results in this page view:
<strong>/dir/index.php?sess=4567&ocId=6&var1=bar&var2=foo</strong>

Now, if the query string parameters passed between pages have no functional significance, i.e. they do not influence the content that is shown to the user, they should be ignored when GA creates a unique page view. Because the query string parameters do not offer any insight into what the visitor is doing, we want GA to track the above URLs as two views to a single page, not two views for two different pages.

The concept here is that the query string parameters do not tell us anything about the visitor’s actions. If your query string parameters describe what the visitor is doing then you do not want to remove them. Example, if one of your query string parameters is a product ID then you would not want to remove it. You want to know which products a visitor views during their session.

To force GA to skip certain query string parameters when processing we enter the unwanted parameters in the ‘Exclude URL Query Parameters:’ filed in the ‘Main Website Profile Information’ section.

query_string.gif

Just enter a comma separated list of the parameters in the field I’ve outlined above. Here’s an example:
sess,ocId,var1,var2
If your site uses query string parameters to pass ANY information, I recommend you audit all query string parameters and identify which ones can be ignored. Here’s a tip, use the Top Content report to quickly identify the website query string parameters. When you pull up the Top Content report use the in-report-filter and enter \?. This will immediately display all the records containing query string parameters.

Remember, this is going to affect other parts of Google Analytics. Once you add a query string parameter to the list, it will be completely ignored. It will not be listed in ANY of the GA reports. Also, when you exclude a query string parameter you no longer need match that variable when creating goals and funnels.

As usual, changing this setting will not affect the data that has already been processed by Google Analytics. Only data processed in the future will reflect this change.


Share:
These icons link to social bookmarking sites where readers can share and discover new web pages.

  • Digg
  • Technorati
  • del.icio.us
  • Slashdot
  • StumbleUpon
  • Ma.gnolia
  • YahooMyWeb
  • co.mments
  • Reddit
Subscribe:
  1. 6 Responses to “Google Analytics Configuration Mistake #2: Query String Variables”

  2. Hi Justin,
    With respect to query string variables, I noticed you made the following comment in an older post:

    “Measuring internal site search with Google Analytics is possible. However, it depends on your website architecture. To track internal search terms with Google Analytics your internal search engine must pass the search term entered by the user in the query string. Google Analytics captures all of the data in the location bar of the browser, including the query string. If the search term is missing from the query string then GA will not be able to track it.”

    What happened to the URI? I have a situation where search terms are not passed via the URL, but I wanted to pass them via the URI and then eventually see conversion data based on site search terms. I take it that the URI won’t be of any service for the Site Search tracking, but is there a way to extract the searched terms and put them in the User Defined variable, while still capturing all page views during a user session. I find that any filters that I write to capture the search terms will ultimately exclude other page views from the profile, thus I am at a bit of an impass.

    Many thanks for any input!

    Cheers,
    Robert

    By Robert Friedman on Jan 22, 2008

  3. Hi Robert,

    Sorry for the confusion. The URI contains query string parameters. It sounds like you you need to create virtual pageviews using urchinTracker() (or pageTracker.trackPageview() ). When you use these functional you create a new Request URI which GA sees as a standard pageview.

    You can create the pageview on the click of a button or when the search results page loads in the visitor’s browser.

    Hope that helps,

    Justin

    By Justin Cutroni on Jan 24, 2008

  1. 4 Trackback(s)

  2. Sep 22, 2006: bitacle.org
  3. Oct 12, 2006: this just in » Google Analytics: How to Tell When Something is Wrong
  4. Jan 3, 2007: Analytics Talk » Top 5 Google Analytics Resolutions for 2007
  5. Jun 26, 2007: Analytics Talk » Understanding The Google Analytics Terms of Service

Post a Comment