Filter that removes all query parameters

3rd June, 2010 - Posted by gabe.francis - No Comments

Query parameters are those words which come after the ? in the URL. For example, in the URL www.example.com/uri?first=string&second the word first and second are a query parameters delimited by ? and &. These are common ways of constructing dynamic websites but sometimes they get in the way of proper reporting. The query strings might mean a lot to the programmer but nothing to the marketing team who is trying to decide where to spend their advertising dollars. If this is the case on your website, here is a simple trick using Filters to clean up your  GoogleAnalytics reports.

Before you start remember that filters permanently alter data in your Analytics account. We recommend to always create a new duplicate profile before applying a filter. This ensures we don’t screw up the old data if we make a mistake. Besides, its always nice to have a raw unfiltered data set later in case we change our mind.

Open Analytics Settings for your new dupliacte Profile and in the box labelled Filter Applied to Profile click +Add Filter.

Next, give the filter the name “Remove All Query Parameters” and select the Custom Filter radio button. This is the tricky part. Using Regular Expressions we are going to tell Analytics to copy the URL before the first ? and overwrite the Request URI with that copied portion. Make sure you copy these settings exactly.

    Filter Name: “Remove All Query Parameters”

    Type: Custom Filter > Advanced Filter

    Field A -> Extract A: Request URI: (.*?)\?

    Field B -> Extract B: (leave blank)

    Output To -> Constructor: Request URI: $A1

    Field A Required: yes

    Field B Required: no

    Override Output Field: yes

    Case Sensitive: no

Here’s what it should look like:

Click Save changes. From this date forward your Analytics reports will not display any query strings for your profile.

Have an alternate method of removing all query parameters? Feel free to share it in the comments below.

No Comments

No Comments

Leave a reply

Name *

Mail *

Website