All How-To Guides
Any Website10 min·6 steps

How to Install Google Tag Manager on Your Website (2026 Step-by-Step Guide)

Google Tag Manager (GTM) is the right tool when you'll run more than one tracking tag - GA4, Meta Pixel, LinkedIn Insight, conversion APIs, custom event tracking - because it lets you manage everything from one container without redeploying your website each time you change a tag. Installation on any platform follows the same template: create a container, paste two snippets, add tags, publish.

What you'll need before you start

  • A live website you control
  • Access to edit either the <head> and <body> HTML, or use a CMS-provided integration field
  • A Google account
  • About 10 minutes

How to install Google Tag Manager on Any Website: Step-by-step

  1. 1

    Create a GTM container

    Go to tagmanager.google.com and sign in. Click Create Account. Set account name (your company), country, container name (your site URL), and target platform Web. Accept the Terms of Service. GTM gives you two install snippets - a <script> for the <head> and a <noscript> for immediately after the opening <body> tag. Both contain your GTM-XXXXXXX container ID.

  2. 2

    Paste the head snippet

    Copy the GTM <script> block (the longer one starting with (function(w,d,s,l,i)) and paste it immediately after the opening <head> tag in your site's HTML template. Where this template lives depends on your platform: WordPress (header.php), Shopify (theme.liquid), Squarespace (Code Injection → Header), Wix (Marketing Integrations → Google Tag Manager), Webflow (Site Settings → Integrations), BigCommerce (Script Manager → Header), Ghost (Code Injection → Site Header), Next.js / React (root layout component).

  3. 3

    Paste the noscript fallback

    Copy the GTM <noscript> block and paste it immediately after the opening <body> tag. On platforms that don't expose direct access to the body tag (Squarespace, Wix, Ghost, BigCommerce), the platform's footer-injection field is an acceptable substitute - the <noscript> only fires for users with JavaScript disabled (less than 1% of traffic on most sites) so the placement isn't critical.

  4. 4

    (Optional) Set up a data layer for events

    The dataLayer is the JavaScript object GTM uses to read information about page state, user actions, and ecommerce events. For basic page-view tracking, you don't need to do anything - GTM reads the URL automatically. For ecommerce, form submissions, scroll tracking, and custom events, you'll dataLayer.push() objects from your application code. Most CMS integrations have community-built data-layer templates available on GitHub.

  5. 5

    Add your first tag (typically GA4) and publish

    In tagmanager.google.com, click TagsNew. For GA4: choose Google Analytics: GA4 Configuration, paste your Measurement ID (G-XXXXXXXXXX), set trigger to All Pages, click Save. Click Submit in the top-right to publish the container - tags don't go live until you submit a version.

  6. 6

    Verify with GTM Preview

    Click Preview at the top-right of GTM. Paste your site URL, click Connect. A new browser window opens running your site with the GTM debug overlay - you should see your container loaded and any configured tags listed under "Tags Fired". If yes, you're done.

How to verify your setup is working

GTM's built-in Preview mode is the most thorough verification - it shows every tag, trigger, and data-layer event firing in real time. Outside Preview, the free Google Tag Assistant Chrome extension shows every tag firing on the page along with its container ID. If you've configured GA4 inside GTM, GA4's Realtime report should also show your test session within 30-60 seconds.

Common issues and fixes

GTM Preview says "GTM container not found on this page"

The GTM snippet isn't actually in the rendered page. View source on your live site (Ctrl+U / Cmd+U) and search for GTM-XXXXXXX. If you don't find it, your CMS or template engine isn't deploying the change. Clear all caches (CMS plugin caches, server-side cache, Cloudflare/CDN cache) and re-check.

I'm seeing duplicate page views in GA4

Most often you have GA4 installed both as a standalone tag (e.g., the global site tag pasted manually) AND as a tag inside GTM. Pick one path - either remove the standalone GA4 snippet OR remove the GA4 tag from GTM. Also check whether your platform has a native GA4 integration that's enabled (many CMSes do); if it's on, disable it before adding GA4 to GTM.

Cookie consent banner is blocking my tags

GTM supports Consent Mode v2 - a per-tag setting that gates whether the tag fires before/after the user accepts consent. In each tag's Advanced SettingsConsent Settings, declare which consent types it requires (analytics_storage, ad_storage, etc.). Pair with a Consent Management Platform like Cookiebot, OneTrust, or Klaro that signals consent state to GTM via dataLayer.

Frequently asked questions

Is Google Tag Manager free?

Yes - completely free for any website, regardless of traffic volume. There's a paid 360 tier (six figures annually) relevant only for the largest enterprises. For nearly every site, the free version is more than enough.

Do I need Google Tag Manager if I have Google Analytics?

Not necessarily. If GA4 is the only tag you'll ever run, install GA4 directly and skip GTM. Add GTM the moment you need a second tag (Meta Pixel, LinkedIn Insight, conversion APIs, etc.) - managing them all through one container is much cleaner than wiring each one separately.

Where do I put the Google Tag Manager noscript code?

Immediately after the opening <body> tag in your site's HTML template. On platforms that don't expose direct access to the body tag (some CMS-hosted platforms), the platform's footer-injection field is acceptable - the <noscript> only fires for users with JavaScript disabled, which is less than 1% of traffic on most sites.

What's the difference between Google Analytics and Google Tag Manager?

Different tools for different purposes. Google Analytics 4 is a measurement platform - it collects, stores, and visualizes traffic data. Google Tag Manager is a container - it loads tracking tags (including GA4) on your site and lets you manage which ones fire on which pages without editing your codebase. Most sites use both: GTM as the delivery mechanism, GA4 as the destination.

How long does it take Google Tag Manager to start collecting data?

GTM Preview shows tag firing immediately. Live data in GA4 (if you've configured GA4 in your container) appears in Realtime within 30-60 seconds and in standard reports 24-48 hours later. Other destinations (Meta Pixel, LinkedIn Insight, etc.) follow their own latencies - usually similar.

How do I know if Google Tag Manager is working on my website?

Use GTM's Preview mode (button at the top-right of tagmanager.google.com) - paste your URL, click Connect. The debug overlay shows every tag firing in real time. Outside Preview, the free Google Tag Assistant Chrome extension shows every tag firing on the page along with its container ID.

Once you're set up, MeasureBoard turns the data into action

MeasureBoard connects to your analytics, search, and SEO tooling and generates AI-powered weekly reports, GEO readiness scores, and a dedicated AI analyst that answers questions in plain English. Free to start, connects in 30 seconds.

Get Started Free