Tag sequencing is a Google Tag Manager setting that makes one tag fire immediately before or after another. You use it when a tag depends on something else having run first, for example a script that must load a library before the main tag can use it.
How tag sequencing works
In the advanced settings of any tag in Google Tag Manager, you can choose a setup tag, a cleanup tag, or both:
- Setup tag Fires just before the main tag. You can tell GTM not to fire the main tag if the setup tag fails.
- Cleanup tag Fires just after the main tag. You can tell GTM not to fire it if the main tag fails or is paused.
The main tag’s trigger controls the whole sequence. The setup and cleanup tags do not need triggers of their own; they ride along with the main one.
Success and failure are where it gets technical. GTM’s built-in tag templates report success or failure themselves. A Custom HTML tag reports success as soon as its code is added to the page, unless you write it to signal completion explicitly. If your setup script loads a library asynchronously, GTM may think it has finished before the library is ready, and the main tag still fires too early. Developers handle this by calling GTM’s success and failure callbacks, using the HTML ID built-in variable, once the work is actually done.
Tag sequencing is different from tag firing priority. Priority is a number that sets the order in which tags on the same trigger start, but GTM does not wait for one to finish before starting the next.
Why it matters
Most tracking setups never need sequencing. Where it does help is with dependencies you cannot avoid: a third-party tool that needs a configuration call before it records anything, or a clean-up step that resets a value after a conversion so it does not leak into the next event. Getting the order wrong in those cases produces intermittent errors, which are the hardest kind to diagnose because the tag works on fast connections and fails on slow ones.
It is also worth recognising sequencing when you inherit a container. If a tag will not fire and its own trigger looks fine, check whether another tag names it as a setup or cleanup tag, or whether it is blocked because its setup tag failed. That relationship is only visible in the advanced settings, so it is easy to miss.
Common mistakes
- Using sequencing for consent. Consent belongs in GTM’s consent settings and consent initialisation trigger, not in a setup tag that tries to check the banner.
- Assuming Custom HTML waits for async code. It does not, unless you signal success yourself.
- Confusing priority with sequencing. A higher priority starts a tag earlier but does not guarantee it has finished.
- Long chains. Sequencing several tags in a row makes the container fragile and hard for the next person to follow.
How to act on it
Before reaching for sequencing, ask whether the dependency can be handled another way. Often the cleaner option is for the site to push a custom event to the data layer once something is ready, and to fire the dependent tag on that event. If you do sequence tags, test in preview mode on a throttled connection, confirm the order in Tag Assistant, and add a note in the tag explaining why.
Untangling fragile containers is a regular part of the tracking work in my performance marketing service.
