top of page

How to Add Google Tag Manager to Your Website (The Right Way)

  • Marketingchimp
  • Jul 9
  • 3 min read

Updated: 3 days ago



If you want to track website performance, fire conversion events, or simplify tag management, Google Tag Manager (GTM) is your best friend. It lets you manage all your tracking codes — Google Ads, GA4, Facebook Pixel, and more — from one place, without constantly editing your website code.


In this guide, we’ll show you exactly how to add Google Tag Manager to your website, step by step. Whether you're on WordPress, Wix, Shopify, or running a custom HTML site, we’ve got you covered.


What Is Google Tag Manager?


Google Tag Manager is a free tool by Google that allows you to install and manage tracking tags (scripts or code) from a user-friendly dashboard.


It’s perfect for marketers, developers, and agencies who need to:


  • Add tracking codes without needing a developer every time

  • Fire events based on clicks, scrolls, form submissions, or page views

  • Keep all tracking scripts tidy and organised


Benefits of Using GTM


  • No more messing with hard-coded tags

  • Add or update tags anytime — without developer help

  • Improve site speed by loading tags efficiently

  • Track advanced actions (button clicks, downloads, outbound links)

  • Quickly deploy GA4, Google Ads conversions, remarketing, Meta Pixel, etc.


tep-by-Step: How to Add Google Tag Manager to Your Website


Step 1: Create Your GTM Account


  1. Go to https://tagmanager.google.com

  2. Click “Create Account”

  3. Add:

    • Account Name (usually your business name)

    • Country

    • Container Name (e.g. yourdomain.com)

    • Select Web as your target platform

  4. Click Create

  5. Accept the terms


You’ll now see two code snippets — one for the <head>, one for the <body>.


Step 2: Add the GTM Code to Your Website


If You Use WordPress:


Option A: Manually Add to Theme Files


  • Copy both GTM code snippets

  • Paste the <head> code in header.php just before the </head> tag

  • Paste the <body> code in header.php right after the <body> tag

  • Save and publish


Option B: Use a PluginInstall a plugin like “Insert Headers and Footers” or “DuracellTomi’s GTM for WordPress”, then:


  • Paste GTM ID (e.g. GTM-XXXXXX) in the relevant field

  • Save and you're done


If You Use Wix:


  • Go to Settings → Custom Code

  • Paste the <head> code under “Header”

  • Paste the <body> code under “Body - Start”

  • Choose to apply to all pages

  • Save and publish


If You Use Shopify:


  • From your admin panel, go to Online Store → Themes → Actions → Edit Code

  • Open theme.liquid

  • Paste the <head> snippet before </head>

  • Paste the <body> snippet immediately after <body>

  • Save changes


For Custom Sites:


  • Paste the <head> code in your site’s HTML <head> tag

  • Paste the <body> code in the first line after the <body> tag


Step 3: Publish Your Container


  1. Go back to GTM dashboard

  2. Click “Submit”

  3. Add a version name (e.g. “Initial Setup”)

  4. Click Publish


Congrats — Google Tag Manager is now live on your website.


How to Check If It’s Working


Use the Google Tag Assistant Chrome extension or:


  1. Open GTM → Click “Preview”

  2. Enter your website URL

  3. GTM will open your site in debug mode

  4. If it loads successfully, GTM is firing correctly


You can also open your site, right-click → View Page Source, and search for “GTM-” to check if the code is present.


Pro Tips for GTM Setup


  • Add GA4 through GTM instead of hardcoding it — keeps things flexible

  • Use Triggers (e.g. page views, clicks, form submissions) to fire tags

  • Name your tags clearly (e.g. “GA4 - Page View”, “Google Ads - Contact Form Submission”)

  • Use Workspaces to test changes before publishing

  • Enable built-in variables like click text, form ID, page path for better tracking


Common Mistakes to Avoid


  • Forgetting to publish your container

  • Adding GTM code in the wrong place (e.g. below </head>)

  • Not removing hardcoded tags — causing duplicates

  • Relying on only 1 tag type (e.g. GA4) without testing others

  • Not testing in Preview mode before going live


Final Thoughts


Adding Google Tag Manager to your website is one of the smartest steps you can take for better tracking, faster deployment, and cleaner code.

Whether you're running a local campaign or managing a multi-site eCommerce setup, GTM gives you the control and flexibility to scale without technical headaches.

Comments


bottom of page