How to Exclude URL Query Parameters in Google Analytics

Let's start

URL Query parameters are variables that contain information and are attached at the end of URL preceded with a question mark(?). The query parameter might be a search string or any other parameters that are attached to pass some information. This guide will help you exclude all the URL query parameters from your Google Analytics reports.

 

URL Query Parameter Problem

Let’s take an example of a single URL to help you understand the actual problem. For example, we have a URL that is

https://marketlytics.com/analytics-faq/exclude-url-query-parameters

Someone lands on our analytics-faq page and enters the term “query parameters” into the search bar. He clicks on the listed options and opens the relevant page. But this time the URL would be

https://marketlytics.com/analytics-faq/exclude-url-query-parameters?rq=query%20parameter

The query string got attached to the URL.

Now, Google Analytics will detect a unique pageview for this URL. So instead of displaying a single URL, Google Analytics displays two unique pageviews and you will see both the URLs listed in the reports.

But we want Google Analytics to detect one unique pageview for both the URLs. For doing this, we will exclude the query parameters from the end of URL.

Good Read: Excluding Multiple IPs in Google Analytics

How to Exclude URL Query Parameters

To exclude certain string parameters when processing we will enter the junk parameters into the “exclude URL query parameters field” under the view settings.

To do this, navigate to Admin >>  View >> View Settings >> Exclude URL Query Parameters

 view settings

If you have more than one parameter, enter each of the parameter separated by a comma(,). Here is an example:

rq, axm, var

Note: Remember that these queries will be excluded from the specific view, not all the views.

 

How to Find Query Strings

If you don’t know which query strings to exclude or want to check for the list of strings, follow the steps below:

Goto all pages report(Behavior >> Site Content >> All Pages)

In the search bar enter “\?” and hit enter

 filter all pages

This will display all the URLs containing query strings

 duplicate urls

Once, you add the query parameters this will affect all the reports in the respective view. Also, this will not be applied on your historic data but will be applied to all the future data.

One more thing to make clear here from the above picture. If your URL is

/blog/?offset=1475847907418

In the query parameter field, you will just enter the string “offset” that is anything between the question mark and the equality sign, not everything that is followed by a question mark.

Note: Make sure you are not excluding any strings that carry some useful information and only junk parameters are added to the list.

If you have any questions related to this topic, you can directly reach us on Twitter.

Don't miss out when new resources launch

Our customer analytics experts share wisdom only once a month

Share now
We are customer-analytics consultancy that transforms messy data into actionable insights that will help you grow your company and make better data-backed decisions.