Instructions for Classic Themes
-
In your WordPress dashboard, navigate to Appearance → Editor.
-
Open the header.php file of your active theme.
-
Locate the
<head>tag and paste the Google Tag Manager head snippet inside it. -
Next, locate the opening
<body>tag. -
Paste the second Google Tag Manager snippet immediately after the
<body>tag.
Instructions for Block Themes
Option 1 (cleanest): Use Google’s Site Kit
-
Install Site Kit by Google.
-
In WP admin: Site Kit → Settings → Connect More Services → Tag Manager
-
Select your GTM Container ID, finish setup, and Site Kit will place the code automatically. Google Help+2Site Kit by Google+2
Option 2 (most common plugin): GTM4WP
-
Install “GTM4WP – A Google Tag Manager plugin for WordPress”.
-
Enter your GTM container ID in the plugin settings.
-
It injects both the
<head>and<body>snippets for you. WordPress.org+1
Option 3 (manual, best if you want no plugin): add via hooks
Use a child theme (or a Code Snippets plugin) and add: