How to Exclude Query String Parameters from Google Analytics Reports
Clean up your Google Analytics page reports for improved attribution reporting and analysis by excluding useless query parameters.
Do you ever look at page reports in Google Analytics and wonder why you have so many seemingly duplicate URLs that look something like this:
And you’re left scratching your head wondering why all of these links lead to your homepage with the same content?
Or how about checkout:
? and &
Are query parameters that append to the end of your base URLs.
Where Do Query Parameters Come From
If you are active in digital marketing and utilize email, affiliate, display, or referral marketing then you have likely seen this in your reports. You’ll even see these from native eCommerce platform configurations.
Example: ?SID is a Magento session ID where ?refresh_count is a Shopify query parameter in checkout steps.
Generally speaking, there are two primary functions of query parameters:
- Query parameters that change the content on the page (think sort by on category pages or ?variant=123xyz for changing the selected product on a product page)
- Query parameters that push data back to another data source without changing the content on the page
Using the previous homepage example: mc_cid and mc_eid are from Mailchimp and automatically appended to links within emails that you send out. These help push email reporting data back into Mailchimp (opens, clicks, etc).
This is generally the same for other digital marketing platforms as well like Doubleclick, Facebook, etc.
You’ll want to focus on cleaning up query parameter type # 2 since these don’t provide much value in Google Analytics reporting analysis.
Why Do Query Parameters Cause Problems
These generally don’t hurt your website per se, they just cause messy analytics reports when you’re attempting to analyze data in bulk. Here’s an example of a page report that has multiple rows of data even though it’s technically the same page:
Now if you’re trying to analyze/compare page performance in bulk then pages affected by these query parameters will not have an accurate roll up amount and you will have to add these up manually (no thanks!).
How to Fix Page Reports by Excluding Query Parameters
This is pretty simple and can be accomplished in a few different ways:
- Create a custom advanced filter that will look for all ? and & query parameters and filter these out automatically
- Utilize the native “Exclude URL Query Parameters” configuration in your Google Analytics View Settings (preferred)
Option 1: Create Filter to Exclude All Query Parameters
This is done through a Search and Replace filter that you can set on your view.
Please be sure to implement this on a Test view first!
Here is what the filter looks like:
Once you save – that’s it! All query params will now be removed in your row report data.
Option 2: Use Exclude Query Parameters Config Setting
You can find this setting in Google Analytics > Select Your Main View > View Settings:
Here you’ll include all of your query parameters that you’d like to exclude from reports.
IMPORTANT: This will not exclude the page URL from being recorded in Google Analytics, this will simply remove these query parameter values from your URLs so they roll up to the actual URL.
- /collections/dresses – 500 pageviews
- /collections/dresses?mc_cid=123431 – 3 pageviews
- /collections/dresses?mc_cid=34323431 – 7 pageviews
Will then look like this for future hits:
- /collections/dresses – 510 pageviews
Remember that this setting does not go back and update historical hits, this will only clean up future page hits.
If you have any questions or issues updating this setting in your Analytics account drop a comment below.
Get Exclusive Elevar Insights directly to your inbox.
Get free analytics tips and resources delivered directly to your inbox.
Shopify Tagging Experts
Learn how Elevar helps Shopify brands scale with expert server side tagging.Learn More