Guide 1 of 4 · GTM setup

Set up Google Tag Manager on your website.

Create a GTM account, install two small code snippets and verify everything works. This takes about 15 minutes and needs no coding knowledge. Everything else in these guides builds on this step.

S Mohammed Safwan, digital marketer in Kerala, explaining how to set up Google Tag Manager
Guide 1 of 4 · Free
~15mTo complete
7Steps in this guide
Free.GTM costs nothing
No codeJust copy and paste
Before you start

What you need.

Three things. You probably have all of them already.

01

A Google account

Any Google account works: a personal Gmail, a Workspace account or any other Google account. If you already use Google Analytics or Google Ads, use the same account so everything stays connected.

02

Access to your website's code

You need to be able to edit the HTML of your website, or have a developer or plugin that can do it. On WordPress, a plugin handles this. On custom-built sites, you edit the HTML files directly.

03

Your website, live on the internet

GTM needs a live website to connect to. You cannot test it on a file saved on your computer. If your site is on a staging/test URL, that works too.

Step by step

From zero to a working GTM container.

Follow these steps in order. Each one takes a minute or two.

  1. Open tagmanager.google.com and sign in

    Go to tagmanager.google.com in your browser and sign in with the Google account you want to manage your tags from.

    • If you use Google Analytics or Google Ads, sign in with the same Google account. This makes connecting them easier later.
    • If your business has a shared Google Workspace account, use that instead of your personal Gmail.
  2. Create an account and a container

    GTM asks you to create an account first. Think of this as a folder for your business.

    • Account name: your business name (e.g. "Sunrise Clinic" or "Al Noor Trading").
    • Country: select your country.

    Below that, GTM asks you to create a container. The container is where your tags will live.

    • Container name: your website URL (e.g. "sunriseclinic.in").
    • Target platform: select Web.

    Click Create.

    One account, one container is enough for most businesses. If you manage marketing for multiple websites, you can create one container per website inside the same account.
  3. Accept the terms of service

    GTM shows a terms of service agreement. Read it, tick the GDPR checkbox if shown, and click Yes.

  4. Copy the two code snippets

    After accepting, GTM shows a dialog titled "Install Google Tag Manager" with two code snippets. These are what connect your website to GTM.

    Each snippet starts with a comment that tells you where it goes:

    • Snippet 1: goes in the <head> of every page, as high as possible.
    • Snippet 2: goes immediately after the opening <body> tag on every page.

    Both snippets contain your container ID, which looks like this:

    GTM-XXXXXXX

    Copy both snippets and keep them somewhere (a note, a document) while you install them.

    Closed the dialog? You can reopen it anytime. Click your container ID (the GTM-XXXXXXX code shown near the top of the GTM dashboard) and the snippets appear again.
  5. Install the code on your website

    This is where the two snippets go in your website's HTML. The diagram below shows the exact positions.

    <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" ...> <!-- GTM Snippet 1 goes HERE --> Snippet 1 <title>Your page title</title> <link rel="stylesheet" href="style.css"> </head> <body> <!-- GTM Snippet 2 goes HERE --> Snippet 2 <header>...</header> <main>...</main> <footer>...</footer> </body> </html>

    For custom-built websites: open every HTML page (or your shared template file) and paste the snippets in the positions shown above. If your site uses a template engine or includes, you only need to edit the template once and every page picks it up.

    For WordPress: install a plugin instead of editing code.

    • Go to Plugins → Add New, search for "GTM4WP" (or "Site Kit by Google").
    • Install and activate the plugin.
    • In the plugin's settings, enter your container ID (the GTM-XXXXXXX code).
    • The plugin adds both snippets to every page automatically.

    For Shopify: go to Online Store → Themes → Edit code. Find the theme.liquid file and paste Snippet 1 in the <head> and Snippet 2 right after <body>. Or use the built-in Google channel in Shopify's settings.

    For Wix: go to Settings → Custom Code and add each snippet in the position it asks for (head or body).

    Both snippets must be on every page. If your website has 10 pages, all 10 need the code. Templates and plugins handle this automatically. If you are adding the code manually, check every page.
  6. Verify the installation with Preview Mode

    Before adding any tags, check that GTM itself is installed correctly.

    • Go back to your GTM dashboard (tagmanager.google.com).
    • Click the Preview button in the top right corner of the page.
    • A new tab opens: Tag Assistant (tagassistant.google.com).
    • Enter your website URL (with https://) and click Connect.
    • Your website opens in a new window with a small "Tag Assistant Connected" banner at the bottom.

    Go back to the Tag Assistant tab. If it shows "Google Tag Manager" with your container ID and says "Tags Fired" or "Container Loaded", your installation is working.

    Seeing "not connected"? Check these common fixes:
    • Make sure you typed the full URL with https://
    • Try in an incognito window — ad blockers and browser extensions can interfere
    • Make sure the GTM code is on the page you are testing, not just on the homepage
    • If you just added the code, clear your browser cache or hard-refresh the page (Ctrl + Shift + R)
  7. Publish the container

    Your container is installed but not yet published. Even though you have no tags yet, publish it now.

    • Click the Submit button in the top right of the GTM dashboard.
    • Give the version a name, like "Initial setup — empty container".
    • Click Publish.

    Publishing creates a saved version of your container. This is like a checkpoint. If you add tags later and something breaks, you can go back to any published version.

    Why publish an empty container? Until you publish, GTM runs in "preview only" mode. Publishing makes the container fully live. It also creates Version 1, your clean starting point before any tags are added.
What you have now

GTM is installed. What next?

Your container is live but empty. It is not tracking anything yet. Now you add tags.

01

Add Google Analytics

The easiest first tag. Connect GA4 to your site through GTM and start seeing page views, scrolls and outbound clicks. Guide 2: Set up GA4 →

02

Track Google Ads conversions

Running Google Ads? Set up conversion tracking so you can see which ads bring enquiries, not just clicks. Guide 3: Google Ads tracking →

03

Install Meta Pixel

Running Facebook or Instagram ads? Add the Meta Pixel through GTM to track visitors from your ads. Guide 4: Meta Pixel →

04

All the guides

Not sure which you need? The hub page tells you which guides match your situation. Back to all GTM guides →

Questions

Common doubts.

Do I need a Google account to use GTM?

Yes. Any Google account works — a personal Gmail, a Google Workspace account or any other Google account. If you already use Google Analytics or Google Ads, sign in with the same account so everything stays connected.

Can I use GTM on WordPress, Shopify or Wix?

Yes. On WordPress, install a plugin like GTM4WP or Google's Site Kit and enter your container ID. On Shopify, go to Online Store → Themes → Edit code and paste the snippets, or use the built-in Google channel. On Wix, go to Settings → Custom Code and paste both snippets. The process varies by platform, but the idea is the same: get the two GTM snippets into the right place on every page.

What if I added the code in the wrong place?

Use GTM's Preview Mode (Tag Assistant) to check. If it says "not connected" or tags do not fire, the code may be in the wrong position. The most common mistake is putting Snippet 1 too low in the <head> tag. Move it as high as possible in the <head>, right after any charset or viewport meta tags.

Can I have more than one container on a website?

You can, but most websites need only one container. Multiple containers are sometimes used by large companies where different teams manage their own tags. If you are setting this up for one business, one container is enough.

I installed GTM but Preview Mode says "not connected". Why?

Make sure you clicked Connect in Tag Assistant and entered the correct website URL (with https://). Some browser extensions, especially ad blockers, can block the connection. Try in an incognito window with extensions disabled. Also check that the GTM code is on the page you are testing.

Need help setting up tracking on your site?

Book a consultation