[{"data":1,"prerenderedAt":289},["ShallowReactive",2],{"rule-ga4-event-name-invalid-chars":3},{"id":4,"title":5,"body":6,"breadcrumb":253,"coderail":260,"dateModified":278,"datePublished":278,"description":279,"extension":280,"meta":281,"navigation":282,"next":278,"path":283,"prev":278,"schemaType":284,"seo":285,"stem":286,"wide":287,"__hash__":288},"docs\u002Frules\u002Fga4-event-name-invalid-chars.md","Event names with invalid characters",{"type":7,"value":8,"toc":244},"minimark",[9,16,54,59,74,78,85,89,115,119,154,158,216,220],[10,11,12],"p",{},[13,14,15],"strong",{},"Summary",[17,18,19,30,36,42,48],"ul",{},[20,21,22,25,26],"li",{},[13,23,24],{},"rule_id"," — ",[27,28,29],"code",{},"ga4-event-name-invalid-chars",[20,31,32,35],{},[13,33,34],{},"purpose"," — Detect GA4 event tags whose static event names contain characters outside the GA4-allowed set",[20,37,38,41],{},[13,39,40],{},"effect"," — GA4 rejects or silently renames events with invalid names, making them unreliable measurement points",[20,43,44,47],{},[13,45,46],{},"layer"," — container",[20,49,50,53],{},[13,51,52],{},"reversibility"," — non-destructive",[55,56,58],"h2",{"id":57},"what-fires-this","What fires this",[10,60,61,62,65,66,69,70,73],{},"The rule calls ",[27,63,64],{},"getGA4EventTags(data)"," to collect all GA4 event tags, then tests each static event name against the allowlist regex ",[27,67,68],{},"^[a-zA-Z][a-zA-Z0-9_]*$",". A tag fires this rule when its name fails that test. Tags whose event name contains ",[27,71,72],{},"{{"," 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.",[55,75,77],{"id":76},"why-it-matters","Why it matters",[10,79,80,81,84],{},"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 ",[27,82,83],{},"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.",[55,86,88],{"id":87},"example","Before \u002F after",[90,91,92,106],"compare",{},[93,94,96],"compare-col",{"label":95},"Before — flagged",[97,98,104],"pre",{"className":99,"code":101,"language":102,"meta":103},[100],"language-text","GA4 Event tag\nEvent name: cta-click\n","text","",[27,105,101],{"__ignoreMap":103},[93,107,109],{"label":108},"After — fixed",[97,110,113],{"className":111,"code":112,"language":102,"meta":103},[100],"GA4 Event tag\nEvent name: cta_click\n",[27,114,112],{"__ignoreMap":103},[55,116,118],{"id":117},"remediation","Remediation",[120,121,122,125,128,145,148,151],"ol",{},[20,123,124],{},"Open each flagged GA4 event tag and note the exact event name.",[20,126,127],{},"Identify which characters are invalid (hyphens, spaces, leading digits, or other non-alphanumeric characters).",[20,129,130,131,133,134,137,138,133,141,144],{},"Rename the event using only letters, numbers, and underscores, starting with a letter (e.g., ",[27,132,83],{}," → ",[27,135,136],{},"cta_click",", ",[27,139,140],{},"Form Submit",[27,142,143],{},"form_submit",").",[20,146,147],{},"Update any Custom Event triggers that reference the old event name to match the corrected name.",[20,149,150],{},"If the event is registered as a conversion in GA4, update the conversion definition to use the new name.",[20,152,153],{},"Publish the container and confirm events arrive with valid names in GA4 DebugView.",[55,155,157],{"id":156},"metadata","Metadata",[159,160,163,164,169,163,173,177,163,180,184,163,187,190,163,193,197,163,200,204,163,210,213],"dl",{"className":161},[162],"spec-list","\n  ",[165,166,168],"dt",{"id":167},"severity","Severity",[170,171,172],"dd",{},"high",[165,174,176],{"id":175},"tier","Tier",[170,178,179],{},"warning",[165,181,183],{"id":182},"category","Category",[170,185,186],{},"ga4",[165,188,189],{"id":46},"Layer",[170,191,192],{},"container",[165,194,196],{"id":195},"version","Version",[170,198,199],{},"1",[165,201,203],{"id":202},"effort","Effort",[170,205,206,209],{},[27,207,208],{},"15min"," (about 15 minutes)",[165,211,212],{"id":52},"Reversibility",[170,214,215],{},"non-destructive",[55,217,219],{"id":218},"see-also","See also",[17,221,222,230,237],{},[20,223,224,229],{},[225,226,228],"a",{"href":227},"\u002Fcategories\u002Fga4\u002F","GA4 rules"," — other rules in this category",[20,231,232,236],{},[225,233,235],{"href":234},"\u002Fhealth-score\u002F","Health score"," — how this rule contributes to the score",[20,238,239,243],{},[225,240,242],{"href":241},"\u002Frules\u002F","Rules catalog"," — browse all rules",{"title":103,"searchDepth":245,"depth":245,"links":246},2,[247,248,249,250,251,252],{"id":57,"depth":245,"text":58},{"id":76,"depth":245,"text":77},{"id":87,"depth":245,"text":88},{"id":117,"depth":245,"text":118},{"id":156,"depth":245,"text":157},{"id":218,"depth":245,"text":219},[254,257,259],{"label":255,"href":256},"API Reference","\u002F",{"label":258,"href":241},"Rules",{"label":29},{"cards":261,"onpage":272},[262],{"title":263,"tabs":264},"Evaluate",[265,269],{"label":266,"language":267,"code":268},"cURL","bash","curl https:\u002F\u002Fdeveloper.tagmanifest.com\u002Fv1\u002Fevaluate-rule \\\n  -H \"Authorization: Bearer $TM_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"rule_id\":\"ga4-event-name-invalid-chars\",\"url\":\"https:\u002F\u002Fexample.com\"}'\n",{"label":270,"language":102,"code":271},"MCP","User: Run ga4-event-name-invalid-chars on https:\u002F\u002Fexample.com\n\n# Tool call\n{\n  \"tool\": \"evaluate_rule\",\n  \"arguments\": {\n    \"rule_id\": \"ga4-event-name-invalid-chars\",\n    \"url\": \"https:\u002F\u002Fexample.com\"\n  }\n}\n",[273,274,275,276,277],{"id":57,"label":58},{"id":76,"label":77},{"id":87,"label":88},{"id":117,"label":118},{"id":156,"label":157},null,"Event names contain spaces, hyphens, or start with a number. GA4 will reject or silently rename these events.","md",{},true,"\u002Frules\u002Fga4-event-name-invalid-chars","TechArticle",{"title":5,"description":279},"rules\u002Fga4-event-name-invalid-chars",false,"Yy7fOKgN25__a0N9Gjkw6JKbSMK9PfM2OQx87FQ7uBg",1796069483741]