How to Exclude Query Parameters from Your Google Analytics Site Content Report
Written byAlex DixeySenior Analytics Executive
TopicWeb Analytics
Date16.03.21
Keeping your site content report as clean, organised and easy to understand as possible is an important component of being able to properly analyse and act upon your website data.
One of the biggest causes of a messy and unintelligible content report are query parameters. Left unchecked, query parameters can make it difficult to properly measure the amount of traffic landing on a specific page, or even occlude website data entirely.
Below, we take a closer look at query parameters, where they’re useful (and not), and how to exclude them from your content report where required.
What is a Query Parameter?
While looking through site content reports in Google Analytics (GA), or even just browsing the web, you may have noticed that some URLs contain a ‘?’, followed by a string of seemingly random letters and numbers. These are what’s known as query parameters, and they can be used to store information in the URL.
A query parameter may be appended to the URL in many circumstances - if you land on a site from a campaign, land on a specific page, or interact with certain elements of the website.
Here is an example of what query parameters may look like: www.example.co.uk/example/?id=438760&lang=en
In this example, there are two query parameters: ‘id’ with a value of 438760 and ‘lang’ with a value of en. You will see that if there are multiple query parameters in a URL, they will be separated by an ampersand.
Why Are Query Parameters a Problem in Google Analytics?
Artificially Increasing the Number of Rows
If you use the site content reports in GA, you probably already know why these parameters can be a nuisance. For starters, they can cause a single page of your website to be split across multiple rows in your reports:
Page
Pageviews
/about-us/?cid=546712
51,543
/about-us/?cid=546712&lnag=es
24,877
/about-us/?cid=?id=546712&source=email&lang=de
13,654
In this example, if you wanted to know how many pageviews the /about-us/ page had, you’d have to add up the numbers from all the different rows. Obviously, the same goes for any page metric you might be interested in.
This is a small example with only 3 rows, but what if you’re looking at a page report with hundreds or thousands of rows? This makes analysis a much more laborious task.
High Cardinality
Another problem you may run into is that of high cardinality. There is actually a limit on the number of values that any one dimension can have - for the page dimension that number is 50,000.
This means that if you have more than 50,000 pages being indexed daily you will start to see pages being grouped into a row labelled (other).
It’s unlikely that there are genuinely this many unique pages on your website and is probably in large part due to query parameters causing a single page to be split across multiple rows.
All these pages being grouped into (other) is obviously far from ideal when it comes to trying to analyse these reports, so it’s certainly something to address.
How to Remove Query Parameters from Google Analytics Reports
And so we come to the solution and, thankfully, it’s relatively straightforward and, as we have seen, could yield highly impactful results.
Firstly, we need to identify which query parameters appear in your reports. Depending on how many of these your site generates, this could be a short or long list.
Google has kindly provided us all with a spreadsheet to make the process of collating your query parameters easy - it can be found here.
You’ll need to open this in Google Sheets and install the Google Analytics add on. Detailed instructions are included on the first page of the sheet and are easy to follow.
Essentially, you’ll be pulling data from your GA account into the sheet, where it can identify and parse out the query parameters for you.
The result of running through those instructions in the sheet will be a list of all the query parameters that exist in GA in the time frame that you selected.
By going through the list and selecting YES next to the parameter you would like to exclude, the yellow box will automatically populate with a list of the selected parameters separated by commas.
We’ll cover what to do with this shortly, but first a little about knowing which parameters you should and shouldn’t exclude.
Identifying Which Query Parameters to Exclude
It’s worth noting that you don’t necessarily want to simply exclude every single query parameter.
In the case that they contain information useful to you in your analysis, or they are related to the actual content on the page, you might well keep them in your reports.
Let’s look at an example: www.example.co.uk/checkout/?stage=1&y=223856
Here the parameter ‘stage’ is telling us which stage of the checkout the user is on, so this would be good to keep. Meanwhile, ‘y’ appears to us as a random string of numbers and is not helpful in our analysis, so it would be good to exclude it.
Additionally, if your website has search functionality, it’s likely that this works by using a query parameter and you should not exclude it in this process, but more on that later.
If you are not 100% confident on which parameters to exclude, you can always set up a Test View in your GA property and implement the exclusion there first, before you make changes to your main reporting view.
Exclude Your List of Query Parameters
This is the simplest part of the process.
In GA, go to Admin > View Settings and scroll down to the ‘Exclude URL Query Parameters’ option.
Now all that’s left is to copy and paste the string in the yellow box from the spreadsheet we created earlier.
Please bear in mind that this will only affect your data after the time you exclude these parameters, it does not work retrospectively.
Site Search
As previously mentioned, if your website has search functionality it’s highly likely that this will work using a query parameter.
For example, if you’re on a homeware website and searched for ‘Plates’ the URL might look like this: www.example.co.uk/search?q=plates
If you just exclude ‘q’ in the same way as outlined above, then you would remove valuable site search data from your reports.
Instead, if you want to exclude this specific site search parameter, first do a search on your website and then look at the URL to identify its specific search query parameter.
Now, go back to your GA view settings as before and find the Site Search Settings.
(You’ll want to enable Site Search Tracking if you haven’t done so already, as this will allow your site search reports to start populating and provide you with potentially valuable insights.)
The search query parameter you identified previously should go in the text box. Now simply make sure the ‘Strip query parameters our of URL’ option is ticked.
Final Thoughts
And there you have it - give your content report a much needed clean by removing unnecessary query parameters, and see how much easier it becomes to analyse your reports.
As mentioned above, tidying your Google Analytics site content report up is a relatively quick and painless task. Having said that, if you operate a large and complex website things could easily get out of hand - if that’s the case, feel free to reach out to one of our Google Marketing Platform certified analytics consultants.