Enabling Advanced Tracking and Analytics Using Google Tag Manager

Google Tag Manager (GTM) enables advanced functionality for tracking website visits and pages visited, the effectiveness (conversions) of Google Ads, and more. Follow these instructions to set up GTM on your website using the “Head, Footer and Post Injections” plugin that is already installed on your website.

These instructions cover two scenarios:

  1. Fresh setup from scratch (no GA yet) using GTM through Head, Footer and Post Injections.
  2. Transition if GA4 is already installed via the plugin, and you want to move to GTM.

Section 1: Setting Up GA4 + Google Ads with GTM (Fresh Setup)

Step 1: Create a Google Tag Manager container

  1. Go to tagmanager.google.com.
  2. Log in with your Google account.
  3. Click Create Account → fill in your business/site details.
  4. Add a Web Container for your domain.
  5. Click Create, accept terms.
  6. You’ll now see two code snippets (head + body). Leave this tab open.

Step 2: Add GTM code to WordPress

  1. Log into your WordPress dashboard.
  2. Go to Plugins → Installed Plugins.
  3. Make sure Head, Footer and Post Injections is installed and activated.
  4. Go to Settings → Head & Footer.
  5. From the GTM setup page in Google:
    • Copy the first snippet (for ) and paste it into the Head box.
    • Copy the second snippet (noscript for ) and paste it into the Body (start) box.
  6. Click Save.

✅ Now GTM is live on your site. Nothing is firing yet, but you’re connected.


Step 3: Add GA4 tracking inside GTM

  1. In Google Analytics (analytics.google.com), create or open your GA4 property.
  2. Go to Admin → Data Streams → Web, select your site stream.
  3. Copy the Measurement ID (looks like G-XXXXXXXXXX).
  4. Go back to GTM → Tags → New.
  5. Select Google Analytics: GA4 Configuration.
  6. Paste in your Measurement ID.
  7. Trigger: All Pages.
  8. Save & publish.

Step 4: Add Google Ads Conversion Tracking inside GTM (optional, if running Ads)

  1. In Google Ads, go to Tools & Settings → Conversions → New Conversion Action → Website.
  2. Create your conversion (e.g., form submit, purchase).
  3. After setup, copy the Conversion ID (AW-XXXXXXX) and Conversion Label from Google Ads.
  4. In GTM → Tags → New → Google Ads Conversion Tracking.
  5. Paste the Conversion ID and Label.
  6. Set your trigger (thank-you page, button click, etc.).
  7. Save & publish.

Step 5: Test that everything works

  1. In GTM, click Preview and enter your site’s URL.
  2. Navigate your site — you should see the GA4 tag firing.
  3. For Ads, perform the test conversion and confirm it fires in the GTM debugger.
  4. In GA4, check Realtime Reports to see your activity.
  5. In Ads, check Conversions (may take a few hours to populate).

Section 2: Transitioning from Direct GA4 to GTM Setup

If you already added the GA4 gtag.js snippet directly via the Head, Footer and Post Injections plugin (per earlier instructions), here’s how to safely migrate:

Step 1: Verify your current setup

  1. In WordPress → Settings → Head & Footer, check if the GA4 snippet is in the Head box.
  2. Open your site in Chrome → Right-click → View Source, and confirm you see https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX.

Step 2: Install GTM container (from Google Tag Manager)

  1. In tagmanager.google.com, copy the Head snippet.
  2. Paste it into the Head box (above your existing GA4 snippet for now).
  3. Copy the Body snippet and paste it into the Body (start) box.
  4. Save.

Step 3: Add GA4 inside GTM

  1. Go to analytics.google.com.
  2. Find your Measurement ID (G-XXXXXXXXXX).
  3. In GTM → Tags → New → GA4 Configuration Tag.
  4. Paste your Measurement ID.
  5. Trigger: All Pages.
  6. Save & publish.

Step 4: Test before removing old GA4 code

  1. In GTM, click Preview and test.
  2. Open your site in another tab — you should see GA4 firing twice (once from GTM, once from the old snippet).
  3. Check GA4 Realtime → you’ll see duplicate hits. That’s expected temporarily.

Step 5: Remove the old GA4 snippet

  1. In WordPress → Settings → Head & Footer.
  2. Delete the original GA4 code snippet (leave only the GTM snippets).
  3. Save.
  4. Refresh your site and check with Tag Assistant — only the GTM container + GA4 via GTM should fire.

Step 6: Add Google Ads tracking (optional)

  • Follow Step 4 from Section 1 to add Ads conversions inside GTM.

Final Best Practice

  • Keep only one GTM container in Head & Footer.
  • Manage all tracking codes (GA4, Ads, remarketing, Meta, LinkedIn, etc.) inside GTM.
  • Always test changes in Preview mode before publishing.