Looking to join a great team — open to 186/482 visa sponsorship in Australia. Learn more

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. 

How to Set Up Google Tag Manager (GTM) on Your Website — A Step-by-Step Guide
▶ Play
  1. Why Use Google Tag Manager?
  2. Check If Your Website Already Has GTM or Google Tags
  3. Remove Old Scripts or Disable Plugins
  4. Create a New GTM Container
  5. Install GTM Code in Your Website Header
  6. Publish Your First Tag — Google Analytics 4
  7. Verify Tag Installation
  8. 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, or analytics.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:

  1. Visit tagmanager.google.com
  2. Create a free Google Tag Manager account
  3. Give your container a name — usually your website domain (e.g., example.com)
  4. 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:

  1. Inside GTM, click “Add a new tag”
  2. Choose “Google Analytics: GA4 Configuration”
  3. Enter your Measurement ID (from your GA4 property)
  4. Set the trigger to “All Pages”
  5. 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

FAQ

What is Google Tag Manager?
Google Tag Manager is a free tool from Google that lets you manage marketing and analytics tags without modifying code every time.
Is Google Tag Manager the same as Google Analytics?
No. GTM is a tag deployment system. GA is an analytics platform. GTM can be used to install GA.
How do I add Google Tag Manager to my website?
You install the GTM container code in the <head> and <body> sections of your HTML.
Can I use GTM for other tools besides Google Analytics?
Yes, GTM supports many third-party tags including Meta Pixel, LinkedIn, TikTok, Hotjar, and custom scripts.
How do I test my Google Tag Manager setup?
Use Tag Assistant Legacy or Preview mode in GTM to see what tags are firing and when.
What happens if I install Google Analytics and GTM together?
This may result in duplicate data tracking. It’s best to choose one method — usually GTM for flexibility.