What is Google Tag Manager?
Google Tag Manager (GTM) is a free tag management system that lets you deploy and manage marketing and analytics tracking codes on your website without modifying your site's source code. Instead of asking a developer to add or edit JavaScript snippets every time you need to track something new, you manage everything through a web-based interface.
The core idea is simple: you install a single container snippet on your site once. After that, every tracking code you need — Google Analytics, Meta Pixel, LinkedIn Insight Tag, custom event scripts — gets added, edited, or removed through the GTM dashboard. No code deployments, no engineering tickets, no waiting.
GTM organizes everything into a container. A container is a bundle of all the tags, triggers, and variables for a particular website or app. When you publish changes in GTM, the updated container loads automatically on your site. You can also version your container, roll back to previous configurations, and use workspaces to let multiple team members work on different changes simultaneously.
For B2B marketing teams especially, GTM is transformative. It removes the bottleneck of relying on engineering resources for every tracking change, letting marketers move faster on campaigns, experiments, and analytics improvements.
How to create a GTM account and container
Setting up GTM takes less than five minutes. Here is the process step by step:
- Go to tagmanager.google.com and sign in with the Google account you want to manage your tags from. If you use Google Workspace, sign in with your company account so ownership stays within your organization.
- Click “Create Account.” Enter your company or account name, and select your country. The account is the top-level organizational unit — think of it like a folder that can hold multiple containers.
- Set up your container. Give it a descriptive name (typically your website domain, like “example.com”). Under “Target platform,” select Web for a standard website. GTM also supports iOS, Android, and AMP, but Web is what you need for most marketing use cases.
- Accept the Terms of Service. Review and agree to Google's terms. Your container is now created and ready for installation.
- Note your Container ID. It looks like
GTM-XXXXXXX. You will need this for the installation step.
After creating the account, GTM will immediately present you with the two installation snippets. Keep this tab open — you will need those snippets in the next step.
Installing GTM on your website
GTM gives you two code snippets that need to be placed on every page of your website. The first goes in the <head> section, and the second goes immediately after the opening <body> tag.
Head snippet (paste as high in the <head> as possible):
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];
w[l].push({'gtm.start':new Date().getTime(),
event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';
j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;
f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');
</script>
<!-- End Google Tag Manager -->Body snippet (paste immediately after the opening <body> tag):
<!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX" height="0" width="0" style="display:none;visibility:hidden"> </iframe></noscript> <!-- End Google Tag Manager (noscript) -->
Replace GTM-XXXXXXX with your actual Container ID in both snippets.
CMS-specific installation
- WordPress: Use the Insert Headers and Footers plugin (by WPCode) or Google's Site Kit plugin. Paste the head snippet into the Header Scripts field and the body snippet into the Body Scripts field.
- Shopify: Go to Online Store > Themes > Edit Code. Open
theme.liquidand paste the snippets in the correct positions within the head and body sections. - Webflow: Go to Project Settings > Custom Code. Paste the head snippet in the “Head Code” field and the body snippet in the “Footer Code” field (Webflow places footer code right after the body tag).
- Next.js / React: Use the
next/scriptcomponent withstrategy="afterInteractive"for the head script and a noscript tag in your root layout. - Custom HTML sites: Manually add both snippets to every page template. If you use a shared header/footer include file, add them there so all pages pick up the container automatically.
Verifying the installation
After installing the snippets, verify they are working correctly:
- Open your GTM workspace and click Preview in the top right corner.
- Enter your website URL. A new tab will open with a debug panel at the bottom of the page.
- If the container is installed correctly, you will see a “Container Found” message and a list of tags that fired on page load.
- You can also check the browser developer tools: open the Network tab, filter by “gtm,” and confirm a request to
googletagmanager.comreturns a 200 status.
Setting up your first GA4 tag in GTM
The most common first tag in any GTM container is the Google Analytics 4 configuration tag. This tag loads the GA4 library on your pages and begins collecting basic data like pageviews, sessions, and user properties.
- Find your GA4 Measurement ID. In Google Analytics, go to Admin > Data Streams > select your web stream. Your Measurement ID looks like
G-XXXXXXXXXX. Copy it. - Create a new tag in GTM. Go to Tags > New. Name it something clear, like “GA4 – Configuration.”
- Choose the tag type. Click Tag Configuration and select Google Tag (this replaces the older GA4 Configuration tag type). Paste your Measurement ID into the Tag ID field.
- Set the trigger. Click Triggering and select All Pages. This ensures GA4 loads on every page of your site.
- Save the tag. Click Save in the top right.
- Test before publishing. Click Preview, enter your site URL, and confirm the GA4 tag fires on the “Container Loaded” event. You should also see real-time data appear in your GA4 property within a few minutes.
- Publish. Once verified, click Submit > Publish. Your GA4 tracking is now live.
Important: If you previously had a GA4 snippet hardcoded on your site, remove it before publishing your GTM-based tag. Running both simultaneously will cause duplicate pageview data in your GA4 reports.
Tracking button clicks and form submissions
Beyond basic pageviews, the most valuable tracking for B2B sites usually involves button clicks (especially CTA buttons) and form submissions (demo requests, contact forms, newsletter signups). GTM makes both straightforward.
Tracking button clicks
- Enable built-in click variables. Go to Variables > Configure. Under “Built-In Variables,” enable Click Element, Click Classes, Click ID, Click Text, and Click URL.
- Create a click trigger. Go to Triggers > New. Choose Click – All Elements (or Click – Just Links if you only want link clicks). Set it to fire on “Some Clicks” and add a condition like Click Classes contains cta-button.
- Create a GA4 event tag. Go to Tags > New. Choose Google Analytics: GA4 Event. Set the Configuration Tag to your GA4 tag. Name the event something descriptive like
cta_click. Add event parameters likebutton_textusing the Click Text variable. - Attach the trigger you created in step 2 and save.
Tracking form submissions
- Enable form variables. Go to Variables > Configure and enable Form Element, Form Classes, Form ID, Form Target, and Form URL.
- Create a form submission trigger. Go to Triggers > New. Choose Form Submission. Set it to fire on “Some Forms” with a condition like Form ID equals contact-form. Check “Wait for Tags” and “Check Validation” to ensure the tag only fires on successful submissions.
- Create a GA4 event tag for the event name
form_submit. Add a parameter likeform_idusing the Form ID variable. - Mark the event as a conversion in GA4 (Admin > Events > toggle the event as a Key Event) so it appears in your conversion reports.
Tip for AJAX forms: Many modern forms submit via JavaScript without a traditional page reload. The built-in Form Submission trigger may not catch these. Instead, use a Custom Event trigger and push an event to the data layer when the form completes: dataLayer.push({'event': 'form_complete'}).
GTM Preview and Debug mode
Never publish GTM changes without testing them first. Preview and Debug mode (also called Tag Assistant) lets you see exactly what happens when your pages load, which tags fire, and why certain triggers did or did not activate.
How to use Preview mode
- In your GTM workspace, click the Preview button in the top right corner.
- Tag Assistant will open in a new tab. Enter your website URL and click Connect.
- Your website opens in another tab with a debug banner at the bottom reading “Tag Assistant Connected.” Navigate your site normally.
- Switch back to the Tag Assistant tab to see a timeline of events (Container Loaded, DOM Ready, Window Loaded, clicks, etc.) and which tags fired or did not fire for each event.
- Click on any tag to see its details: the trigger that fired it, the variables it used, and whether it completed successfully.
What to check
- Tags you expect to fire on page load are listed under “Tags Fired” for the Container Loaded event.
- Click and form triggers fire when you interact with the correct elements.
- Variable values resolve to what you expect (check by clicking on the Variables tab for each event).
- No tags appear under “Tags Not Fired” that should be firing.
- No JavaScript errors appear in the browser console related to your tags.
Only after confirming everything works in Preview mode should you click Submit and Publish. Every published version is saved, and you can roll back to any previous version at any time.
Common GTM mistakes to avoid
Even experienced marketers make these mistakes. Knowing about them upfront will save you hours of debugging and prevent data quality issues.
1. Forgetting to publish after making changes
GTM changes do not go live until you click Submit and Publish. The most common support request from GTM beginners is “my tag is not firing” when the real issue is the container was never published. Get in the habit of checking whether your workspace has unpublished changes (indicated by the blue badge in GTM).
2. Duplicate tags causing double-counted data
If you add GA4 tracking through GTM but forget to remove the hardcoded GA4 snippet from your site, every pageview will be recorded twice. This inflates your traffic numbers and distorts engagement metrics. Always audit for existing tracking code before deploying new tags through GTM.
3. Missing or misconfigured triggers
A tag without a trigger will never fire. A tag with the wrong trigger fires at the wrong time or on the wrong pages. Double-check your trigger conditions, especially URL matching patterns. Use “contains” or “regex” matching thoughtfully, and test with Preview mode before publishing.
4. Container bloat
Over time, GTM containers accumulate tags from old campaigns, deprecated platforms, and experimental tracking that was never cleaned up. A bloated container slows page load, increases the chance of conflicts, and makes the workspace harder to manage. Audit your container quarterly and remove tags that are no longer needed.
5. Not using a naming convention
Without consistent naming, containers with more than a handful of tags become impossible to navigate. Use a convention like [Platform] - [Type] - [Detail] (for example, “GA4 – Event – CTA Click” or “Meta – Pixel – Lead”). Apply the same discipline to triggers and variables.
Automating GTM audits
Manually reviewing a GTM container for missing tags, broken triggers, and unused variables is tedious and error-prone, especially as your tracking setup grows. This is where automated auditing becomes valuable.
ClimbPast connects to your GTM container and runs a comprehensive audit that checks for:
- Missing essential events (form submissions, CTA clicks, scroll tracking) that B2B sites typically need.
- Tags without triggers or with triggers that can never fire based on your site's current URL structure.
- Duplicate tags sending redundant data to the same analytics property.
- Unused variables and triggers adding unnecessary weight to your container.
- GA4 configuration issues like missing Measurement IDs, incorrect event naming, or absent enhanced measurement settings.
- Consent mode gaps where tags may fire before consent is granted in regulated markets.
Instead of spending hours clicking through the GTM interface, you get a prioritized report showing exactly what needs to be fixed, why it matters, and how to fix it. ClimbPast also monitors your container over time, alerting you when new changes introduce issues.
Frequently asked questions
Is Google Tag Manager free to use?
Yes. Google Tag Manager is completely free for standard use. There is an enterprise version called Google Tag Manager 360 that is part of Google Marketing Platform, but the standard version has no usage limits and supports unlimited tags, triggers, and variables.
What is the difference between Google Tag Manager and Google Analytics?
Google Analytics is the tool that collects, processes, and reports on your website data. Google Tag Manager is a container that manages how tracking codes (including Google Analytics) are deployed on your site. GTM does not collect data itself; it helps you install and manage the tags that do.
Can I use Google Tag Manager with WordPress, Shopify, or other CMS platforms?
Yes. GTM works with virtually every CMS. WordPress has dedicated plugins like Site Kit or Insert Headers and Footers that make installation easy. Shopify allows you to paste GTM snippets into theme.liquid. Most modern CMS platforms have a built-in field for GTM container IDs or a head/body script injection area.
Will Google Tag Manager slow down my website?
The GTM container script itself is lightweight and loads asynchronously, so it has minimal impact on page load speed. However, the tags you deploy through GTM can affect performance. Loading too many third-party scripts, firing tags on every page when they only need to run on specific pages, or using synchronous custom HTML tags can slow things down. Keep your container lean and audit it regularly.
How do I know if my GTM tags are firing correctly?
Use GTM Preview and Debug mode (also called Tag Assistant). Click the Preview button in your GTM workspace, enter your site URL, and a debug panel will open alongside your site showing exactly which tags fired, which did not, and what triggered them. You can also use the browser developer console to check for dataLayer pushes and network requests.