Are you seeing what looks like duplicate page URLs in your Google Analytics reports? Have you noticed that some of the URLs look like they are for the same page, but one or more is followed by a string such as ‘?pagenumber=2‘?
If so, you have encountered the wonderful world of query string parameters.
What are Query String Parameters?
Query string parameters are attached to the end of a URL to to alter or define the way in which pages are displayed or search results retrieved for the website user. Examples include pagination, narrowing search results based on specific criteria, and changing the order of the results for the user such as order by price or alphabetically. They can be really useful, and work like a charm for the end user, particularly when sharing or bookmarking specific pages that have been pre-filtered.
Why are Query Strings in Google Analytics a Problem?
The reason you’re probably here is that you’ve been faced with multiple URLs when trying to analyse statistics such as conversion and bounce rates for a specific page in your Google Analytics account.
The issue is that the default setup for Google Analytics treats page URLs containing query parameters as unique pages, even though the page content may remain the same.
The good news is, there’s a relatively easy resolution, but first you need to identify the query parameters used within your website in order to exclude them from being processed by GA.
How to Identify Query String Parameters
If you have been running Google Analytics for a while, your account should have some previous history to work with, so this is a good place to start.
Navigate to ‘Behavior > Site Content > All Pages‘.
Use the search box above the results table to search for ‘?’ (a question mark denotes the start of a query). This will return all URLs where a query parameter has been used to alter page content.
You will notice the parameter immediately follows the question mark, for example ‘?pagenumber=2‘ indicates that the user has navigated to page 2. If multiple parameters have been used, they will be joined with an ampersand (&), such as ‘?pagenumber=2&orderby=price‘. In this example, the user has navigated to page 2 and also ordered the results on the page by price.
If you don’t have enough history in Google Analytics, you can find many of these parameters by navigating through your website and inspecting the URLs that appear in the address bar in the process.
Excluding Query String Parameters from Page URLs
To stop query parameters from appearing in your page URLs, you will need to edit the View Settings of your particular property, however I would recommend you do this in a ‘test’ view first.
- Navigate to ‘Admin’
- Choose the correct Account, Property and View. (Do this in a test view first)
- Click ‘View Settings’
- Navigate to the ‘Exclude URL Query Parameters’ field.
- Include each parameter in the field, separated by commas.
- Click Save
Excluding Site Searches
If your site has a search facility, you may also need to enable ‘Site search Tracking’ which will allow you to exclude site searches from your page URLs in your reports.
Enter the search query parameter in the ‘Query parameter‘ field, and then choose whether you wish to strip these parameters from the URL.
Site searches are normally identified with ‘q‘ or ‘s‘ query parameters, but every site can vary, so do your own research on this.
Note: If you strip site search query parameters from the URL, you will still be able to view all of your website searches under ‘Behavior > Site Search > Search Terms‘.
Identifying Site Search Category Parameters
Another feature also allows you to identify the category parameter within the URL and exclude it from page URLs. A category parameter is used in advanced search to filter searches to specific product categories.
Once the category parameter is added, you will also be able to see these categories in ‘Behavior > Site Search > Search Terms > Site Search Category‘.
Here’s an example view with multiple URL query parameters excluded, site search query parameter stripped and the category parameter identified and stripped also.