I want a professional website!
Websites E-shops Maintenance Portfolio Case Studies Articles
8. 7. 2026

What Is Google Tag Manager and How to Set It Up on Your Website

Laptop screen showing website traffic analytics

If you manage a website or online store, you'll eventually run into Google Tag Manager (GTM). It's a tool that can save you a lot of time — but set up incorrectly, it can just as easily throw your analytics data into chaos. Here's what GTM actually does, how to set it up properly, and how to use it to track something concrete, like a form submission.

What is Google Tag Manager?

Google Tag Manager is a free tool from Google for managing all your tracking and marketing codes ("tags") in one place, without editing your website's code every time. Instead of manually adding Google Analytics, Facebook Pixel, or ad conversion codes to your pages, you add a single GTM container to your site once. Everything else is then managed through GTM's own interface, without touching the site's code and without waiting on a developer every time you want to add a new tracking snippet.

Google Tag Manager vs. Google Analytics: what's the difference?

These two get mixed up often. Google Analytics (now GA4) collects and analyzes traffic data — how many visitors came, where from, what they did on your site. Google Tag Manager doesn't collect or analyze any data itself — it's the delivery mechanism you use to deploy other tools' codes, including Google Analytics. Think of GTM as the wiring box, and GA4 as one of the devices plugged into it. Without GTM, you'd have to manually add and manage the code for GA4 — and every other tool — directly in your website's files.

What kinds of tags can you manage through GTM

Most people start with Google Analytics, but the possibilities go much further. Commonly deployed through GTM:

How to install Google Tag Manager on your website

1. Create an account and container

At tagmanager.google.com, create an account and a container for your website. Google will generate two code snippets for you.

2. Add the code to your site

The first snippet goes in the <head>, as close to the top as possible. The second goes right after the opening <body> tag. If you don't have direct access to your site's code (e.g. on WordPress), a plugin can usually handle this instead.

3. Your first tag: GA4 configuration

Once the container is live, create your first tag — a "Google Analytics: GA4 Configuration" tag — add your measurement ID, and set the trigger to "All Pages" so it fires on every page.

4. Publishing changes

Changes in GTM don't go live immediately. Test them first in Preview mode, then click "Submit" to publish a new container version to your live site.

Triggers and variables: the foundation every tag relies on

Once you've got the basic install down, you'll run into two concepts GTM can't function without. A trigger decides when a tag should fire — on page load, a button click, or a form submission, for example. A variable is a value a tag or trigger works with — the current page URL, the text of a clicked button, or the ID of the submitted form. Combining triggers and variables lets you define precisely when and based on what a piece of tracking should fire, with no coding required.

A practical example: tracking a contact form submission

The scenario I set up most often is measuring how many people actually submit a contact form. Roughly, it works like this:

The result: in Google Analytics and Google Ads, you can see exactly how many form submissions your marketing campaigns actually drove — not just how many people visited the site.

GTM and cookie consent (Consent Mode)

If your site shows a cookie banner (and under GDPR in the EU, it has to), you need to make sure tracking tags don't fire before a visitor gives consent. Google Tag Manager has a built-in tool for this called Consent Mode — tags can be tied to a specific consent category (statistics, marketing) and only fire once that category is accepted. Without proper consent mode setup, a site risks collecting data without valid consent, which is a real GDPR exposure.

The most common setup mistakes

When it's worth hiring a professional

A basic GTM install is manageable with a bit of patience. But once you want to track specific actions — button clicks, form submissions, add-to-cart events — you're into custom triggers and variables, where mistakes are easy to make. If you'd rather be sure your analytics data is actually accurate, get in touch about web maintenance — setting up GTM and conversion tracking is a routine part of what I do.

Back to all articles

Let's shoot your website to the moon!

💌 choose your preferred way to get in touch and let's create something beautiful together!

Social media

Billing details

Lubomír Hrdlička Uherčice 14, 691 62 Uherčice IČO: 17087589 Registered in the trade register