
October 21, 2020
How to remove gtm_debug=x from Google Analytics reports
This will be a quick guide. When Google Tag Manager introduced a new Preview Mode in October 2020, some Google Analytics users started complaining that their GA reports are now littered with ?gtm_debug=x.
In today’s blog post, I’ll show you how to remove gtm_debug=x parameter from Google Analytics reports.
But keep in mind: this applies only for future data. You CANNOT alter data that has been already processed by GA.

This is caused by the Preview and Debug mode
When you enable GTM preview and debug mode (and you keep the following checkbox enabled)…
…a gtm_debug=x parameter will be added to the URL of your website. It is recommended to have this parameter enabled in order to have a properly functioning Preview mode.
And since this is visible in the URL, your analytics tools (including Google Analytics) are automatically tracking it as well.
So, what to do?
This indicates another problem
Remember this: gtm_debug=x is visible in the URL only for those who have enabled the preview mode. In other words, pageviews that are tracked with gtm_debug=x are either your own or of your coworkers/clients. Hence, this is internal traffic.
And you should exclude it from your regular reports because it extorts that data.
Option #1: exclude your internal traffic
Here are a couple of options on how to tackle that:
- Based on IP address
- Based on a custom dimension (works better when many people are working from home)
So if you exclude your own traffic from the main Google Analytics views, the gtm_debug=x problem will be greatly reduced. And if you see this parameter in your test view, well, what’s the problem with that?
Option #2: Exclude gtm_debug query parameter
In Universal Analytics, you can exclude certain query parameters from the reports, and (as you can guess) gtm_debug is a query parameter. This can be done on the View level.
Log in to Google Analytics > Admin > Select the property > View Settings (in the View column)
In the section Exclude URL Query Parameters enter gtm_debug. NOT gtm_debug=x. Enter JUST gtm_debug. If you already have some query parameters there, then add a comma before gtm_debug.
Click SAVE.
If you want to apply this to more views, repeat the same sequence of actions in every other view as well. There is no automated way for this (as far as I know).
From this moment, you won’t be seeing gtm_debug=x in your newly collected data.
Option #3: Disable the checkbox in the Preview Mode’s launcher
When you click Preview button in the GTM interface, you have an option to uncheck the Include debug signal in the URL checkbox. This one will remove the parameter from the URL. But if you do that, on some website’s the preview mode might not launch. So it is recommended to keep the checkbox enabled.
Final Words
Personally, I’d just make sure that I’m doing my best to exclude the internal traffic of the company and that way avoid the gtm_debug=x parameter appearing in my reports (or at least minimizing its impact).
And then, as a backup plan, I’d update the query parameter exclusion list.

3 COMMENTS
Hi Julius,
Thanks for this article. Just to verify, if there's no way to exclude all internal traffic now (with anonymize IP as well as people working from home/different locations), and you use this method, won't this just strip the url parameters from that hit? Meaning, the traffic is still being sent, and events being fired/goal destinations being reached, the only difference is that you are not able to see the "gtm_debug" in the url query parameter, right?
So that means the data pollution is still happening, but you just can't see the query parameters that let you know the goals/events are not real, but tests. Right? Wouldn't a filter that targets tagassistant.google.com be better?
A referral exclusion would just "not start a new session" but it would count traffic coming from tagassistant.google.com as a direct traffic because the session, does not start at my site, but tagassistant.google.com.
Can this be removed for GA4 universally? OR do you have to filter it out on all of your reports? I was hoping to be able to set up once.
Yes. Read here https://analyticsmania.com/post/exclude-url-query-parameters-in-google-analytics-4