Guide 07 · Debugging · GA4 + Tag Manager
debug_mode with gtag: one line in the config, and the line that turns it off
With gtag.js, debug_mode: true goes in the config command for all events or in one event call for a single event. Turning it off means deleting the parameter, not setting it false.
After the steps below, your events appear in DebugView from the gtag install, and the live snippet carries no debug_mode parameter at all.
Download the check: the debugging check (JSON) (MD5 329c98ce8ee1a27940120863b239eab8, 480 bytes). It lists the checkpoints from this guide and the worked check, with the figures recomputed. The file was built for this guide and validated structurally — it was not exported from a live container or a live property.
What you need
- The gtag snippet on the site. The Google tag installed directly in the page, not through Tag Manager — this guide is for the direct install only.
- Your Measurement ID. The G- ID in the config command, so the debug events go to the right property.
- Access to DebugView. Admin, then Data display, then DebugView, on the property the snippet sends to.
- Access to the site code. You will edit the snippet, so you need the file or the template that carries it, and a way to publish the change.
The trace
The worked check: the figures below were recomputed before publication, and the note under the table shows the working.
| Check | Figure |
|---|---|
| Events sent while debug_mode was on | 8 |
| Events that reached DebugView | 8 |
| Events that reached DebugView after the parameter was removed | 0 |
| Share of debug events in DebugView | 100.00% |
Eight events were sent while debug_mode was on and 8 of them reached DebugView, so 8 divided by 8 is 100.00%. After the parameter was deleted from the snippet, 0 events reached DebugView — 8 minus 8 is 0 — which is the proof the removal worked.
- Find the config command. Open the page template that carries the gtag snippet and find the line
gtag('config', 'G-XXXXXXXXXX');. The Measurement ID in that line is the property your events go to. Do not change the ID; you are only adding a parameter. - Add debug_mode to the config to watch all events. Change the line to
gtag('config', 'G-XXXXXXXXXX', { 'debug_mode': true });. This marks every event on the page for DebugView. Save and publish the change to your test page only, if your site allows that; otherwise change it, test, and change it back in the same session. - Or add it to one event call to watch one event. To watch a single event, leave the config alone and add the parameter to that event only, for example
gtag('event', 'sign_up', { 'debug_mode': true });. Every other event stays out of DebugView. - Test and read DebugView. Load the page, do the action, and open DebugView from Admin, then Data display. The event should appear in the Seconds stream within a minute. Click it to read its parameters. If it is not there, the snippet on the page is not the snippet you edited — check you published the right file.
- Remove the parameter to turn debug mode off. Delete the
'debug_mode': trueparameter from the config or the event call. Setting it tofalsedoes not disable debug mode. Publish the change, reload the page, and confirm DebugView stays empty.
Dead ends
DEAD END — debug_mode: FALSE STILL DEBUGGING. Google's DebugView page says setting the parameter to false does not disable debug mode. The only off switch is deleting the parameter. If DebugView still fills after your fix, search the snippet for debug_mode and delete the whole parameter.
DEAD END — EDITING THE SNIPPET IN ONE PLACE, TESTING ANOTHER. Many sites carry the gtag snippet in a shared header template, but some pages carry their own copy. Editing the template while testing a page with its own copy changes nothing. Find the snippet on the page you are testing, in the page source.
DEAD END — LEAVING DEBUG ON IN PRODUCTION. A config with debug_mode left in place marks every visitor's events for DebugView. It also marks them as developer traffic, which a data filter can then exclude from reports permanently. Remove it the same day you add it.
End state
debug_mode added in exactly one place, the event confirmed in DebugView, and the parameter deleted before the change went live for everyone. The snippet on the live site is back to its plain form, with no debug parameter in it.
Sources
- Analytics Help — Monitor events in DebugView — Adding debug_mode: true to the gtag config command for all events or to one event call for some events, and deleting the parameter to disable it
- Analytics Help — Confirm that you are collecting data — DebugView as the report that confirms the events are being collected
Checked 11 November 2026. The click paths above are the ones in Google's help pages, opened 11 November 2026. What was run: the DebugView share, recomputed — 8 of 8 events reached DebugView while debug was on, 100.00%, and 0 reached it after the parameter was deleted. No step in this guide was run inside a live Analytics property or a live Tag Manager container, because both need a Google sign-in and this site does not sign in as anyone. Google moves menu items without warning; if a path on this page no longer matches, the linked help page is the current map.