English Posts

How to delete gtm_debug=x in Google Analytics

exclude gtm_debug from google analytics

Recently Google Tag Manager has released the new Preview mode version, where you can test your tags, triggers and variables before publish them on your website.

In this new version, you’ll see that a new URL it creates on your website.

Here you can see an example when I launch the Preview mode:

preview mode in google tag manager

Once the process is done, you can see the new URL:

url gtm_debug=x in tag manager

If you do not fix this in your Google Analytics Admin, you’ll find the page into the reports.

This’ll happen both on the Universal Analytics version:

page report in universal analytics

And in the new Google Analytics 4:

debug=x in google analytics 4

What’s the problem?

In this way, GA will process this information by showing you data, which will not be very accurate.

The total number of pageviews will be altered by the pageviews that are coming from an URL which is only useful for test your implementation before it’s published.

Not very qualitative, right?

Let’s imagine if you are not the only ne who are using the Preview mode. Your Google Analytics will continue to collect lot of useless information.

How exclude “gtm_debug=x” in Universal Analytics

Let’s go to Admin section and click on the View Settings. Select the View where you want to exclude the value “gtm_debug=x“:

admin section in google analytics

Now it’s time to fille the value “gtm_debug” into the Exclude URL Query Parameter entry (if you had more than one values, you can simply add a comma):

exclude the query parameter gtm_debug

The value “gtm_debug”is a query parameter (if you want to learn more about it, let’s read my post or discover how to find other query parameters in Google Analytics) and it needs to be excluded by typing it into the box above to avoid being collected.

Tip: the best way to do this, is to implement the solution into the Test View and then, if all it works fine, into the Master View.

How exclude “gtm_debug=x” in Google Analytics 4

The new version of GA, called Google Analytics 4 doesn’t have the views as in Universal Analytics (if you want to know how to implement GA4, read here).

We have to find another way to exclude the query parameter “gtm_debug”. You have also to consider that who works on the preview mode with GTM is an employee, yourself or an agency.

We can define these three sets as an “internal traffic” and therefore use the filter provided under the GA4 Property: Data Settings > Data Filters > Internal Traffic:

internal traffic filter google analytics 4

You can simply follow the steps described in this post to exclude internal traffic and thus also the page with the value “gtm_debug=x”.

Exclude “gtm_debug=x” in GTM

Below there is another option you can choose. The solution could be to disable the “Include debug signal in the URL” entry as in the image below:

preview mode gtm

This is the weakest option as you can read in the red box.


It is important to pay attention to these settings. Even if the values collected seem minimal and do not affect the data collected by GA, you should always avoid having Analytics process data that is not useful for analysis.

Checking or auditing your Google Analytics account at least 3/4 times every year is a good procedure in order to be sure that GA is collecting “good” data.

Good analysis!

You may also be interestd to the following articles:

Search and Replace Filter in Google Analytics

How to have Annotations in Data Studio Dashboards as in Google Analytics

Schedule Emails in Google Data Studio

How to track Single Page Applications with Google Tag Manager

How to solve the 5 million cell limit in Google Sheets

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *