Resources/SOPs/SOP 004
SOP 004Analytics

How to Add Google Tag Manager to a WordPress Site

Time10–15 minutes
📊 LevelBeginner
📅 UpdatedJune 2025
👤 WhoDigital marketer, analytics manager,…

🚀 Goal

Install Google Tag Manager on a WordPress site so you can add and manage all tracking pixels and scripts from one place — without touching code.

🎯 Ideal Outcome

GTM is installed, your GTM ID is visible in the page source, and the container is published and verified with Tag Assistant.

🤔 Why This Matters

Every tracking code — Meta Pixel, GA4, Google Ads conversion tag, LinkedIn Insight, TikTok Pixel — can be managed inside GTM without touching your WordPress theme. Without GTM, developers are needed for every tracking update, slowing down campaigns. With GTM, a marketer can add, edit, or remove tracking independently in minutes.

SU

Sumayya Beegam

Digital Marketing Specialist & Mentor, Unlearn Academy

Mentor Insight

GTM is the first thing we set up on every client website before running a single rupee in ads. I have seen students waste ₹10,000+ in Meta Ads with no Pixel data because GTM was never installed. Once GTM is in place, adding or updating any tracking pixel takes under 5 minutes — no developer needed. For L2 students doing real client work, this is one of the first SOPs you should memorise.

Result: From 0 tracking data to full Pixel + GA4 + Google Ads tracking live in under 30 minutes.

⚠️ Before You Start

A Google account to create the GTM account

Admin access to the WordPress dashboard

Download the Google Tag Assistant Companion extension for Chrome (free)

This SOP works only for WordPress.org (self-hosted) sites — not WordPress.com

Phase 1 — Create Your GTM Account
1

Create a Google Tag Manager account

Go to tagmanager.google.com → Sign in with your Google account. If this is your first time, you will be redirected to the account creation page. Fill in: • Account Name — your brand or client name (e.g. Unlearn Academy) • Country — India • Container Name — paste your website URL (e.g. unlearnacademy.in) • Target Platform — select 'Web' • (Optional) Share data anonymously with Google Click 'Create' → Accept the Terms of Service popup.
2

Note your GTM ID and publish the container

After creating the account, you will see a code snippet for manual installation. Ignore this — you will install via a plugin instead. Note your GTM ID — it looks like: GTM-XXXXXX (visible in the top right corner of your workspace). Now click 'Submit' → 'Publish' → 'Continue' to publish the empty container. This is required before installation will work.
📌

Note: Save your GTM ID somewhere — you will paste it into the WordPress plugin in the next step.

Phase 2 — Install on WordPress
3

Install the GTM4WP plugin

Log into your WordPress admin → Go to Plugins → Add New. Search for: 'Google Tag Manager for WordPress' Install and activate the 'GTM4WP' plugin. After activation, go to Settings → Google Tag Manager in the WordPress sidebar. Paste your GTM ID (GTM-XXXXXX) into the field provided.
4

Choose your installation method

The plugin offers two options: Option A — Automatic (Codeless): Leave the placement setting as 'Off' — the plugin automatically injects the GTM code in the right place. This is the easiest option. Click 'Save Changes' → Open your site in a new tab and confirm it still looks correct. Option B — Manual (Theme Header): For developers comfortable with theme files. Select 'Custom (needs a tweak in your template)' → Copy the PHP code provided → Go to Appearance → Theme Editor → Open header.php → Paste the code immediately after the opening <body> tag → Click 'Update File'.
⚠️

Warning: Always back up your WordPress site before editing theme files. A mistake in header.php can break your entire website.

Phase 3 — Verify Installation
5

Confirm GTM code is in the page source

Open your website homepage in Chrome → Right-click anywhere → 'View Page Source'. Press Ctrl+F (or Cmd+F on Mac) → Search for your GTM ID (e.g. GTM-XXXXXX). You should find it twice in the source code — once in the <head> section and once in the <body> section. If you do not see your GTM ID: the plugin is not installed correctly. Check that the plugin is activated and the ID is saved.
📌

Note: If GTM ID appears in source, installation is successful. You can now add any tracking tag (Meta Pixel, GA4, Google Ads etc.) through the GTM interface without touching WordPress again.

6

Verify with Tag Assistant

In Google Tag Manager, click 'Preview' → Enter your website URL → Click 'Connect'. A Tag Assistant window will open showing all tags firing on your site. You should see the GTM container loaded. If it shows 'Connected' — your installation is complete and working.

SOP Complete

You've completed all steps. Document your before/after results and add this to your portfolio as a case study.

Quick Reference

🧐 Where

Google Tag Manager (tagmanager.google.com) and your WordPress Admin dashboard.

🗓 When

Once, during the initial setup of a new website or when onboarding a new client.

👤 Who

Digital marketer, analytics manager, or web developer setting up a new site.

Want to learn this live?

Join a cohort — real mentors, client briefs, and structured progression from L1 to L4.

Enquire Now

Save This SOP

Related SOPs

← All SOPs