Skip to main content
TagManifest /Docs Dashboard

Event names with invalid characters

Event names contain spaces, hyphens, or start with a number. GA4 will reject or silently rename these events.

On this page 6

Summary

  • rule_id — ga4-event-name-invalid-chars
  • purpose — Detect GA4 event tags whose static event names contain characters outside the GA4-allowed set
  • effect — GA4 rejects or silently renames events with invalid names, making them unreliable measurement points
  • layer — container
  • reversibility — non-destructive

What fires this

The rule calls getGA4EventTags(data) to collect all GA4 event tags, then tests each static event name against the allowlist regex ^[a-zA-Z][a-zA-Z0-9_]*$. A tag fires this rule when its name fails that test. Tags whose event name contains {{ are excluded — GTM variable references cannot be statically evaluated. The allowlist catches the full range of invalid characters: spaces, hyphens, commas, slashes, parentheses, and periods, not only the most common offenders.

Why it matters

GA4 enforces strict naming rules at ingest. An event name must start with a letter and contain only letters, numbers, and underscores. Names that violate these rules are silently dropped or routed to an unassigned bucket — GA4 provides no client-side error when this happens. Hyphens are the most common cause: GTM accepts cta-click without warning, but GA4 treats it as invalid. Because the failure is silent, invalid-name events can go undetected through QA and only surface as gaps in reports.

Before / after

GA4 Event tag
Event name: cta-click
GA4 Event tag
Event name: cta_click

Remediation

  1. Open each flagged GA4 event tag and note the exact event name.
  2. Identify which characters are invalid (hyphens, spaces, leading digits, or other non-alphanumeric characters).
  3. Rename the event using only letters, numbers, and underscores, starting with a letter (e.g., cta-click → cta_click, Form Submit → form_submit).
  4. Update any Custom Event triggers that reference the old event name to match the corrected name.
  5. If the event is registered as a conversion in GA4, update the conversion definition to use the new name.
  6. Publish the container and confirm events arrive with valid names in GA4 DebugView.

Metadata

Severity
high
Tier
warning
Category
ga4
Layer
container
Version
1
Effort
15min (about 15 minutes)
Reversibility
non-destructive

See also

Examples

Evaluate
curl https://developer.tagmanifest.com/v1/evaluate-rule \
  -H "Authorization: Bearer $TM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"rule_id":"ga4-event-name-invalid-chars","url":"https://example.com"}'