Excluding URL Query Parameters from Google Analytics

So today was spent trying to find a solution for query string parameters in Google Analytics. Remember, the query string parameters are all the junk after the question mark in the URL. Some query parameters can be useful for example on an ecommerce website you might have a parameter which defines the product ID:

  • mywebsite.aspx/?productId=12345

But in my experience and in today’s case, most add zero value to the page name and the analysis.

So what’s the issue?

The problem is that when parameters are added to the URL – Google Analytics treats these as separate pages, so one page view can return several records. For example

This URL:

  • mywebsite.aspx/?_$ja=kw:analaytics

And this URL

  • o   mywebsite.aspx/?sess=4567

Are recorded separately in Google Analytics but are essentially the same page – skewing all your page view and visit data.

So how do you keep your Google Analytics reports clean and useful?

The first method involves indentying all the query string parameters you want to exclude and svaing them to your profile settings.

  1. Click into the “Profile Settings” page and then on “Edit” in the “Main Profile Settings Information” bar.
  2. Enter the query parameters you’d like to exclude in the “Exclude URL Query Parameters” field and click “Save Changes.”

google analytics query string parameters

However…..identifying the complete list of URL Query Parameters can take a while – and as you are only allowed 255 characters, this very rarely fixes the problem. So, for this particular client I decided to use an Advanced Filter:

Filter name: Remove all query parameters from URI
Filter type: Search and replace
Filter field A: Request URI
Search String: ^([^\?]+)\?.*
Replace String: /
Case Sensitive: NO

The advanced filter basically works by capturing all data before the “?” and excluding everything after it. So there you have it, a very quick and easy way to exclude your URL query parameters.

Please note:

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 your Google Analytics reports.

Therefore, we recommend that you always maintain an unfiltered “master” and “test” profile, because you never know when you may need to see those parameters. When you first run this query do so in the “test profile” – so you can relax knowing you won’t be caught off-guard.

Lastly, one last note! 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.

About these ads

Leave a comment

Filed under Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s