About Tracking

Ad Platform Tracking

Meta Pixel + CAPI TikTok CAPI LinkedIn CAPI Snapchat CAPI Pinterest CAPI Quora Pixel Bing + UET Tag

Google Ecosystem

Google Ads Tracking GA4 Setup & Audit Google Tag Manager

Advanced Solutions

Server-Side Tracking Looker Studio Offline Conversion
Case Studies Blog Free Checklist Book Free Audit →

Google Tag Manager lets you add, update, and manage tracking tags on your website without editing code every time. One snippet on your site unlocks the ability to deploy GA4, Google Ads, Meta Pixel, and dozens of other tags — all from a browser interface. This guide walks through the complete setup from a blank account to your first published tag.

What Google Tag Manager Actually Does

GTM acts as a container — a single JavaScript snippet you install once on your site. Inside the container, you define tags (code snippets that fire), triggers (conditions that cause tags to fire), and variables (dynamic values tags can reference). When a user visits your site, GTM loads, evaluates which triggers are active, and fires the appropriate tags — all without additional code changes to your site.

The benefit is speed and independence. Your marketing team can add a Meta Pixel via GTM or update a conversion tag without waiting for a developer. Changes publish in minutes rather than days.

Step 1: Create a GTM Account and Container

  1. Go to tagmanager.google.com and sign in with your Google account.
  2. Click Create Account.
  3. Enter your Account Name (your company name).
  4. Enter your Container Name (your website domain, e.g. yourstore.com).
  5. Set the Target platform to Web.
  6. Click Create and accept the Terms of Service.

GTM will display two code snippets. You need both installed on every page of your site.

Step 2: Install the GTM Snippet

GTM gives you two snippets:

On Shopify: Go to Online Store → Themes → Edit code → theme.liquid. Paste Snippet 1 inside the <head> section and Snippet 2 directly after the opening <body> tag.

On WordPress: Use a plugin like Insert Headers and Footers or paste directly into your theme’s header.php file. Snippet 1 goes in the header, Snippet 2 goes after <body>.

On WooCommerce: Same as WordPress — add to the theme’s header.php or use a header/footer injection plugin.

After installing the snippets, verify the installation using GTM’s Preview mode (covered in Step 5).

Step 3: Understand the Core Concepts

GTM has three building blocks:

Tags

Tags are the code snippets you want to run. Examples: a GA4 Configuration tag (loads the GA4 tracking library), a Google Ads Conversion Tracking tag, a Meta Pixel base code tag. GTM has built-in templates for the most common tag types — you fill in your IDs and GTM handles the code.

Triggers

Triggers define when a tag fires. Common trigger types:

Variables

Variables are values that tags and triggers can reference. GTM has built-in variables (Page URL, Click Text, Click ID, Form ID) and lets you define custom ones. The most important custom variable type for ecommerce is the Data Layer Variable — it reads values pushed to the dataLayer by your site, such as order value, product ID, or transaction ID.

Step 4: Add Your First Tag — GA4 Configuration

The GA4 Configuration tag loads the GA4 tracking library and sends the initial page view event. Every other GA4 tag depends on this tag being present.

  1. In GTM, go to Tags → New.
  2. Click Tag ConfigurationGoogle Analytics: GA4 Configuration.
  3. Enter your Measurement ID (found in GA4 under Admin → Data Streams → your stream → Measurement ID, format: G-XXXXXXXXXX).
  4. Leave Send a page view event when this configuration loads checked (this is how GA4 records page views).
  5. Under Triggering, click the + icon and select Initialization — All Pages. This trigger type ensures the GA4 library loads before any other tags try to send events.
  6. Name the tag something clear: GA4 — Configuration.
  7. Click Save.

Step 5: Test with Preview Mode Before Publishing

Never publish a GTM container change without testing it first in Preview mode. A broken tag can fire on every page load and corrupt your data.

  1. In GTM, click Preview in the top right.
  2. Enter your website URL and click Connect. A new browser tab opens with your site, and the Tag Assistant panel appears.
  3. Navigate between pages and perform actions (clicks, form submissions).
  4. In the Tag Assistant panel, check that your tags appear under Tags Fired and not under Tags Not Fired.
  5. Click on the tag to see what triggered it, which variables were read, and their values.

For the GA4 Configuration tag, you should see it fire on every page view. In GA4’s DebugView (Admin → DebugView), you should see page_view events appearing in real time as you navigate.

Step 6: Publish the Container

  1. Once testing confirms everything works, click Submit in the top right of GTM.
  2. Choose Publish and Create Version.
  3. Add a Version Name and Description: “GA4 Configuration — initial setup”.
  4. Click Publish.

GTM versions every publish. If a change breaks something, you can roll back to any previous version instantly from the Versions tab — a major advantage over editing code directly on your site.

Organising Your GTM Container

As you add more tags, organisation becomes important. Recommended practices:

Common GTM Mistakes to Avoid

What to Add Next

Once your GA4 Configuration tag is live and verified, the logical next tags to add are:

  1. GA4 purchase event tag — fires on your order confirmation page, sends revenue and transaction data to GA4.
  2. Google Ads Conversion Tracking tag — fires on the same purchase trigger, sends conversion data to Google Ads for Smart Bidding.
  3. Meta Pixel base code — fires on all pages, enables remarketing and event tracking for Meta campaigns.

Each of these builds on the GTM foundation you have just set up. For a complete look at server-side tracking options that sit alongside GTM, that is a separate (and more advanced) setup worth considering once your client-side tracking is solid.

Related Articles

Want Your GTM Setup Reviewed by an Expert?

A misconfigured GTM container can corrupt months of data before anyone notices. We offer a free 20-minute tracking audit where we check your container live and flag anything that will cause problems.

Book your free tracking audit →

Leave a Reply

Your email address will not be published. Required fields are marked *