How To Exclude URL Query Parameters In Google Analytics
If you are reading this post my guess is you are analyzing All Pages or Landing Page reports in Google Analytics and noticing how one page can show up on multiple rows with different URL parameters. In this post, I will show you how to exclude URL Query Parameters and clean up your page reports.
What is a URL Query Parameter in Google Analytics?
URL Query Parameters are the string of characters that follow the “?” in a URL String. Query parameters for marketing are useful since they contain information about what channels, campaigns, and ads are driving sessions and conversions. Advertising platforms use URL Query Parameters as well and I am sure you have seen the unreadable strings following a fbclid (Facebook Click ID) or msclkid (Microsoft Click ID).
How do you exclude a URL in a query parameter?
You can remove URL Query Parameters from your pages report in two ways:
- In your Google Analytics View Setting
- Using Google Analytics Filters on the account Level
Don’t worry. Query parameters are removed after Google Analytics processes the data so you won’t lose UTM Campaign data.
Note: URL Query Parameters should not include PII data. Query Parameter filters are applied after processing so if you do need to remove specific query parameters prior to processing you can use this GTM method from Bounteous.
Exclude URL Query Parameters in the View Setting
You can exclude URL Query Parameters in the view setting by going to Admin > View Settings > Exclude URL Query Parameters then adding the query parameters you want to exclude.
If you have more than one Query Parameter you can enter them separated by commas. For example utm_audience, fbclid, cid.
For example, if you are using custom UTM Parameters with custom dimensions in Google Analytics you would want to exclude any custom UTM values.
There are a few of drawbacks to this approach. Firstly, you are limited to 256 characters so if you a lot of URL Queries to exclude you could run out of space. Secondly, you can only exclude URL Query Parameters on the view rather than property level which means you have to repeat this exercise for every view.
Filter URL Query Parameters on the Account Level
An alternative method is to exclude URL Query Parameters on the account level using the search and replace Google Analytics filter.
To access account level filters go to Admin > All Filters then select Custom and Search and Replace under Filter Type. For the filter field select Request URI then paste the following regular expression in the Search String field.
\?.*
This will remove the first “?” in the URL string and anything after it.
Because this filter removes all URL Query Parameters after the “?” make sure there are no query parameters you do want to include in your pages report.
Conclusion
Excluding URL Query Parameters is a great way to improve page reports in Google Analytics for clean data analysis.
Always test filters before applying them to make sure applied filters are working as intended.
Leave a comment