Technical query parameters can really mess up your Google Analytics data.
Are you running an ecommerce site? Take a look at your content reports and you might see lots of duplicate pages showing up.
Here is an URL that contains technical query parameters:
The URL without query parameters:
http://www.ebay.com/itm/2014-SANTA-CRUZ-BRONSON-C-LARGE-10-SPEED-CARBON-MOUNTAIN-BIKE-DISC-27-5-/221674641722
The query parameters:
?pt=US_Bicycles_Frames&hash=item339cd6993a
In this case pt and hash are technical query parameters. Why technical?
For visitors the page without query parameters is exactly the same as when it is loaded with query parameters. And they don’t have any meaning in relation to Analytics.
Very often session IDs are generated during your visit to a website.
“You’ll create a lot of duplicate pages in Google Analytics if you don’t filter these parameters out of your data. This makes it more difficult to analyze the effectiveness of your content.”
Here is an example:
As you can see, it definitely ruins the content reports in Google Analytics. More than 16.000 pages that don’t make sense!
Tip 12: Remove All Your Technical Query Parameters
Difference Between Technical and Functional Query Parameters
First of all it is important to understand the background of query parameters. You don’t want to delete them without knowing what you are doing.
How I distinguish between them:
“Technical query parameters have a technical website function; stripping them from your URL does in most cases not change the actual page a website visitor sees. If they do change your website experience, they are connected to selection criteria on your website. In most cases you still want to remove them from the URL in Google Analytics.“
“Functional query parameters are important to keep in Google Analytics because they represent a unique pageview for your visitor. If you strip them from your reporting, you won’t know which page the user is viewing.”
An example of a functional query parameter is shown below:
www.test.com/contact/?page=thanks
The page above wouldn’t show up correctly in GA if you delete all query parameters in one time. It would be registered as www.test.com/contact/ in that case. And it’s a different page.
Filter to Strip All Query Parameters
I recommend to use the filter below (if you are 100% sure your website only contains technical query parameters):
It removes all query parameters from your pages in the content report section.
You could change your default data view settings as well. This works well if you just want to remove a few parameters instead of all of them.
Change Your Reporting View Settings
There is an option to remove query parameters via your reporting view settings.
In the past the number of query parameters was limited to five query parameters only. Happily Google Analytics changed it over time.
There is a 2048-character limit now. This setting is case sensitive. Enter as a comma-separated list.
You can the add the query parameters in the following way:
- Navigate to View Settings via Admin Interface
- Add the parameters in the Exclude URL Query Parameters field
Please see the screenshot below:
This it it! Check your website and Google Analytics account. Make sure to get rid of all the query parameters that you don’t need to correctly interpret your data.
Recommend readings:
One last thing... Make sure to get my automated Google Analytics 4 Audit Tool. It contains 30 key health checks on the GA4 Setup.
André Mafei says
I think the regex should be:
(.*)\?
not:
(.*?)\?
but both should work.
Paul Koks says
Thanks for your comment André. I have used the first one in different cases and think they should both work like you say!
At least it is a great filter to clean up your data.
Kenneth Holland says
Hi Paul,
Love your articles on GA…they’ve been helping me immensely.
Question:
How do I determine if my site is only using technical query parameters? I have a new website going up…it’s a news site, so there will be a lot of content so I think getting this right will apply to me.
Thanks :)
KH
Paul Koks says
Hi Kenneth,
Great to hear from you and thanks a lot for your feedback.
If you know how your site and URLs are technically configured, you can probably identify the parameters upfront. And decide whether the suggested filter in this article suits your situation.
The content section in GA and filter field will help you to remove the query parameters one by one and see what’s left. In my experience there is some manual labor involved, but it can be done very quickly.
You can use Excel combined with tools like Screaming Frog to speed up the process.
Btw, most news sites I have seen only use technical query parameters, but once again it depends on how the site is built /structured.
Hope this helps!
Thanks,
Paul
Kenneth Holland says
Hi Paul,
Thanks so much for responding. Some of what you wrote went right over my head LOL
I’m going to try to hire someone to sort this. It seems important.
Let me tell you this: My URLs are structured in WordPress with date and the keyword title.
Does that give anything to go on?
Again, thank you! :)
KH
Paul Koks says
Hi Kenneth,
You are more than welcome. :-)
Date and keyword title won’t lead to query parameters that need to be filtered. Do you want me to take a quick look at your site and stats? Or probably it is not yet up and running.
This guide will give you a lot of background information on configuring Google Analytics in general.:
https://online-metrics.com/google-analytics-account/
Just let me know how things go.
Good luck!
Paul
Kenneth Holland says
Hi Paul,
I’ve been going through that guide and it’s been a great help!!
Correct…the site is not up yet.
What I’ll do is put up a dummy post this week and let you look (unless you need to log in…then let me know and I’ll set up a login).
In the near future I might modify the URL’s to comply with Google News, but not right away. I wonder if that could lead to qp.
Anyway, let me know your thoughts and thanks again!
Cheers
KH
Paul Koks says
Hi Kenneth,
Glad to hear that guide helps you a lot.
I am not sure about Google News, but I would not expect to cause this qp in the URL.
I would suggest this:
– Get your website up and running
– Make sure that GA is active
Normally I don’t do this, but I make an exception. :-)
Just give me access to your GA account and let me take a look at your site, and I will give you feedback. If there are no active there is no need to have me take a look.
Thanks,
Paul
Kenneth Holland says
Paul, that’s very nice of you! :)
Ok, I plan to have it up one week from today (next Monday) so I’ll let you know right when I do. :)
Ken
Quick Question: How do I filter out my visits so they don’t show?
KH
Paul Koks says
Hi,
You need to locate your IP address -> http://whatismyipaddress.com/
Set up an exclude filter on this IP address in Google Analytics and you are all set.
This guide will help you out: https://online-metrics.com/google-analytics-filters/
Best,
Paul
Kenneth says
Hi Paul,
Thanks for your reply on the GA filtering.
I’m assuming that I should check my IP every day because I can change?
Is there possibly a way to exclude me based on being logged in to WordPress??
Again thank you! :)
P.S. I still haven’t launched the site yet…a few days out. Will let you know. :)
Ken
Paul Koks says
Hi Kenneth,
Is your IP address changing every day, so it’s dynamic then? Or maybe you work from different locations.
Well, I’ve got a better solution for you then. :-)
1) Install Ghostery in your browser (Chrome works great) – https://chrome.google.com/webstore/detail/ghostery/mlomiejdfkolichcflejclcbmpeaniij?hl=en
2) Make sure it is active
3) Go to a / your website where Google Analytics is installed
4) You will see a Google Analytics tracker showing up in the Ghostery plugin
5) Block Google Analytics (on default Google Analytics is active)
This way your behaviour won’t be measured in Google Analytics. Make sure to use the browser that contains the Ghostery plugin.
Paul
farzad says
Hi
Thank you very much Paul for all your fantastic articles
I have a question about effect of removing query parameters on campaign utm.
could you please explain the effect if there is?
Paul Koks says
Thanks for the heads up Farzad! Removing query parameters doesn’t affect utm tracking. After you have implemented utm tracking correctly you are all good!
Nathan says
Hi,
Interestingly I have been looking at something like this to potentially stop malicious injections of personal data under GDPR. For example I might type the URL: http://www.example.com/?name=bobsmith@address=12smithstreetlondon
Unless query strings are blocked, my GA now includes personal data which is against GDPR and the terms of service of GA.
So I have considered blocking with a filter such as your above. My question is two-fold. Firstly, what happens to utm_source, utm_medium etc and secondly, assuming there is some query paramters we wanted (e.g. internal site search and pagination) is there a way to execute filters to block all, but allow exceptions – opposite to the default function which is allow all and block those listed.
Paul Koks says
Hi Nathan,
1) Nothing happens to utm_source, utm_medium etc. Those are all processed as normal.
2) There might be a way to write such a filter, but it is highly dynamic and you really need to test that. Never tried.
3) PII should be countered at the property level, so this filter is not a solution.
https://online-metrics.com/pii-google-analytics/
Bruna says
Hello Paul. Please help:
GA is saving UTM parameters on Pageview dimensions, and the weird part is that the utms start with a hashtag. (I check Google Adwords and Bing and the URLs are perfectly correct). Please see how the URLs are being showed on GA:
1) /#utm_source=google&utm_medium=paidsearch&utm_campaign=institucional&utm_term=chubb seguros&utm_content=375919621595
2)
/#utm_source=bing&utm_medium=paidsearch&utm_campaign=generico_2&utm_term=seguro viagem internacional&utm_content={creative}
I thought about removing query strings on the URL on GA where I’d add ‘utm’ but I am afraid of removing tracking…
Please help!
Paul Koks says
Hi Bruna,
Not sure what is causing this IF the integration is set up properly.
Removing the query strings shouldn’t break your tracking. You can always test this in a Test View and if it works apply the same rules / filter to the Master View.
Best,
Paul