Google Tag Manager guide: what it is, how to install it and how to set it up
What Google Tag Manager is, how to install it, set up GA4 and Google Ads conversions, and apply Consent Mode v2, step by step.
Albert GómezDigital marketing and web projects
In short
- Google Tag Manager is free and lets you manage your measurement and advertising tags from a single dashboard.
- Everything works with three pieces: tags, triggers and variables, plus the data layer to pass information.
- New installations use a single block of code in the head; the old version with noscript still works.
- If you run ads with traffic from the European Economic Area, you need Consent Mode v2 with ad_user_data and ad_personalization.
- Always test in preview before publishing, and save each version with a clear name.
Google Tag Manager (GTM) is a free Google tool for managing your website’s measurement and advertising code from a single dashboard: Google Analytics, Google Ads conversions or other platforms’ pixels. If you want to measure properly without touching the code every time, I’ll explain how it works today, how to install it and what you need to know about cookie consent.
What is Google Tag Manager and what is it for?
GTM is a tag manager. You install a single piece of code on your website, the container, and from the Tag Manager interface you add, change or remove tags. You have everything in one place, you test before publishing and, if something breaks, you go back to the previous version.
It’s organised into accounts (your company) and containers (one per website or app). There are web, iOS, Android, AMP and server containers. The usual one is web.
What are the basic concepts?
Tags
A tag is a snippet of code that sends data to a tool: the Google tag for Analytics, Google Ads conversion tracking or another platform’s pixel. GTM has templates for many of them, so you usually just fill in fields.
Triggers
A trigger says when a tag fires. It detects something that happens on the page (a visit, a click, a form submission) and, if its conditions are met, fires the tag. You can filter it with a variable, an operator and a value, for example: “Page URL contains /products/”.
Page load triggers fire in this order:
| Trigger | When it fires |
|---|---|
| Consent Initialization | Before everything else; for the banner and default consent |
| Initialization | Right after; for tags that need to load early |
| Page View | As soon as the browser starts loading the page |
| DOM Ready | When the HTML can be read |
| Window Loaded | When everything, images and scripts included, has loaded |
There are also triggers for clicks, scrolling, element visibility, YouTube videos and custom events.
Variables
A variable is a named placeholder that gets filled in when the page loads. The built-in “Page URL” variable, for example, returns the address the user is on. There are built-in variables and user-defined variables. They’re used to filter triggers and to pass values to tags, such as the amount of a purchase.
Data layer
The data layer is a JavaScript object the website uses to pass information to Tag Manager. When something important happens, the website “pushes” it and GTM reads it:
window.dataLayer = window.dataLayer || [];
dataLayer.push({
'event': 'login'
});
Three rules that will save you headaches:
- Declare it before the container code and don’t create it again afterwards: always use
push(). - It’s case-sensitive:
dataLayerworks,datalayerdoesn’t. - Use the same names on every page (
visitorTypeandvisitor_typeare not the same thing).
How do you install Google Tag Manager?
- Go to tagmanager.google.com with your Google account.
- Create an account with your company name and country.
- Create a container of type Web. Google recommends naming it after the website’s main URL.
- In the workspace, click Install Google Tag Manager.
Google gives you a single block of code. Paste it as high up as possible inside the <head>, right after the opening tag, on every page.
What about the <noscript> snippet? The old installation had two parts: the script in the <head> and a <noscript> with an iframe at the start of the <body>. If your website already has it, leave it alone: it still works. New installations no longer ask for it.
If you use WordPress, Shopify or Wix, choose your platform in that same box and follow its integration. Finally, enter your website’s URL and click Test.
A note from this year: in November 2026 Google began unifying the Google tag and Tag Manager, and each Google tag becomes a container. According to Google, everything works the same on the page.
How do I test changes before publishing them?
With preview mode and Tag Assistant:
- Click Preview, at the top right.
- In Tag Assistant, enter your website’s URL and click Connect.
- Browse the website. You’ll see which tags fire, in what order, why and what data they send.
Only you can see it, unless you share the link. When everything looks right, click Submit, name the version and publish. Until you publish, nothing reaches the website.
How do I set up Google Analytics 4?
You need the Google tag ID. You’ll find it in Analytics, under Admin > Data streams, and it usually starts with G-.
- In GTM, create a Google Analytics > Google Analytics tag (or a Google Tag type tag).
- Paste the ID.
- As the trigger, choose Initialization - All Pages.
- Test it in preview and publish.
To measure specific actions, create Google Analytics: GA4 Event tags with an event name (for example, signup_newsletter) and, if you like, parameters. If you use a name from Google’s recommended events, GA4 recognises it as such.
How do I measure Google Ads conversions?
- In Google Ads, create a manual conversion action for the website.
- Under Goals > Summary, open the action and choose Use Google Tag Manager.
- Copy the Conversion ID and the Conversion Label.
- In GTM, create a Google Ads Conversion Tracking tag with those two values and, if you like, the value, the currency and the transaction ID.
- Add the trigger, for example the order confirmation page.
Pass the transaction ID through the data layer: that way you don’t count the same purchase twice. And add the Conversion Linker on every page: it stores the ad click data in cookies on your domain. You don’t need it if you already load a Google tag on all of them; also, since 10 April 2025, Google Ads tags automatically load a Google tag first.
What is Consent Mode v2 and why is it mandatory?
Consent mode tells Google what each user has accepted in your banner, and Google tags adapt accordingly. It isn’t a banner: you need a consent management platform (CMP) or your own banner.
In November 2023 Google added two parameters, and that’s v2:
| Parameter | What it controls |
|---|---|
ad_storage |
Cookies and identifiers for advertising |
analytics_storage |
Cookies for analytics |
ad_user_data (v2) |
Sending user data to Google for advertising |
ad_personalization (v2) |
Personalised advertising and remarketing |
Google enforces its EU user consent policy: to measure and personalise ads for users in the European Economic Area, you have to ask for their consent and send those signals to Google. It’s been required since early March 2024. If you do nothing, your GA4 audiences only include users from outside the EEA. For anyone still on v1, Google copied ad_storage into ad_user_data, but personalisation needs v2.
| Basic mode | Advanced mode | |
|---|---|---|
| Tags | Don’t load until the user responds | Load from the start, with consent denied |
| If they don’t accept | Nothing is sent to Google | Cookieless pings are sent |
| Conversion modelling | General model | Your account’s own model, more detailed |
In Tag Manager:
- Use your CMP’s template from the Community Template Gallery with the Consent Initialization - All Pages trigger.
- Check each tag’s consent settings. Google tags come with built-in checks; for the rest, you can require specific consent.
- Turn on the consent overview in Admin > Container Settings to see which tags are missing.
- In GA4, go to Admin > Consent settings and check that the signals are coming in.
What is server-side tagging?
You create a server container that runs on a server you control. It receives requests from the website, clients turn them into events and the server’s tags send them to each destination, such as Google Analytics. You gain control over what data leaves and where it goes, and nobody else sees it until you send it. Google recommends serving it from your own subdomain, on Google Cloud or in another environment.
For a small website it isn’t essential: start with the web container and make the leap when measurement becomes key to your business.
What best practices should I follow?
- Clear names, such as “GA4 - Event - Newsletter”.
- A single installation per tool. If Analytics is in a plugin and in GTM, you’ll count everything twice.
- Precise triggers. The most common mistake is a trigger that’s too broad or too narrow. Check it in preview.
- Versions with a name and description, so you can roll back in a minute.
- Templates before custom HTML.
- Few publishing permissions and regular clean-ups of tags you no longer use.
Conclusion
Google Tag Manager is still the tidiest way to measure a website. Get a good grasp of tags, triggers, variables and the data layer, install the container once and test everything in preview. And if you run ads with European traffic, Consent Mode v2 isn’t optional: set it up together with your cookie banner from day one.
Frequently asked questions
Is Google Tag Manager free?
Yes. Google Tag Manager is free. There is Tag Manager 360, a paid version designed for large companies, with extra features such as approvals before publishing.
Do I still need the noscript code in the body?
In a new installation, Google gives you a single block of code to paste as high up in the head as possible. If your website already has the old two-part installation (head and noscript in the body), there's no need to change it: it still works.
What's the difference between basic and advanced consent mode?
In basic mode, Google tags don't load until the user responds to the banner, and if they don't accept, nothing is sent. In advanced mode, they load from the start with consent denied and send cookieless pings that Google uses to model conversions.
Does Tag Manager replace the cookie banner?
No. Consent mode only tells Google what the user has chosen. You need a banner or a consent management platform (CMP) to collect that decision.
Do I need server-side tagging?
It isn't essential to get started. It gives you more control over your data and where it's sent, but it means setting up and maintaining a server, so it makes sense once measurement is already important to your business.
Sources
- 1. Crear una cuenta y un contenedor - Ayuda de Google Tag Manager
- Instalar un contenedor web - Ayuda de Google Tag Manager
- Previsualizar y depurar contenedores - Ayuda de Google Tag Manager
- Acerca de los activadores - Ayuda de Google Tag Manager
- Page view triggers - Tag Manager Help
- Acerca de las variables - Ayuda de Google Tag Manager
- The data layer - Google Tag Platform
- Configurar Google Analytics en Tag Manager - Ayuda de Google Tag Manager
- Configurar eventos de Google Analytics en Tag Manager - Ayuda de Google Tag Manager
- Buscar el ID de la etiqueta de Google - Ayuda de Analytics
- Seguimiento de conversiones de Google Ads - Ayuda de Google Tag Manager
- Vinculación de conversiones - Ayuda de Google Tag Manager
- Consent mode overview - Google Tag Platform
- Set up consent mode on websites - Google Tag Platform
- Acerca del modo de consentimiento - Ayuda de Google Ads
- Updates to consent mode for traffic in European Economic Area (EEA) - Google Ads Help
- Mapping ad_storage to ad_user_data - Tag Manager Help
- Configuración del consentimiento - Ayuda de Google Tag Manager
- [GA4] Verify and update consent settings in Google Analytics - Analytics Help
- An introduction to server-side tagging - Google Tag Platform
- Publicación, versiones y aprobaciones - Ayuda de Google Tag Manager
- Release notes - Tag Manager Help
- Google Tag Manager - Google Marketing Platform


