Google Tag Manager, shortened to GTM, is a free tool from Google where you gather all the tracking codes for your website in one place. You install a code snippet on the site once. After that you add, change and remove tags for Google Analytics, Google Ads, Meta and other tools in the Tag Manager interface, without a developer having to change the code each time.
This guide covers how Tag Manager is structured, how to install it and how to set up the tracking most businesses need: Google Analytics 4, forms and clicks on phone numbers.
What Tag Manager solves
A tag is a piece of code that sends data to another tool, for example when someone visits a page or submits a form. Without Tag Manager, each tag goes directly into the website's code. Every new ad platform or change to the tracking then becomes a development task, and after a few years nobody really knows which codes are still there.
With Tag Manager the tags live in a container you control from a web interface. You see all tags in one list, can test changes before they go live and can go back to an earlier version if something stops working.
Containers, tags, triggers and variables
Tag Manager is built on four concepts.
Containers
A container holds all the tags for a website or app. You create it under an account, usually one account per business and one container per website. Each container has an ID starting with GTM-.
Tags
Tags are what actually runs: the Google tag for Analytics, a conversion tag for Google Ads, Meta's pixel and so on. Tag Manager has ready-made templates for Google's own tools and for many others. For anything without a template there is Custom HTML.
Triggers
A trigger decides when a tag should run. It can be when a page loads, when someone clicks a particular element, when a form is submitted or when the visitor has scrolled a certain distance. Every tag needs at least one trigger.
Variables
Variables are values that tags and triggers can read, for example the page URL, the text of a clicked link or a form's ID. Tag Manager has built-in variables that you switch on under Variables, and you can create your own. The click variables are switched off by default, so turn them on before you build click triggers.
Install the container code
Once you have created the container you get two code snippets:
- A script that should go as high as possible in the head section of every page.
- A noscript snippet that should go immediately after the opening body tag.
Many publishing tools have a field or plugin where you just enter your GTM ID. If the site is built in Next.js, there is ready-made component support for Tag Manager in Next.js's own package for third-party scripts.
Install only one thing at a time. If GA4 is already installed directly in the code and you add the same GA4 tag in Tag Manager, every pageview is counted twice. Remove the old code once the new one is in place.
Setting up GA4 in Tag Manager
You need the measurement ID from your GA4 property. It starts with G- and is found under the data stream in Google Analytics. How to create the property is covered in our guide to Google Analytics 4.
- Create a new tag and choose Google tag as the tag type.
- Enter your measurement ID as the tag ID.
- Choose the trigger that runs on all pages, preferably the Initialization trigger so the tag loads before other tags.
- Save.
That is enough for GA4 to start receiving pageviews and the events that enhanced measurement collects automatically. For your own events, such as forms and phone clicks, you use the GA4 Event tag type and enter an event name.
Tracking form submissions
For most service businesses, a submitted contact form is the most important event to measure. There are three common methods.
The Form Submission trigger
Tag Manager has a built-in trigger that reacts when a form is submitted. It works well on classic forms that reload the page. Many modern forms, including those in React and Next.js, are submitted without the page reloading, and then they are often not registered.
Thank-you page
If the visitor is sent to a dedicated thank-you page after the form, you can use a pageview trigger that only runs when the URL contains, for example, /thank-you. It is simple and reliable, as long as nobody can land on the thank-you page some other way.
Event in the data layer
The most reliable method is for the website's code to send an event to the data layer (dataLayer) when the form has actually been sent. In Tag Manager you create a Custom Event trigger with the same name and connect it to a GA4 event tag. It requires a small code change, but only counts forms that were really submitted.
Want help with this? Get in touch →
Tracking clicks on phone numbers and buttons
Phone numbers on a website are linked with tel: before the number. That makes them easy to track.
- Turn on the built-in variable Click URL.
- Create a trigger of the Just Links click type and choose for it to run only on some clicks.
- Set the condition that Click URL starts with tel:.
- Create a GA4 event tag, for example named phone_click, and connect it to the trigger.
The same method works for email links (mailto:) and for buttons. For buttons that are not links, use the All Elements trigger and a condition on the button's ID, class or text. Ideally ask whoever built the site to give important buttons their own ID, so the tracking does not stop working when the text changes.
Once the event shows up in GA4, mark it as a key event there. You can then import it into Google Ads as a conversion, which is the basis for working out what Google Ads costs per enquiry.
Preview and debug
Never publish without testing. Click Preview in Tag Manager. This opens Tag Assistant, and your site loads in a debug mode in a new tab.
In Tag Assistant you see every event that happens on the page, which tags fired and which did not. Click a tag that did not fire to see which condition in the trigger was not met. Test each new tag by doing what the visitor does: submit the form, click the phone number.
Then check in GA4's Realtime report or in DebugView that the events are coming through.
Publishing versions
Changes in Tag Manager do not affect the site until you click Submit and publish. Each publication creates a version with all the tags, triggers and variables as they were at that point.
Give each version a name and a short description of what changed. If something goes wrong after publishing, you can publish an earlier version again and be back where you were.
If several people work in the same container, you can use separate workspaces so nobody publishes someone else's half-finished changes.
The Google tag or Tag Manager?
The names are similar but they are two different things.
- The Google tag (gtag.js) is a code snippet that sends data to Google's own tools, mainly Google Analytics and Google Ads. It is installed directly in the website's code.
- Google Tag Manager is a tool for managing many tags, including those from providers other than Google. The Google tag can be one of the tags in Tag Manager.
If you have a simple site and only want GA4, the Google tag is enough. If you advertise on several platforms, want to measure forms and clicks or expect the tracking to change over time, Tag Manager is easier to maintain.
Performance: every tag costs load time
Tag Manager makes it easy to add tags, and so they pile up. Each tag often loads its own script from an external server. Many tags make the page slower, especially on mobile, and that affects both the experience and Core Web Vitals.
A few habits keep the container in shape:
- Go through the tags regularly and remove anything you no longer use, such as old campaign tags and tools you have cancelled.
- Run tags only on the pages where they are needed, rather than on every page.
- Be careful with Custom HTML. It can contain anything and is the hardest to debug.
- Let the consent tool control which tags may run before the visitor has accepted cookies.
Slow pages lose visitors before they have read anything, which makes speed part of conversion rate optimisation.
Measurement at Solva
We install Tag Manager, set up GA4, form and click tracking, and connect the conversions to Google Ads and Search Console as part of our web and advertising projects. Read more about how we work with advertising and SEO, see our guide to Google Search Console or contact us if you want us to look at your current setup.
Frequently asked questions
What is Google Tag Manager?
Google Tag Manager is a free tool from Google for managing tracking codes, known as tags, on a website. You install a container code once and then add tags for, for example, Google Analytics, Google Ads and Meta in a web interface, without changing the website code.
What is the difference between the Google tag and Google Tag Manager?
The Google tag (gtag.js) is a code snippet that sends data to Google’s own tools and is installed directly in the code. Google Tag Manager is a tool for managing many tags from different providers, and the Google tag can be one of them.
Does Google Tag Manager cost anything?
The standard version of Google Tag Manager is free. There is a paid version, Tag Manager 360, which is part of Google’s products for large organisations.
Does Google Tag Manager slow down the site?
The container itself has a small effect on load time, but every tag you add can load its own scripts. Many tags make the page slower. Remove tags you do not use and run tags only on the pages where they are needed.
How do I test that the tags work?
Use Preview mode in Tag Manager, which opens the site together with Tag Assistant. There you see which tags fire on each event and why a tag does not fire. Then check in GA4’s Realtime report that the events are coming through.
Sources
Want help with this?
Tell us where you are today. We reply within 24 hours on weekdays.


