These instructions are for Universal Analytics properties.
Here's a screengrab of what we'd like to clean up.
Our goal is to strip the following query parameter string from our search URLs. At the same time, still recording site search keywords so we know what people are searching for on our site.
/?s=&cat=plus-5-results
Log into your Google Analytics account and select the Universal Analytics property where you want to clean up the query parameters.
Click on Admin in the lower left of the Home page. Click on Create View in the middle panel.
Name the new View, e.g., My Site No Query Parameters. Make sure the website URL, time zone, and currency are correct.
You can keep the Default page setting blank and the Bot Filtering checked.
Make sure s,cat
are not in the Exclude URL Query Parameters field. This field is great for cleaning up non site search query parameters such as i, lang, fbclid, page, id, and linklid.
Learn more about this Exclude URL query parameters setting here.
Click the slider button to ON under Site Search Settings > Site search Tracking.
Add s
in the Query parameter field. We're telling Google that this is the search query parameter for your site. Make sure you use a comma between the two parameters.
Check the box next to Strip query parameters out of URL. This tells to Google to not show this search query parameter in reports and don't count it as a its own pageview stat.
Click the slider button to ON under Site search categories.
If you have a category search and its parameter is cat
, add cat
in the Category parameter field.
Check the box next to Strip category parameters out of URL.
Your View settings should look like this.
Click Save at the bottom of the page.
No more query parameters in Behavior > Site Content > All Pages.
But, all search terms are preserved and show up under Behavior > Site Search > Search Terms.
How to Set Up Site Search Tracking in WordPress (Step by Step) published by MonsterInsights.
Set up Site Search Google Support docs.