Every marketing tool wants a snippet of code on your website: Google Analytics, Google Ads conversion tracking, the Meta Pixel, LinkedIn Insight, heatmaps, chat widgets. Add them one by one to your theme files and you soon have a fragile mess that only a developer dares touch, and nobody remembers which tag does what.
Google Tag Manager (GTM) solves that. You install one container on your site, then add, edit, test and remove tags from a web interface, with version history and a preview mode so you can check everything before it goes live.
This beginner's guide explains the core concepts, walks you through installation and your first GA4 setup, shows how to track clicks and form submissions, introduces the data layer and consent mode, and lists the mistakes that most often break tracking.
Key Takeaways
- Google Tag Manager is a free tag management system for deploying tracking code without editing your site's code each time.
- Everything in GTM is built from three parts: tags (what to send), triggers (when to send it) and variables (the values used).
- Installation means adding two snippets: one high in the
<head>and one immediately after the opening<body>tag. - Always test in Preview mode with Tag Assistant before publishing, and name every tag, trigger and variable clearly.
- If you have visitors in regions that require consent, set up consent mode so tags respect users' choices.
What is Google Tag Manager?
Google describes Tag Manager as:
“a tag management system that allows you to set up and manage tags on your site without changing your website's code.”
— Google, Introduction to Tag Manager
A “tag” is a snippet of code that sends information to a third party, such as a page view to Google Analytics or a purchase to Google Ads. Tag Manager does not report on anything itself. It is the delivery system. The data is stored and analysed in the tools the tags send to, most often Google Analytics 4.
GTM vs Google Analytics vs the Google tag
| Tool | What it does | Do you need it? |
|---|---|---|
| Google Tag Manager | Deploys and manages tags and their firing rules | Recommended when you use more than one or two marketing tags |
| Google tag (gtag.js) | Google's tag for sending data to GA4 and Google Ads; can be installed directly or through GTM | Yes, if you use GA4 or Google Ads |
| Google Analytics 4 | Collects, processes and reports data | Yes, for website analytics |
Core concepts: account, container, tags, triggers, variables
- Account: the top level, usually one per company.
- Container: one per website or app. It holds all the tags, triggers and variables for that site. Its ID looks like
GTM-XXXXXXX. - Tag: the code that sends data, for example a Google tag for GA4, a GA4 event tag or a Meta Pixel template.
- Trigger: the condition that fires a tag, such as “all page views”, “clicks on links containing /contact” or “form submission”.
- Variable: a value GTM can read and use, such as Page URL, Click Text or a value from the data layer.
- Workspace and versions: changes are made in a workspace and published as a numbered version you can roll back to.
Common trigger types
| Trigger type | Fires when | Typical use |
|---|---|---|
| Page View / Initialization | A page starts loading (or GTM initialises) | Google tag, consent setup, analytics base tags |
| Click – Just Links | A link is clicked | Outbound links, phone (tel:) and email (mailto:) links, file downloads |
| Click – All Elements | Any element is clicked | Buttons that aren't links |
| Form Submission | A form's submit event is detected | Lead forms (test carefully; many forms need a data layer event instead) |
| Scroll Depth | The user scrolls past set percentages | Content engagement |
| Element Visibility | An element appears on screen | “Thank you” messages, key sections viewed |
| Custom Event | A dataLayer.push event is received | Reliable tracking for purchases, sign-ups and app-like sites |
How to install Google Tag Manager: step by step
- Create an account and container. Go to tagmanager.google.com, create an account for your company and a Web container named after your site's domain.
- Copy the two snippets. GTM shows two blocks of code. Google's instructions: paste the first “as high in the
<head>tag as possible” and the second “immediately after the opening<body>tag.” Add them to every page, usually via your theme's header template. - Or use your CMS. Many platforms and plugins let you paste only the container ID. In WordPress, a reputable plugin or Google's Site Kit can add the container for you.
- Check for duplicates. If GA4 or Google Ads tags are already hard-coded, plan to remove them once the GTM versions are live.
- Preview. Click Preview, enter your URL and confirm Tag Assistant connects. You should see the container load.
- Publish. Click Submit, give the version a descriptive name (e.g. “Install container + GA4 base”), and publish.
Set up GA4 through Tag Manager
- In GA4, go to Admin > Data streams, open your web stream and copy the measurement ID (it starts with
G-). - In GTM, create a new tag of type Google tag and paste the ID.
- Set the trigger to Initialization – All Pages (or All Pages).
- Name it clearly, e.g. “GA4 – Google tag – All pages”.
- Preview, browse a few pages, and check that GA4's Realtime or DebugView report shows your visit.
- Submit and publish.
GA4's enhanced measurement already tracks scrolls, outbound clicks, site search, video engagement and file downloads automatically, so check what it covers before building duplicate tags.
Track clicks and form submissions
A common first project is tracking calls and leads. For phone links:
- In Variables, enable the built-in click variables (Click URL, Click Text).
- Create a trigger: Click – Just Links, firing on “Some link clicks” where Click URL starts with
tel:. - Create a tag: Google Analytics: GA4 Event, event name
phone_click, using your measurement ID, with that trigger. - Preview, click a phone link, and confirm the tag fired.
- Publish, then mark the event as a key event in GA4 if it represents a lead.
Forms are trickier. Many modern forms submit with JavaScript, so GTM's Form Submission trigger may not fire. The most reliable method is to ask your developer, or your form plugin, to push an event to the data layer when a form is successfully submitted.
The data layer in 60 seconds
Google defines the data layer as “an object used by Google Tag Manager and gtag.js to pass information to tags.” Your site pushes events and values into it; GTM listens and fires tags. A minimal example:
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'generate_lead',
'form_name': 'contact'
});
</script>
In GTM, create a Custom Event trigger for generate_lead, a Data Layer Variable for form_name, and a GA4 event tag that sends both. If you set page-level data layer values, Google recommends pushing them above the container snippet so they're available when it loads.
Consent mode basics
If you have visitors in the EEA, the UK or other regions with consent requirements, your tags need to respect cookie choices. Google's consent mode “allows web and app developers to adjust tag and app SDK behavior based on user consent choices.” It uses four main consent types: ad_storage, analytics_storage, ad_user_data and ad_personalization.
- Basic consent mode: Google tags don't load until the user interacts with the consent banner.
- Advanced consent mode: Google tags load immediately with default consent states and adjust their behaviour based on the user's choice.
Most consent management platforms offer a GTM template that sets defaults and updates consent automatically. This is a legal as well as technical decision, so involve whoever owns privacy compliance.
Testing and publishing with confidence
Preview mode connects your site to Tag Assistant so you can see which tags fired, in what order, and which variables had which values. Google notes the debug view only appears in the browser that enabled preview (or for users you share the preview link with), so your visitors never see it. Before every publish:
- Test the exact action (click, form, purchase) in preview.
- Check the receiving tool (GA4 DebugView, Google Ads tag diagnostics) shows the data.
- Name the version and describe what changed.
- If something breaks, use Versions to restore the last working version.
Common mistakes
- Double-tagging. GA4 installed in the theme and in GTM doubles page views and inflates sessions.
- Vague names. “Tag 7” and “Click trigger copy” become unmanageable. Use a convention: Tool – Type – Detail.
- Tracking clicks instead of successes. Counting “submit button clicks” records failed submissions too. Track the confirmation.
- Publishing without previewing. A broken trigger can silently stop all conversion tracking.
- Too many third-party tags. Every script costs performance. Audit the container quarterly; our guide to improving page speed explains how to measure the impact.
- UTM tags on internal links. Campaign parameters belong on links from other sites and emails, not between your own pages. See our UTM parameters guide.
- Too many admins. Give publish rights only to people who understand the impact.
Where to go next
Once tags are firing reliably, the value comes from using the data. Learn how to read engagement in GA4 with our guide to engagement rate vs bounce rate, decide how to credit channels with marketing attribution models, and bring everything together in an SEO dashboard. If you also want to measure visits from AI assistants, see how to track AI traffic in GA4.
Related Guides
- UTM Parameters: How to Track Your Campaigns
- How to Build an SEO Dashboard in Looker Studio (Now Data Studio)
- SEO Reporting: What to Include (With Template)
Frequently Asked Questions
Is Google Tag Manager free?
Yes. The standard version of Google Tag Manager is free. A paid enterprise version, Tag Manager 360, is available as part of Google Marketing Platform for large organisations.
Do I still need Google Analytics if I use Tag Manager?
Yes. Tag Manager only deploys tags; it does not store or report data. Google Analytics 4 collects and reports the data that your GA4 tags in Tag Manager send to it.
Will Google Tag Manager slow down my website?
The container itself is loaded asynchronously, but every tag you add can affect performance. Keep the container lean, remove unused tags, and test page speed after adding new third-party scripts.
Can I use Tag Manager and hard-coded tags together?
Yes, but avoid installing the same tag twice, for example a GA4 Google tag hard-coded in the theme and again in Tag Manager, as that can double-count page views and events.
What is the difference between a tag, a trigger and a variable?
A tag is the code that sends data somewhere, a trigger is the rule for when the tag fires, and a variable is a value, such as a page URL or click text, that tags and triggers can use.
Do I need a developer to use Google Tag Manager?
Not for most tasks. Installing the container may need help from your developer or CMS plugin, and complex data layer setups for ecommerce usually need a developer, but page views, clicks, form submissions and many marketing pixels can be configured in the interface.
Conclusion
Google Tag Manager gives you control over your tracking without waiting on code releases for every change. Install the container carefully, start with GA4 and one or two key events, test everything in preview, and grow from there. Accurate tracking is the foundation of better campaigns and better websites. If you'd like help setting up conversion tracking that you can trust, our PPC management and conversion optimisation teams can help, or get a free quote.



