Tag setup dependency chain
Tags depend on setup tags to fire first, creating fragile firing sequences that break if timing changes.
Summary
- rule_id —
tag-setup-chain - purpose — Detect tags that depend on setup tags to fire, including multi-level chains
- effect — Silent tag failures when a setup tag is slow or errors; difficult to debug firing sequences
- layer — container
- reversibility — non-destructive
What fires this
The rule inspects all active (non-paused) tags for a non-empty 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 setupTag entries — these multi-level chains receive additional detail in the issue output. A tag's stopOnSetupFailure flag is recorded per dependency but does not suppress the finding.
Why it matters
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.
Before / after
Tag "GA4 — Purchase" has setup tag "Init — GA4 Config". "Init — GA4 Config" itself has setup tag "Load — Consent State". A three-tag chain: any failure at any level silently drops the purchase event.
"GA4 — Purchase" uses tag sequencing: fires after "Init — GA4 Config" completes, with "Stop tag if setup tag fails" enabled. "Init — GA4 Config" is standalone — shared state is loaded via a custom JavaScript variable, not a setup tag.
Remediation
- Open the GTM container and identify all tags listed in the issue output.
- For each flagged tag, review what the setup tag actually does (initialization, consent check, data load).
- If the setup tag loads shared state, move that logic into a custom JavaScript variable instead.
- If ordering is required, replace the setup tag relationship with GTM tag sequencing and enable "Stop tag if setup tag fails."
- For multi-level chains, flatten the sequence — no tag should depend on a setup tag that itself has a setup tag.
- Publish and verify firing in Tag Assistant before deploying to production.
Metadata
- Severity
- medium
- Tier
- optimization
- Category
- quality
- Layer
- container
- Version
- 1
- Effort
2hr(about 2 hours)- Reversibility
- non-destructive
See also
- Quality rules — other rules in this category
- Health score — how this rule contributes to the score
- Rules catalog — browse all rules
Examples
curl https://developer.tagmanifest.com/v1/evaluate-rule \
-H "Authorization: Bearer $TM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"rule_id":"tag-setup-chain","url":"https://example.com"}'
User: Run tag-setup-chain on https://example.com
# Tool call
{
"tool": "evaluate_rule",
"arguments": {
"rule_id": "tag-setup-chain",
"url": "https://example.com"
}
}