Every marketing tool wants you to add its code to your website: Google Analytics, Google Ads, the Meta Pixel, LinkedIn’s Insight Tag, heatmap tools and more. Pasting all of these into your theme gets messy fast, and every change needs a developer.
Google Tag Manager (GTM) solves this. You add one container snippet to your site once, then add, change and test all your tracking tags from a single dashboard. In this guide I’ll explain how GTM works and walk you through a complete beginner setup, including Google Analytics 4.
What is Google Tag Manager?
Google Tag Manager is a free tag management system from Google. It has three building blocks:
| Building block | What it is | Example |
|---|---|---|
| Tag | A piece of code that sends data somewhere | GA4 event, Google Ads conversion, Meta Pixel |
| Trigger | The rule that decides when a tag fires | All pages, a button click, a form submission |
| Variable | A value a tag or trigger uses | Page URL, click text, an order value |
Everything lives inside a container, which you install on your website. Changes are made in a workspace, tested in Preview mode and then published as a new version. If something goes wrong, you can roll back to a previous version.
Do you need Google Tag Manager?
GTM is worth it if you:
- use more than one or two tracking tools
- want to track clicks, form submissions, downloads or scrolls without editing code
- run ads and need conversion tracking
- want to change tracking without waiting for a developer
If you only need basic GA4 page tracking on a simple site, installing the Google tag directly (or through a plugin) is fine too.
Step 1: Create an account and container
- Go to tagmanager.google.com and sign in with your Google account.
- Create an account (usually your company name).
- Create a container named after your website, and choose Web as the platform.
- Accept the terms. GTM shows you the installation code. Your container ID starts with GTM-.
Step 2: Install the container snippet
Google gives you two snippets:
- The first goes as high in the
<head>of every page as possible. - The second (the noscript part) goes immediately after the opening
<body>tag.
On WordPress, you don’t need to edit theme files. Many plugins and some themes have a field for your GTM container ID, or you can use a header-and-footer code plugin. On Shopify and other platforms, check the platform’s integration settings.
Only install GTM once. Installing the same container twice, or adding GA4 both directly and through GTM, causes double counting.
Step 3: Add the Google tag for GA4
- In GA4, go to Admin › Data streams, open your web stream and copy the Measurement ID (it starts with G-). My GA4 tutorial shows how to create a property if you don’t have one.
- In GTM, click Tags › New › Google Tag.
- Paste your Measurement ID as the tag ID.
- Set the trigger to Initialization – All Pages (or All Pages).
- Save the tag.
Step 4: Track a key event
Page views alone don’t tell you much. Let’s track a form submission as a GA4 event:
- Go to Variables › Configure and enable the built-in Form and Click variables.
- Create a trigger: Triggers › New › Form Submission (or a Click trigger on your “Book a call” button). Limit it to the right page or form if needed.
- Create a tag: Tags › New › Google Analytics: GA4 Event.
- Enter your Measurement ID and an event name such as
generate_lead. - Attach your new trigger and save.
Then, in GA4, mark generate_lead as a key event so you can see it as a conversion in reports.
Step 5: Test in Preview mode
Never publish without testing.
- Click Preview in GTM and enter your website URL.
- Your site opens with the Tag Assistant debugger connected.
- Browse the site and submit the form. Check that your tags show as fired on the right events, and not on the wrong ones.
- In GA4, open Admin › DebugView to see the events arrive in real time.
Step 6: Publish
When everything works, click Submit, give the version a clear name and description (for example “GA4 + lead form event”), and Publish. Your changes go live immediately.
Step 7: Add other tags as you need them
The same pattern (tag + trigger, test, publish) works for:
- Google Ads conversion tracking and remarketing
- Meta Pixel and LinkedIn Insight Tag (many have templates in GTM’s Community Template Gallery)
- Scroll depth, file downloads and outbound link clicks
- Ecommerce events such as
add_to_cartandpurchase(usually sent by your store platform through the data layer)
Consent mode and privacy
If you have visitors from regions with strict privacy laws, such as the EEA and UK, you need a consent banner and must respect visitors’ choices. Google’s consent mode lets your tags adjust their behaviour based on consent, using four consent types:
| Consent type | Controls |
|---|---|
ad_storage | Advertising cookies |
analytics_storage | Analytics cookies |
ad_user_data | Sending user data to Google for advertising |
ad_personalization | Personalised advertising |
There are two ways to implement it:
- Basic consent mode: Google tags don’t load until the visitor interacts with the banner and gives consent.
- Advanced consent mode: tags load with consent denied by default and send cookieless pings until consent is given, which allows more detailed modelling.
The easiest approach is to use a consent management platform (CMP) that integrates with GTM and supports consent mode. In India, also keep an eye on the requirements of the Digital Personal Data Protection Act as its rules come into force. I’m not a lawyer, so check what applies to your business.
Best practices
- Use clear naming: for example “GA4 – Event – Lead form” and “Trigger – Form – Contact page”.
- Give only the access people need: use Read or Edit permission rather than Publish for most users.
- Document versions with good names and notes.
- Don’t add random scripts from unknown sources; every tag can affect speed and security.
- Review your container every few months and remove tags you no longer use.
Common mistakes
- Installing GA4 twice (directly and through GTM).
- Publishing without Preview testing.
- Triggers that fire on every click instead of the right button.
- Forgetting to mark events as key events in GA4.
- Ignoring consent requirements.
Frequently asked questions
Is Google Tag Manager free? Yes. There’s also a paid enterprise version (Tag Manager 360) for large organisations.
Does GTM slow down my website? The container itself is light, but every tag you add loads more code. Keep only the tags you need.
Is GTM the same as Google Analytics? No. Google Analytics collects and reports data; GTM is the tool that manages the tracking code that sends data to Analytics and other tools.
Related guides on WebTechHelp
- Google Analytics 4 tutorial
- Google Ads for beginners
- Google Search Console tutorial
- LinkedIn marketing for beginners
- How to increase website traffic
Sources
- Google Tag Manager Help: Get started with Tag Manager
- Google Tag Manager Help: Set up and manage consent
- Google for Developers: Consent mode overview




