[{"data":1,"prerenderedAt":264},["ShallowReactive",2],{"rule-orphaned-variables":3},{"id":4,"title":5,"body":6,"breadcrumb":227,"coderail":234,"dateModified":253,"datePublished":253,"description":254,"extension":255,"meta":256,"navigation":257,"next":253,"path":258,"prev":253,"schemaType":259,"seo":260,"stem":261,"wide":262,"__hash__":263},"docs\u002Frules\u002Forphaned-variables.md","Orphaned variables (not used by any tag or trigger)",{"type":7,"value":8,"toc":217},"minimark",[9,16,54,59,74,78,81,85,105,109,127,131,189,193],[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",{},"orphaned-variables",[20,31,32,35],{},[13,33,34],{},"purpose"," — Detect variables not referenced by any tag or trigger in the container",[20,37,38,41],{},[13,39,40],{},"effect"," — Orphaned variables add noise to the variable list and inflate published container size",[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 filters ",[27,63,64],{},"data.variables"," for entries where both ",[27,67,68],{},"referencedByTags.length === 0"," and ",[27,71,72],{},"referencedByTriggers.length === 0",". A special case applies to public-endpoint scans: if all variables appear unreferenced and the container has more than five variables total, the rule assumes the public scan lacks sufficient data to trace usage. It emits a softer finding recommending a JSON export upload rather than treating every variable as orphaned. For JSON container exports, reference detection is accurate.",[55,75,77],{"id":76},"why-it-matters","Why it matters",[10,79,80],{},"Variables accumulate when tags or trigger conditions are deleted without removing the variables they depended on. Over time, the variable list fills with entries that serve no active purpose. In containers using prefix-based naming conventions, orphaned variables with matching prefixes can mislead reviewers about which platforms or features are currently tracked. Variables also contribute to GTM's published container payload — removing unused ones keeps the container leaner and the variable list legible.",[55,82,84],{"id":83},"example","Before \u002F after",[86,87,88,99],"compare",{},[89,90,92],"compare-col",{"label":91},"Before — orphaned",[10,93,94,95,98],{},"Variable ",[27,96,97],{},"DLV - userId"," exists in the container but no tag references\nit in its fields, and no trigger condition uses it. It was created for\na tag deleted six months ago and never cleaned up.",[89,100,102],{"label":101},"After — pruned",[10,103,104],{},"Variable deleted. Container variable list reflects only variables in\nactive use. If the variable may return, add a description field\ndocumenting the intended purpose before archiving.",[55,106,108],{"id":107},"remediation","Remediation",[110,111,112,115,118,121,124],"ol",{},[20,113,114],{},"Review the orphaned variable list in the finding output.",[20,116,117],{},"For each variable, check for indirect references: Custom JavaScript variables that call it by name, or Additional Consent configurations that reference it as a string.",[20,119,120],{},"Delete variables confirmed to be unused.",[20,122,123],{},"For variables kept for future use, add a description to the variable configuration explaining its intended purpose.",[20,125,126],{},"Publish the updated container.",[55,128,130],{"id":129},"metadata","Metadata",[132,133,136,137,142,136,146,150,136,153,157,136,160,163,136,166,170,136,173,177,136,183,186],"dl",{"className":134},[135],"spec-list","\n  ",[138,139,141],"dt",{"id":140},"severity","Severity",[143,144,145],"dd",{},"medium",[138,147,149],{"id":148},"tier","Tier",[143,151,152],{},"info",[138,154,156],{"id":155},"category","Category",[143,158,159],{},"organization",[138,161,162],{"id":46},"Layer",[143,164,165],{},"container",[138,167,169],{"id":168},"version","Version",[143,171,172],{},"1",[138,174,176],{"id":175},"effort","Effort",[143,178,179,182],{},[27,180,181],{},"15min"," (about 15 minutes)",[138,184,185],{"id":52},"Reversibility",[143,187,188],{},"non-destructive",[55,190,192],{"id":191},"see-also","See also",[17,194,195,203,210],{},[20,196,197,202],{},[198,199,201],"a",{"href":200},"\u002Fcategories\u002Forganization\u002F","Organization rules"," — other rules in this category",[20,204,205,209],{},[198,206,208],{"href":207},"\u002Fhealth-score\u002F","Health score"," — how this rule contributes to the score",[20,211,212,216],{},[198,213,215],{"href":214},"\u002Frules\u002F","Rules catalog"," — browse all rules",{"title":218,"searchDepth":219,"depth":219,"links":220},"",2,[221,222,223,224,225,226],{"id":57,"depth":219,"text":58},{"id":76,"depth":219,"text":77},{"id":83,"depth":219,"text":84},{"id":107,"depth":219,"text":108},{"id":129,"depth":219,"text":130},{"id":191,"depth":219,"text":192},[228,231,233],{"label":229,"href":230},"API Reference","\u002F",{"label":232,"href":214},"Rules",{"label":29},{"cards":235,"onpage":247},[236],{"title":237,"tabs":238},"Evaluate",[239,243],{"label":240,"language":241,"code":242},"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\":\"orphaned-variables\",\"url\":\"https:\u002F\u002Fexample.com\"}'\n",{"label":244,"language":245,"code":246},"MCP","text","User: Run orphaned-variables on https:\u002F\u002Fexample.com\n\n# Tool call\n{\n  \"tool\": \"evaluate_rule\",\n  \"arguments\": {\n    \"rule_id\": \"orphaned-variables\",\n    \"url\": \"https:\u002F\u002Fexample.com\"\n  }\n}\n",[248,249,250,251,252],{"id":57,"label":58},{"id":76,"label":77},{"id":83,"label":84},{"id":107,"label":108},{"id":129,"label":130},null,"Variables not referenced by any tag or trigger. Special public-scan handling: when ALL variables look orphaned from a public scan, emits a different finding suggesting JSON upload.","md",{},true,"\u002Frules\u002Forphaned-variables","TechArticle",{"title":5,"description":254},"rules\u002Forphaned-variables",false,"7W9g4N87aOb-pC2d7-AaE3h_7Dvib_mjfuDvA8LJzKc",1796069484068]