debug_mode hardcoded to true
debug_mode is set to literal "true" instead of a GTM variable, so it stays on in production.
Summary
- rule_id —
ga4-debug-mode-hardcoded - purpose — Detect GA4 tags with
debug_modehardcoded to the literal string"true" - effect — Events are excluded from standard GA4 reports and visible only in DebugView
- layer — container
- reversibility — non-destructive
What fires this
The rule calls getGA4Tags() to collect all active GA4 Configuration and Event tags in the container. For each tag it merges ga4.eventParameters and ga4.configSettings into a single parameter list, then checks whether any entry has name === 'debug_mode' and value === 'true'. The check is a strict string match against the literal value "true" — a GTM variable reference does not trigger it. All matching tags are returned as a single issue, listed by tag ID and name. Paused tags are excluded by getGA4Tags().
Why it matters
When debug_mode is true, GA4 routes events through DebugView instead of standard reporting. Those events do not appear in Explorations, standard reports, or conversions. Any tag left in this state in production silently drops data from your analytics. The parameter persists across every page where the tag fires. The fix is environmental: a GTM Lookup Table variable can return "true" only in preview mode and omit the parameter entirely in production.
Before / after
{
"parameter": [
{ "type": "boolean", "key": "debug_mode", "value": "true" }
]
}
{
"parameter": [
{ "type": "template", "key": "debug_mode", "value": "{{Debug Mode Variable}}" }
]
}
Remediation
- Open GTM and navigate to each flagged GA4 tag.
- Locate the
debug_modeparameter in event parameters or configuration settings. - If debug mode was left over from testing, delete the parameter entirely.
- If debug mode is needed for non-production environments, create a Lookup Table variable: map GTM's built-in
{{Debug Mode}}valuetrueto the string"true", and set the default value to blank (omits the parameter in production). - Replace the hardcoded
"true"with the new variable. - Preview the container to confirm DebugView activates in preview and standard reports receive events in production.
- Publish the container.
Metadata
- Severity
- high
- Tier
- optimization
- Category
- ga4
- Layer
- container
- Version
- 1
- Effort
15min(about 15 minutes)- Reversibility
- non-destructive
See also
- GA4 rules — other rules in this category
- Health score — how this rule contributes to the score
- Rules catalog — browse all rules
Examples
curl https://developer.tagmanifest.com/v1/evaluate-rule \
-H "Authorization: Bearer $TM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"rule_id":"ga4-debug-mode-hardcoded","url":"https://example.com"}'
User: Run ga4-debug-mode-hardcoded on https://example.com
# Tool call
{
"tool": "evaluate_rule",
"arguments": {
"rule_id": "ga4-debug-mode-hardcoded",
"url": "https://example.com"
}
}