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:
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
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.
- Click into the “Profile Settings” page and then on “Edit” in the “Main Profile Settings Information” bar.
- Enter the query parameters you’d like to exclude in the “Exclude URL Query Parameters” field and click “Save Changes.”
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.
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.