How to Set Up Google Tag Manager (GTM) on Your Website — A Step-by-Step Guide
Prefer watching over reading? You can check out the full tutorial on YouTube in the player below. Or if you’re more of an old-school type who likes a proper walkthrough in text — just scroll down.
- Why Use Google Tag Manager?
- Check If Your Website Already Has GTM or Google Tags
- Remove Old Scripts or Disable Plugins
- Create a New GTM Container
- Install GTM Code in Your Website Header
- Publish Your First Tag — Google Analytics 4
- Verify Tag Installation
- Final Tips and Common Mistakes
1. Why Use Google Tag Manager?
Google Tag Manager (GTM) is a free tool from Google that allows you to manage all your marketing and analytics tags — such as Google Analytics, Meta (Facebook) Pixel, LinkedIn Insight Tag, TikTok Pixel, and others — from one central dashboard.
Instead of adding tracking scripts manually into your website’s HTML every time, you install GTM once and then control everything through its interface.
This means:
- No more back-and-forth with developers for every small change
- Less risk of breaking your website when editing code
- You can test, publish, or roll back tags in just a few clicks
For marketers, it’s a game changer. For developers, it reduces headaches. It’s widely used by agencies and businesses across Australia that need reliable and scalable tracking setups.
2. Check If Your Website Already Has GTM or Google Tags
Before installing GTM, it’s smart to check if your website already has GTM or Google Analytics scripts running — to avoid duplicates.
Here’s how:
- Use browser extensions like Tag Assistant Companion
- Open your site in Chrome, then right-click → View Page Source → search for
gtm.js
,gtag
, oranalytics.js
If you find these scripts, note where they’re coming from — hardcoded, plugin-based, or injected by another service (like Google Site Kit or a theme). Double tracking can cause issues like inflated sessions, events firing twice, and incorrect attribution in your reports.
3. Remove Old Scripts or Disable Plugins
Once you’ve identified any existing tracking codes, you’ll want to remove or disable them before installing GTM.
Depending on your setup:
- If tracking is added directly in your theme files (
header.php
,footer.php
), remove those snippets manually - If a plugin is injecting Google Analytics or GTM (e.g., Site Kit, or Rank Math), either disable the plugin or switch off its tracking options
💡 Pro tip: Never have both GA and GTM doing the same job. Let GTM take control once it’s in place.
4. Create a New GTM Container
To get started:
- Visit tagmanager.google.com
- Create a free Google Tag Manager account
- Give your container a name — usually your website domain (e.g.,
example.com
) - Choose the Web platform (not iOS or Android unless you’re building an app)
You’ll receive two snippets of code:
- One for the
<head>
section of your site - One for just after the opening
<body>
tag
These scripts act as the “bridge” between your website and the GTM dashboard.
5. Install GTM Code in Your Website Header
Now that you’ve got your container code, it’s time to install it.
For most WordPress users, the easiest option is:
- Use a plugin like Insert Headers and Footers or WPCode
- Paste the
<head>
snippet and<body>
snippet in the correct boxes
If you’re on Shopify, Webflow, or using a custom CMS:
- Paste the first snippet just before the closing
</head>
tag - Paste the second snippet immediately after
<body>
⚠️ Be sure to publish your changes and clear the site cache if needed.
6. Publish Your First Tag — Google Analytics 4
Once GTM is connected to your site, you can use it to deploy your first tag — usually Google Analytics 4 (GA4).
Here’s a simple setup:
- Inside GTM, click “Add a new tag”
- Choose “Google Analytics: GA4 Configuration”
- Enter your Measurement ID (from your GA4 property)
- Set the trigger to “All Pages”
- Save → Submit → Publish
Congratulations — you’re now sending GA4 data via GTM!
7. Verify Tag Installation
It’s important to test that your GTM setup works correctly before you rely on the data.
Here’s how:
- Open your website
- Use Google Tag Assistant Legacy Chrome extension — it will show which tags are firing
- Alternatively, click Preview inside GTM → enter your site URL → open your site in debug mode
You should see your container loading and your GA4 tag firing on pageview events.
8. Final Tips and Common Mistakes
- Always test in Preview mode before publishing
- Avoid installing GA4 both directly and through GTM
- Use GTM versions to roll back changes
- Add more tags like Facebook Pixel & LinkedIn Insight later