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.
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.
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.