[{"data":1,"prerenderedAt":262},["ShallowReactive",2],{"rule-tag-setup-chain":3},{"id":4,"title":5,"body":6,"breadcrumb":225,"coderail":232,"dateModified":251,"datePublished":251,"description":252,"extension":253,"meta":254,"navigation":255,"next":251,"path":256,"prev":251,"schemaType":257,"seo":258,"stem":259,"wide":260,"__hash__":261},"docs\u002Frules\u002Ftag-setup-chain.md","Tag setup dependency chain",{"type":7,"value":8,"toc":215},"minimark",[9,16,54,59,73,77,80,84,100,104,125,129,187,191],[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",{},"tag-setup-chain",[20,31,32,35],{},[13,33,34],{},"purpose"," — Detect tags that depend on setup tags to fire, including multi-level chains",[20,37,38,41],{},[13,39,40],{},"effect"," — Silent tag failures when a setup tag is slow or errors; difficult to debug firing sequences",[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,68,69,72],{},"The rule inspects all active (non-paused) tags for a non-empty ",[27,63,64],{},"setupTag"," array. Any tag with at least one setup tag dependency is flagged. The rule then checks whether any of those setup tags also have their own ",[27,67,64],{}," entries — these multi-level chains receive additional detail in the issue output. A tag's ",[27,70,71],{},"stopOnSetupFailure"," flag is recorded per dependency but does not suppress the finding.",[55,74,76],{"id":75},"why-it-matters","Why it matters",[10,78,79],{},"Setup tags fire before their dependent tags, but GTM (Google Tag Manager) does not guarantee timing across asynchronous operations. If a setup tag throws an error or loads slowly, the dependent tag fails silently — no console error, no network request, no data. Multi-level chains compound this: a failure at any point in the sequence voids all downstream tags. Debugging requires recreating exact load conditions. GTM's tag sequencing gives the same ordering with explicit failure handling and is the recommended alternative.",[55,81,83],{"id":82},"example","Before \u002F after",[85,86,87,94],"compare",{},[88,89,91],"compare-col",{"label":90},"Before — chained",[10,92,93],{},"Tag \"GA4 — Purchase\" has setup tag \"Init — GA4 Config\".\n\"Init — GA4 Config\" itself has setup tag \"Load — Consent State\".\nA three-tag chain: any failure at any level silently drops the\npurchase event.",[88,95,97],{"label":96},"After — sequenced",[10,98,99],{},"\"GA4 — Purchase\" uses tag sequencing: fires after \"Init — GA4 Config\"\ncompletes, with \"Stop tag if setup tag fails\" enabled.\n\"Init — GA4 Config\" is standalone — shared state is loaded via a\ncustom JavaScript variable, not a setup tag.",[55,101,103],{"id":102},"remediation","Remediation",[105,106,107,110,113,116,119,122],"ol",{},[20,108,109],{},"Open the GTM container and identify all tags listed in the issue output.",[20,111,112],{},"For each flagged tag, review what the setup tag actually does (initialization, consent check, data load).",[20,114,115],{},"If the setup tag loads shared state, move that logic into a custom JavaScript variable instead.",[20,117,118],{},"If ordering is required, replace the setup tag relationship with GTM tag sequencing and enable \"Stop tag if setup tag fails.\"",[20,120,121],{},"For multi-level chains, flatten the sequence — no tag should depend on a setup tag that itself has a setup tag.",[20,123,124],{},"Publish and verify firing in Tag Assistant before deploying to production.",[55,126,128],{"id":127},"metadata","Metadata",[130,131,134,135,140,134,144,148,134,151,155,134,158,161,134,164,168,134,171,175,134,181,184],"dl",{"className":132},[133],"spec-list","\n  ",[136,137,139],"dt",{"id":138},"severity","Severity",[141,142,143],"dd",{},"medium",[136,145,147],{"id":146},"tier","Tier",[141,149,150],{},"optimization",[136,152,154],{"id":153},"category","Category",[141,156,157],{},"quality",[136,159,160],{"id":46},"Layer",[141,162,163],{},"container",[136,165,167],{"id":166},"version","Version",[141,169,170],{},"1",[136,172,174],{"id":173},"effort","Effort",[141,176,177,180],{},[27,178,179],{},"2hr"," (about 2 hours)",[136,182,183],{"id":52},"Reversibility",[141,185,186],{},"non-destructive",[55,188,190],{"id":189},"see-also","See also",[17,192,193,201,208],{},[20,194,195,200],{},[196,197,199],"a",{"href":198},"\u002Fcategories\u002Fquality\u002F","Quality rules"," — other rules in this category",[20,202,203,207],{},[196,204,206],{"href":205},"\u002Fhealth-score\u002F","Health score"," — how this rule contributes to the score",[20,209,210,214],{},[196,211,213],{"href":212},"\u002Frules\u002F","Rules catalog"," — browse all rules",{"title":216,"searchDepth":217,"depth":217,"links":218},"",2,[219,220,221,222,223,224],{"id":57,"depth":217,"text":58},{"id":75,"depth":217,"text":76},{"id":82,"depth":217,"text":83},{"id":102,"depth":217,"text":103},{"id":127,"depth":217,"text":128},{"id":189,"depth":217,"text":190},[226,229,231],{"label":227,"href":228},"API Reference","\u002F",{"label":230,"href":212},"Rules",{"label":29},{"cards":233,"onpage":245},[234],{"title":235,"tabs":236},"Evaluate",[237,241],{"label":238,"language":239,"code":240},"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\":\"tag-setup-chain\",\"url\":\"https:\u002F\u002Fexample.com\"}'\n",{"label":242,"language":243,"code":244},"MCP","text","User: Run tag-setup-chain on https:\u002F\u002Fexample.com\n\n# Tool call\n{\n  \"tool\": \"evaluate_rule\",\n  \"arguments\": {\n    \"rule_id\": \"tag-setup-chain\",\n    \"url\": \"https:\u002F\u002Fexample.com\"\n  }\n}\n",[246,247,248,249,250],{"id":57,"label":58},{"id":75,"label":76},{"id":82,"label":83},{"id":102,"label":103},{"id":127,"label":128},null,"Tags depend on setup tags to fire first, creating fragile firing sequences that break if timing changes.","md",{},true,"\u002Frules\u002Ftag-setup-chain","TechArticle",{"title":5,"description":252},"rules\u002Ftag-setup-chain",false,"dKocFG8IcXoiOBRbDM4CGxYuAr_L61nCbDSlP9C8QzM",1796069484335]