Search
Clear search
Close search
Google apps
Main menu
true

Tag sequencing

Specify tags to fire immediately before or after a given tag on web containers.

Tag sequencing (also known as "setup and cleanup") enables you to specify tags to fire immediately before and after a given tag. This setting is available in web containers, and may be applied to any tag configuration from Advanced Settings → Tag Sequencing.

NOTE: In this article and in the Tag Manager UI, the setup tag is referred to as "tag A", the main payload tag as "tag B", and the cleanup tag as "tag C".

Setup

A setup tag fires before the main tag. To specify a setup tag, check the box "Fire a setup tag before tag B fires" and then select the tag you wish to use from the menu. Check the "Don't fire Tag B if Tag A fails" checkbox if you wish to have the main payload tag only fire when the setup tag fires successfully.

Developers must use google_tag_manager[{{Container ID}}].dataLayer.set() to change data layer values from the setup tag. You need to use .set() instead of .push() because the .push() won’t get recognized by Google Tag Manager until the following event. Using .set will allow the event to be captured by the current event.

Cleanup

A cleanup tag fires immediately after the primary tag has fired. To specify a cleanup tag, check the "Fire a cleanup tag when tag B is finished" checkbox and select the tag you wish to use from the menu. Check the "Don't fire Tag C if Tag B fails" checkbox if you wish to have the cleanup tag only fire when the main payload tag fires successfully.

Uses

An example use case might be where if you wanted a tag to pull some values dynamically off a page and make them available before another tag fires.  This might be used where you use a setup tag A to populate some values, and then tag B is used to send custom dimensions. The information from tag A is nice to have, but not essential, so the "Don't fire tag B if tag A fails" checkbox will remain unchecked.

Another use case might be to prevent a tag from firing if a tag in the sequence failed to fire. This might be where you don't want to fire a tag with invalid data. In these cases, the "Don't fire tag B if tag A fails" checkbox would be checked.

Was this article helpful?
How can we improve it?