Install on WordPress

Two install paths. The plugin route is recommended for non-developers; thefunctions.php route is recommended for developers running custom themes.

Option A — Insert Headers and Footers plugin (recommended)

  1. WordPress Admin → Plugins → Add New
  2. Search for "Insert Headers and Footers" by WPCode (very common, has 1M+ active installs)
  3. Install → Activate
  4. Settings → Insert Headers and Footers
  5. In Scripts in Header, paste the GTM head snippet (from the wizard's WordPress Install tab)
  6. In Scripts in Body (or Footer if your theme doesn't support body), paste the GTM noscript snippet
  7. Save changes

Equivalent alternatives: WPCode Lite, Header Footer Code Manager, or any plugin that lets you inject raw HTML into <head> + after <body>.

Option B — functions.php (developers)

Best with a child theme so theme updates don't wipe your changes. Hooks into the standard wp_head and wp_body_open actions.

Copy the PHP snippet from the wizard's WordPress Install tab → Option B card, and paste it into your child theme's functions.php. It registers both action callbacks. Save the file and the GTM snippets will appear on every page.

Step 3 — Verify

  1. Visit your site in an incognito window
  2. View the page source (Cmd+Option+U)
  3. Search for googletagmanager.com/gtm.js — should be in <head>
  4. Search for googletagmanager.com/ns.html — should be in a <noscript> tag right after <body>

Pre-built event templates for WordPress

  • wordpress:ga4:form_submit — Contact Form 7, WPForms, Gravity Forms
  • wordpress:ga4:comment_submit — blog comment forms
  • wordpress:ga4:search — WordPress search
  • wordpress:ga4:login
  • wordpress:ga4:signup

WooCommerce on top of WordPress

If your site is a WordPress + WooCommerce store, install GTM as above and then follow the WooCommerce guide for the GTM4WP plugin which auto-pushes e-commerce events.

Common gotchas

  • Page caching — clear your WP cache (W3 Total Cache, WP Rocket, etc.) after installing the snippet, otherwise old pages still serve without it.
  • CSP headers — if you use a Content Security Policy plugin, you may need to allow googletagmanager.com and your Measurement ID domain.
  • Multiple GTM containers — don't install TagEasy alongside another GTM plugin. They'll inject conflicting snippets and double-fire events.