A backside of a witch holding a broom walking into the woods.

One String to Rule Them All, How to Filter Query Strings for Consolidated Reports

Sean McClain
Senior Business Intelligence Associate
Jan 21, 2021

Query parameters cause reports to become disparate and stratify page URL reporting, which dilutes their value and confuses business stakeholders. This article helps analysts organize and consolidate their report content which will save time and ensure business users can easily understand reporting.

So you think you’re a Google Analytics expert? Do you have your Account, Property, and Views organized, linked all your other products, and set up your custom variables? I bet you’re even using content groups to drive more meaningful reporting, eh? Well, what about all those query parameters in your pages reports?

That’s right. This article is about those sinister query parameters. I’m talking about those value pairs joined at the hip by a dastardly “=” starting with “?” and stacked together by those “&” to clutter and divide your pages reports until all you see is 99% of your sessions in the (other) content section.

Never fear! your Google Gandalf is here to lead you through the murky URL parameter marshes, beyond the report setting and admin forests, to the warm and cozy lands of consolidated content reporting.

What are query string parameters?

Query string parameters are extensions of a website’s base Uniform Resource Locator (URL) loaded by a web browser or client application. Originally query strings were used to record the content of an HTML form or web form on a given page. These strings consist of field-value pairs that look like this “field=value” strung together by an ampersand “&”  and are separated from the base URL by a question mark “?”. While query parameters are useful, they can create disparate and unorganized reporting in your Google Analytics instance.  

For an example, consider the following two URLs:

In the example, the pages show the exact same content, but because of the query parameter “linkId,” the pages were split into two distinct reporting pages. Lucky for us, Google thought of this issue when they set up Google Analytics!

When we understand how query parameters affect page reporting in Google Analytics, we can accurately choose which parameters are appropriate for removal, which will help consolidate reporting and ensure business users can easily understand the end report.

How to Filter Using the “Exclude URL Query Parameters” View Setting

All we have to do is navigate to Admin > View Settings > Exclude URL Query Parameters and type the query string in as shown below.

Now when you check the same report you will see this:

Considerations: For this method, the text box can only hold 256 characters, so if you have a long list of parameters to exclude then consider one of the other methods listed below. The second consideration for using this method is that this is at the view level in reporting, so the list will need to be copied into the view settings for every view that you would like to have applied.

How to  Filter on the Account Level

If your list of parameters is as long as the road to Mordor from Bag-End and you would just prefer to remove all query strings from reporting, then try using filters. All we have to do is navigate to Admin > All Filters select Custom > Search and Replace then Select Request URL from the Filter Field and type ?.* into the Search String.

This will remove all values after "?" in your URL and effectively erase query strings from your pages in reporting. For those of you flipping your lid over your precious UTM parameters DON'T WORRY, these are applied before filters so your precious campaigns are safe and sound.

Exceptions: Including Search Queries in Filtered Reporting

I wouldn't be your Google Gandalf if I didn't address the big stone troll at the campfire. Some of you epic analysts want to keep your Search Query Parameters, the parameters that identify what users search for on your internal site search boxes.

If this is the case, you will need to set up Site Search Tracking. To find this setting navigate back to Admin > View Settings > Site Search Settings turn on Site search Tracking and enter your Site search Query parameters. Finally, select Strip query parameters out of URL to remove them from your URLs before any other filtering is applied.

Considerations: This article applies to the current version of Google Analytics. Future versions of Google Analytics, including GA4, may have different setting configurations and will therefore need other methods to deal with query string parameter filtering in reports. Currently, it is not clear if GA4 will add any configuration settings that will allow query string parameter filtering. It is recommended that queries be removed in Google Tag Manager if you would like them removed from GA4 reporting.

What do resultant reports look like and what can they mean for your business? 

Using query parameter filtering properly creates concise, consolidated reporting that is easy to read for any business user. Just a few filter values takes a table that looks like this:

And turns it into a table that looks like this:

This gives the business user much more actionable, consolidated metrics to analyze and understand when comparing website page traffic. And a new understanding should be the goal of any epic endeavor, whether the journey is from Wilderland to Western shore or from chaos to consolidated reporting.

Want to take your Analytics Reporting to the next level? Send us a raven (or fill out the form) for more information.

Sean McClain
Senior Business Intelligence Associate

Sean McClain helps enterprise-level businesses achieve measurable impact through data and AI. As the Data Engineering Lead at Further, Sean works with expert members of the Data & Cloud Engineering team as well as the Data Science & AI team to create and maintain cutting-edge solutions to business problems. In his free time, Sean enjoys triathlon training, reading, and walking with his dog Diesel.


Read More Insights From Our Team

View All

Take your company further. Unlock the power of data-driven decisions.

Go Further Today