How Tag Manager works

The structure of Google Tag Manager

To begin using Tag Manager, you’ll place some JavaScript code called a “container snippet” on each page of your website.

You can then add, delete, or make changes to tags using Tag Manager to publish them to the container snippet, instead of making manual changes to the site code itself. When users visit your website, the container snippet will trigger tags based on firing instructions you’ve set up in Tag Manager, and communicate any data you’ve specified back to other systems such as Analytics.

Let’s take a look at how Tag Manager is structured.

Google Tag Manager administration happens at the account level, which allows you to manage tags for one or more websites. Typically, you’ll only need one Tag Manager account per company or organization. But, if you manage website tracking for several companies, you can connect multiple Tag Manager accounts to a single user’s Google account.

For example, if an agency manages tags on behalf of an advertiser such as The Great Outdoors, The Great Outdoors should create the Tag Manager account and grant the agency access. Multiple users can also manage the same Tag Manager account, and each user can be granted different access permissions by account administrators.

Containers and Triggers

Each Tag Manager account has at least one container. A container includes the tags and “triggers” that determine when those tags should fire or collect data. For example, a container may include a tag that communicates when users have made a purchase with a trigger that instructs the tag not to fire until a thank-you page comes up and a transaction is complete. Typically, you’ll have one container for each website domain, though you can use a single container for cross-domain tracking.

Triggers are made up of variables, operators, and values.

Variables are placeholders for values that you define. There are two kinds of variables: built-in variables and user-defined variables. Built-in variables such as {{page path}} or {{click id}} have already been configured for you in Tag Manager, and you simply have to select them, in order to activate them.

User-defined variables are custom variables that you can create, such as {{purchaseComplete}} , to capture when a transaction has been made. When creating a user-defined variable, you can choose from variable types that can help you collect different kinds of data or create reusable strings that can be used throughout your website.

Operators define the relationship between the variable and the value that must be true in order for a trigger to fire. An operator could be something like “equals,” “contains,” or “doesn’t contain”. For example, if you only wanted a tag to fire when a user completed a transaction, you might set up a tag trigger that fires when the variable {{url}} equals the value of your checkout page “checkout.html”. You can also set up multiple triggers that must all be true before a tag will fire.

Triggers fire tags in response to events, which are any website actions taken by the user.

You can set triggers in response to simple events such as a page loading, or you can set custom event tags that fire in response to specific actions like when a user clicks on a submit button for a form. Each tag must have at least one trigger in order to fire and all triggers are initiated by website events.

Triggers, variables, and events in Tag Manager let you control when tags fire in response to specific user actions. This can help you customize the way that tags work with your website and enable you to collect valuable marketing information.

Was this helpful?

How can we improve it?
true
Choose your own learning path

Check out google.com/analytics/learn, a new resource to help you get the most out of Google Analytics 4. The new website includes videos, articles, and guided flows, and provides links to the Google Analytics Discord, Blog, YouTube channel, and GitHub repository.

Start learning today!

Search
Clear search
Close search
Main menu
8446762006086425183
true
Search Help Center
true
true
true
true
true
69256
false
false