Google Tag Manager (GTM) is a free tag management system (TMS) provided by Google that allows you to configure and deploy tracking snippets (known as "tags") on a website or mobile app from a single, centralized web-based user interface.

Comparison of hardcoding versus using a Tag Management System, highlighting GTM's 94 percent market share.

Implementing Google Tag Manager (GTM) involves a hierarchical setup of accounts and containers followed by the physical installation of code snippets on your digital property.

1. Account and Container Setup
The first step is to establish the structural hierarchy within the GTM interface:
  • Create an Account: Go to tagmanager.google.com, sign in, and select Create Account. An account typically represents an entire company or organization.
  • Configure a Container: Within the account, create a container for each website or mobile app.
    • Container Name: Use the top-level URL (e.g., www.example.com)
    • Target Platform: Select the appropriate environment, such as Web (most common), iOS, Android, AMP, or Server
  • Accept Terms: Agree to the Terms of Service to generate your unique container ID (formatted as GTM-XXXXXXX)
2. Installing the Code Snippets
For web implementations, GTM requires two distinct code blocks to be added to every page of your site. JavaScript Snippet (Header): Copy the first block of code and paste it as high in the <head> tag as possible. Ideally, this should be immediately after the opening <head> tag to ensure the container begins loading early.
 
3. Platform-Specific Methods
he method of adding these snippets varies based on your website's architecture:
  • Manual Code Injection: For custom sites, edit your base HTML templates directly. This is preferred for performance as it avoids plugin overhead

The diagram illustrates the flow of analytics data from the website to Google Analytics. The website moodle.uniag.sk has the Google Tag Manager (GTM) container (GTM-KT5XW6CS) installed, which serves as a central management system for tracking tags. Within this container, a Google tag (G-7V3TYX7PML) is configured to collect user interaction data, such as page views and events, and send it to its configured destination, which is the associated Google Analytics 4 (GA4) property. In this relationship, the GTM container manages when and how tags are triggered, the Google tag handles the transmission of data, and the GA4 property receives, processes, and stores the collected analytics data for reporting and analysis.
 
 
How to create GTM 

To create a Google Tag Manager (GTM) account and container, follow these simple steps:

  1. Open Google Tag Manager and click Create Account.
  2. In the Account Setup section, enter an Account Name (usually your organization or company name), select your Country, and optionally choose whether to share data anonymously with Google.
  3. In the Container Setup section, enter the Container Name, which is typically your website's domain (e.g., www.test.sk).
  4. Select the Target Platform. For a website, choose Web (other options include iOS, Android, AMP, and Server for different platforms).
  5. Click Create to generate the GTM account and container.
  6. Read and accept the Google Tag Manager Terms of Service by clicking Yes.
  7. After the container is created, GTM provides two JavaScript code snippets. Copy these snippets and install them in your website's HTML - One in the <head> section and the other immediately after the opening <body> tag. Once installed, your GTM container is ready for adding and managing tracking tags such as Google Analytics 4.

This picture above provides the two code snippets required to install Google Tag Manager on a website so that marketing and analytics tags (such as Google Analytics 4, Google Ads, or Meta Pixel) can be managed without directly editing the website's code each time.
 
A five-step guide for GTM deployment, from container creation to publishing, with a critical debugging tip.
 
GTM Overview
 
Below on picture you see when you open a container and land on the Workspace - Overview. 
 
Left sidebar - Main section 
The sidebar is your primary navigation between the building blocks of the container.
1. Overview: The dashboard summary you are currently reading about.
2. Tags: The code snippets that do something; e.g. send data to Google Analytics or
Google Ads.
3. Triggers: Rules that decide when a tag fires: page views, clicks, form submissions, scrolls, etc.
4. Variables: Reusable placeholders/values that tags and triggers use, such as Page URL, Click
ID, or a measurement ID.
5. Folders: Organizational grouping to keep tags, triggers and variables tidy.
6. Templates: Reusable tag/variable blueprints, including community-built templates.
 
 
A typical first workload
To connect the pieces, here is the order of steps a beginner usually follows:
1. Open the correct container from the top-bar selector.
2. Go to Variables and enable the built-in variables you need.
3. Create a Tag (e.g. a Google Analytics 4 tag).
4. Attach a Trigger so the tag knows when to fire.
5. Click Preview and test that everything works.
6. Click Submit to publish a new live version.
 
 

Tags, Triggers, Variables 

Tags are executable snippets of JavaScript code provided by analytics, marketing, and support vendors to capture user interactions. 

Purpose: They act as messengers that send data from your website to a third-party system, such as Google Analytics 4, Google Ads, or Meta Pixel.ň

Types: GTM provides pre-built templates for common services (like Google Analytics) or allows you to create Custom HTML tags for unique tracking requirements

Triggers are conditions that monitor the application environment and determine exactly when a tag should execute, or "fire".

Purpose: They ensure that tags only run during specific user interactions or system events, such as page views, button clicks, form submissions, or page scrolls.

Variables are named placeholders for values that change, serving as data inputs for both tags and triggers. 

Purpose: They store information about the website page or user actions that GTM uses to make decisions (in triggers) or pass as data (in tags).

Categories:

  • Built-in Variables: Out-of-the-box placeholders for standard browser context, such as Page URL, Referrer, Click Classes, and Form ID
  • User-Defined Variables: Custom configurations created by the user to fetch data from specific sources like First-Party Cookies, JavaScript variables, or the Data Layer

Example 1 — Track clicks on a specific button

Say you want to know when people click a "Sign up" button.

Variables — enable Click built-ins

  1. Go to Variables → Built-In Variables → Configure.
  2. Tick Click Element, Click Classes, Click ID, and Click Text.

These now automatically capture information about whatever was clicked.

Trigger — the button click

  1. Go to Triggers → New → Click → All Elements (use "Just Links" instead if the button is a real link).
  2. Set it to fire on Some Clicks.
  3. Add a condition, for example:
    Click ID equals signup-btn
    (or Click Text contains Sign up).
  4. Name it Click - Sign Up Button and save.

Tag — send the event to GA4

  1. Go to Tags → New → Google Analytics: GA4 Event.
  2. Set the Configuration/Measurement ID to {{GA4 - Measurement ID}} (reusing the variable from Example 1).
  3. Event Name: sign_up_click.
  4. Optionally add an event parameter, e.g. parameter button_text with value {{Click Text}}.
  5. Under Triggering, attach Click - Sign Up Button.
  6. Save.

Every GTM setup follows the same pattern: a Variable holds a value, a Trigger decides the moment, and a Tag performs the action

Last modified: Thursday, 16 July 2026, 12:55 PM