What Is Google Tag Manager? Tags, Triggers, Variables and Setup

What Is Google Tag Manager? Tags, Triggers, Variables and Setup

analyticsOctober 27, 2026
By Antonio Fernandez

TL;DR

  • Google's install guide says the first GTM snippet goes as high in the head as possible and the second immediately after the opening body tag.
  • Standard Tag Manager accounts allow up to 3 concurrent workspaces (the default plus 2 custom); Tag Manager 360 allows unlimited workspaces.
  • Google states one container covers a whole website; container IDs start with GTM-, and GA4 Measurement IDs start with G-.
  • Edits in a workspace reach visitors only after Submit, then Publish and Create Version; Create Version alone saves without publishing.

Google Tag Manager is a free tag management system from Google that lets you add, edit and switch off tracking code on a website, such as GA4, Google Ads conversions or the Meta Pixel, through the Tag Manager web interface instead of editing the site's code every time. You install two GTM code snippets on the site once, and from then on every change is made in a Tag Manager container and published.

A common misunderstanding is that GTM is an analytics tool like GA4. It is not. GTM does not store or report any data itself. Its job is to decide which piece of code runs when, and what data it sends to the destination tool. This guide explains how GTM works, from its core building blocks and how it differs from the Google tag, to installation, sending data to GA4 and Google Ads, and the mistakes that come up most often.

How Google Tag Manager works: tags, triggers and variables

Everything in GTM is built from three components. Once you understand these three terms, you can read anyone's container.

Tags

A tag is code that sends data to another tool: a tag that sends events to GA4, a tag that records a Google Ads conversion, or a custom HTML tag for a third-party tool. GTM has ready-made tag templates for Google products and many popular tools, so you fill in only the values that matter, such as a Measurement ID or Conversion ID, instead of pasting code yourself.

Triggers

A trigger is the condition that says when a tag runs. Google describes triggers as what causes a tag to fire when certain events occur. Common trigger types include Page View, clicks, form submissions, scroll depth, element visibility, timers, YouTube video interactions, and custom events sent from the data layer. Each trigger can be narrowed down, for example to fire only on pages whose URL contains /thank-you/.

Variables

A variable is a value GTM can read while the page runs, used both in trigger conditions and in the values a tag sends. Google says variables simplify and automate tag configuration. GTM has built-in variables such as Page URL, Page Path, Click Text and Click URL, and you can create user-defined variables such as a Data Layer variable, a Constant, a Lookup Table or a cookie value. A practical example is storing your GA4 Measurement ID in one Constant variable and referencing it from every tag. If the ID ever changes, you edit one place.

The part that connects a website to GTM in a structured way is the data layer, a JavaScript object the website uses to pass data such as order value or product ID for GTM to read. The site sends data into it with dataLayer.push, and GTM reads those values through Data Layer variables and can use the event name as a trigger.

What containers, workspaces and versions are

Google calls the collection of tags, triggers, variables and settings installed on one website or app a container. An organisation usually needs one Tag Manager account, and one website usually needs one web container. Google states that you do not need a container for each page of your website. Container IDs start with "GTM-". Besides web containers, there are containers for iOS and Android apps, AMP, and server-side tagging.

A workspace is a separate copy of edits, so several people can work in the same container without overwriting each other. According to Google's help pages, standard (free) accounts can have up to 3 concurrent workspaces: the default workspace plus two custom ones. Tag Manager 360 allows an unlimited number. When you hit the limit, you need to publish pending changes or delete a workspace before you can create another.

A version is a snapshot of the container at a point in time. When you click Submit in the Workspace tab, you choose between "Publish and Create Version", which pushes the changes to your site straight away, and "Create Version", which saves the changes without publishing them. Every version should have a name and description that say what changed, because if a new version causes a problem you can republish an earlier one, and clear version names are what make that rollback quick.

How GTM differs from the Google tag (gtag.js)

This is where most of the confusion sits. The Google tag (gtag.js) is a single piece of code placed directly on the website to send data to Google products such as GA4 and Google Ads. GTM is a management layer that wraps many tags, including the Google tag itself.

The table below compares the two approaches by how they work:

How GTM differs from the Google tag (gtag.js)
PointGoogle tag (gtag.js)Google Tag Manager
InstallationCode placed directly on the websiteTwo GTM snippets installed once, tags managed in the Tag Manager interface
Tags it can manageMainly Google productsGoogle and third-party tags, including custom HTML
Adding a new eventOften needs extra code on the siteCreate a new tag and trigger in GTM, then publish
Testing and rollbackTest on the live site or the site's own staging environmentBuilt-in Preview mode and version history for rollback

If a site only uses GA4 with basic events, the Google tag on its own is enough. Once there are several tools, many events, or a marketing team that needs to change tracking often without waiting for a developer, GTM is the better fit. The important rule is never to install GA4 both ways on the same page, which is covered under common mistakes below.

How to install Google Tag Manager on a website and on WordPress

The steps from Google's help pages are:

  1. Create an account and container at tagmanager.google.com, name the container after the site's main URL, and choose the Web platform.
  2. In the Workspace tab, click the container ID that starts with "GTM" to open the installation code.
  3. Copy the first block of code and paste it as high in the <head> tag as possible.
  4. Copy the second block (the noscript part containing an iframe) and paste it immediately after the opening <body> tag.
  5. Test the installation, then start building tags.

The code has to be on every page of the site. The safe approach is to put it in the shared header template that every page uses, not to paste it page by page.

For WordPress and other content management systems or website builders, Google says you can use an integration instead of editing the code on each page, naming WordPress, Shopify and Wix as examples. On WordPress there are two main routes. The first is to place the code in the theme's header file, ideally through a child theme so the code is not lost when the theme updates. The second is a plugin that supports GTM, such as Site Kit by Google, Google's own plugin. Whichever route you take, check that the theme or another plugin is not already inserting GTM or GA4 code.

Using GTM to send data to GA4 and Google Ads conversions

GA4

For GA4, create a tag of type Google tag, enter the GA4 Measurement ID (it starts with "G-"), and set it to fire on the Initialization - All Pages trigger. This tag sends page_view and turns on enhanced measurement as configured in GA4. For other events, such as form submissions or clicks on a call button, use a Google Analytics: GA4 Event tag, enter the event name and parameters, and attach the trigger that matches that action.

For Google Ads, create a Google Ads Conversion Tracking tag, enter the Conversion ID and Conversion Label from the conversion action in your Google Ads account, and attach the trigger for the action that counts as a conversion, such as reaching the thank-you page after a form. You should also have a Conversion Linker tag firing on all pages. It stores ad click information in first-party cookies on your domain so conversions can be matched back to clicks. If you use Google Ads remarketing, a Google Ads Remarketing tag can sit in the same container.

For online stores, order value and transaction ID should come from the data layer, not from reading text on the page. Page text can change with any redesign, while the data layer is an explicit contract between the website and GTM.

How Preview mode and Tag Assistant check your tags

Before every publish, click Preview at the top right of GTM. This opens Google Tag Assistant in a new tab. Enter your site URL and click Connect, and the site opens in a window linked to debug mode. Every action you take on the page, such as loading a page, clicking or submitting a form, appears as an event in Tag Assistant, and each event shows which tags fired, which did not, and what values the variables held at that moment.

What to check in Preview:

  • A conversion tag fires once per action, and not again when the page is refreshed.
  • Tags do not fire on pages where they should not, for example a conversion tag on the home page.
  • Variables being sent, such as order value, hold real values rather than undefined.

Changes in a workspace do not affect real visitors until you publish, so Preview is a safe place to experiment. When testing is done, click Submit, choose Publish and Create Version, add a name and description, and click Publish.

Common mistakes when setting up GTM

  • GA4 installed twice. A Google tag hard-coded in the theme plus a Google tag in GTM means page views and events are counted twice. Pick one route.
  • Forgetting to publish. Everything works in Preview but no data reaches reports, because the changes are still sitting in the workspace.
  • Triggers that are too broad. A conversion tag tied to All Pages or every click inflates conversion numbers and trains Google Ads bidding on bad data.
  • Code in the wrong place. Putting the first snippet at the bottom of the page instead of in the <head> makes tags load late and can miss visitors who leave quickly.
  • No Conversion Linker tag. Fewer Google Ads conversions get matched back to clicks than should be.
  • Unnamed versions. When something breaks, nobody can tell which version changed what.
  • Permissions that are too wide. Everyone can publish, when publish rights should be limited to a few people.

What this means for businesses in Thailand

Many Thai websites rely on contact channels that are not forms, such as a LINE button, a call button or a Messenger chat button. These actions do not produce a thank-you page, so they are measured with click triggers in GTM instead, for example a trigger that fires when the Click URL contains line.me or starts with tel:, which can then be sent as a GA4 event and a Google Ads conversion. The limit to keep in mind is that GTM only measures the button click. It cannot tell whether the chat or call ended in a sale. The other point is Thailand's Personal Data Protection Act (PDPA). If the site uses a cookie consent banner, marketing tags should be set to respect the consent state, which GTM supports through its consent settings and Google's Consent Mode. For the legal detail, consult the business's own legal adviser.

Google Tag Manager FAQ

Is Google Tag Manager free?

Yes, the standard version of Tag Manager costs nothing. Tag Manager 360 is a paid version for organisations that need extra features, such as unlimited workspaces.

Do I still need GA4 if I have GTM?

Yes, because GTM does not store or report data itself. GTM sends data to GA4 or other tools, and the reports and analysis live in GA4.

Where on the website does the GTM code go?

The first snippet goes as high in the <head> as possible and the second goes immediately after the opening <body> tag, following Google's instructions, and both must be on every page of the site.

I made changes in GTM, so why has the website not changed?

Because the changes have not been published yet. Edits in a workspace only reach real visitors after you click Submit and choose Publish and Create Version.

How many containers does one website need?

One container per website is usually enough. Google states that you do not need a separate container for each page.

Set up tracking correctly from the start

GTM makes website tracking far more flexible, but the data is only as good as the tags and triggers behind it. If you would like help structuring GTM and GA4 events correctly, see our GA4 setup and migration service. If the goal is accurate ad conversion measurement, see our Google Ads service and remarketing service, and if your site runs on WordPress, our WordPress web design service can place tracking code in the theme correctly.

Antonio Fernandez

Antonio Fernandez

Founder and CEO of Relevant Audience. With over 15 years of experience in digital marketing strategy, he leads teams across southeast Asia in delivering exceptional results for clients through performance-focused digital solutions.

Share to:
Copy link:

Read us often? Add Relevant Audience as a preferred source so our articles surface more in your Google results.