[{"data":1,"prerenderedAt":329},["ShallowReactive",2],{"rule-variable-high-fanout":3},{"id":4,"title":5,"body":6,"breadcrumb":292,"coderail":299,"dateModified":318,"datePublished":318,"description":319,"extension":320,"meta":321,"navigation":322,"next":318,"path":323,"prev":318,"schemaType":324,"seo":325,"stem":326,"wide":327,"__hash__":328},"docs\u002Frules\u002Fvariable-high-fanout.md","Variable referencing 5+ other variables",{"type":7,"value":8,"toc":282},"minimark",[9,16,54,59,78,82,93,97,156,160,192,196,254,258],[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",{},"variable-high-fanout",[20,31,32,35],{},[13,33,34],{},"purpose"," — Detect variables that depend on 5 or more other variables, creating fragile dependency chains",[20,37,38,41],{},[13,39,40],{},"effect"," — Any single broken dependency silently fails the entire computed value",[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,74,77],{},"The rule JSON-stringifies each variable's ",[27,63,64],{},"parameters"," object and scans it for ",[27,67,68],{},"{{variable_name}}"," references using a global regex. Variables with 5 or more distinct references are flagged. Google Ads Enhanced Conversions (",[27,71,72],{},"awec",") and User Data (",[27,75,76],{},"awud",") variable types are excluded — those types structurally reference 5–7 field macros by platform design, not by accident. All other variable types are in scope.",[55,79,81],{"id":80},"why-it-matters","Why it matters",[10,83,84,85,88,89,92],{},"A variable referencing 5+ others forms a dependency chain with no redundancy. If any referenced variable is deleted, renamed, or returns ",[27,86,87],{},"undefined"," — due to a dataLayer change, trigger timing, or missing page context — the entire computed value fails. The failure is often silent: GTM Preview may show the variable evaluating on some pages but not others. Every tag that consumes the high-fanout variable inherits the same fragility. Splitting the logic or adding ",[27,90,91],{},"??"," fallbacks makes failures isolated and debuggable.",[55,94,96],{"id":95},"example","Before \u002F after",[98,99,100,125],"compare",{},[101,102,104],"compare-col",{"label":103},"Before — flagged",[10,105,106,107,110,111,110,114,110,117,120,121,124],{},"One Custom JavaScript variable reads ",[27,108,109],{},"{{User ID}}",", ",[27,112,113],{},"{{Session ID}}",[27,115,116],{},"{{Page Category}}",[27,118,119],{},"{{Product ID}}",", and ",[27,122,123],{},"{{Experiment Variant}}"," to build a composite event payload. Deleting or renaming any one of those variables breaks the tag silently.",[101,126,128],{"label":127},"After — consolidated",[10,129,130,131,133,134,136,137,133,139,141,142,144,145,148,149,152,153,155],{},"An intermediate variable handles user context (",[27,132,109],{}," + ",[27,135,113],{},"), another handles page context (",[27,138,116],{},[27,140,119],{},"), and the composite variable references those two intermediates plus ",[27,143,123],{},". Each intermediate has ",[27,146,147],{},"?? null"," fallbacks, so a missing value surfaces as ",[27,150,151],{},"null"," rather than cascading to ",[27,154,87],{},".",[55,157,159],{"id":158},"remediation","Remediation",[161,162,163,170,173,176,186,189],"ol",{},[20,164,165,166,169],{},"Open each flagged variable and list every ",[27,167,168],{},"{{reference}}"," it contains.",[20,171,172],{},"Determine whether all references are necessary for the computed output.",[20,174,175],{},"Group logically related references into intermediate Custom JavaScript variables.",[20,177,178,179,181,182,185],{},"Add ",[27,180,91],{}," (nullish coalescing) or ",[27,183,184],{},"|| defaultValue"," guards for each reference that may be absent.",[20,187,188],{},"Verify that dependent tags receive a usable fallback when one input is missing.",[20,190,191],{},"Test on pages where individual dependencies are known not to populate.",[55,193,195],{"id":194},"metadata","Metadata",[197,198,201,202,207,201,211,215,201,218,222,201,225,228,201,231,235,201,238,242,201,248,251],"dl",{"className":199},[200],"spec-list","\n  ",[203,204,206],"dt",{"id":205},"severity","Severity",[208,209,210],"dd",{},"medium",[203,212,214],{"id":213},"tier","Tier",[208,216,217],{},"optimization",[203,219,221],{"id":220},"category","Category",[208,223,224],{},"quality",[203,226,227],{"id":46},"Layer",[208,229,230],{},"container",[203,232,234],{"id":233},"version","Version",[208,236,237],{},"1",[203,239,241],{"id":240},"effort","Effort",[208,243,244,247],{},[27,245,246],{},"strategic"," (no fixed time; needs a plan)",[203,249,250],{"id":52},"Reversibility",[208,252,253],{},"non-destructive",[55,255,257],{"id":256},"see-also","See also",[17,259,260,268,275],{},[20,261,262,267],{},[263,264,266],"a",{"href":265},"\u002Fcategories\u002Fquality\u002F","Quality rules"," — other rules in this category",[20,269,270,274],{},[263,271,273],{"href":272},"\u002Fhealth-score\u002F","Health score"," — how this rule contributes to the score",[20,276,277,281],{},[263,278,280],{"href":279},"\u002Frules\u002F","Rules catalog"," — browse all rules",{"title":283,"searchDepth":284,"depth":284,"links":285},"",2,[286,287,288,289,290,291],{"id":57,"depth":284,"text":58},{"id":80,"depth":284,"text":81},{"id":95,"depth":284,"text":96},{"id":158,"depth":284,"text":159},{"id":194,"depth":284,"text":195},{"id":256,"depth":284,"text":257},[293,296,298],{"label":294,"href":295},"API Reference","\u002F",{"label":297,"href":279},"Rules",{"label":29},{"cards":300,"onpage":312},[301],{"title":302,"tabs":303},"Evaluate",[304,308],{"label":305,"language":306,"code":307},"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\":\"variable-high-fanout\",\"url\":\"https:\u002F\u002Fexample.com\"}'\n",{"label":309,"language":310,"code":311},"MCP","text","User: Run variable-high-fanout on https:\u002F\u002Fexample.com\n\n# Tool call\n{\n  \"tool\": \"evaluate_rule\",\n  \"arguments\": {\n    \"rule_id\": \"variable-high-fanout\",\n    \"url\": \"https:\u002F\u002Fexample.com\"\n  }\n}\n",[313,314,315,316,317],{"id":57,"label":58},{"id":80,"label":81},{"id":95,"label":96},{"id":158,"label":159},{"id":194,"label":195},null,"A variable references 5 or more other variables, creating a single point of failure in the variable chain.","md",{},true,"\u002Frules\u002Fvariable-high-fanout","TechArticle",{"title":5,"description":319},"rules\u002Fvariable-high-fanout",false,"oTyQay0n7NYRuLF10MAn7Cn5lISFMZFWpR-J-Ihm28k",1796069484404]