{"slug":"sop-004-add-google-tag-manager-to-a-wordpress-site","title":"Add Google Tag Manager to a WordPress Site","tags":["source:clickminded","type:sop","server:clickminded-sop","google","tag","manager","wordpress"],"agent_summary":"SOP 004: Add Google Tag Manager to a WordPress Site Perfectly add Google Analytics to a site to measure website data and gather visitor insights, using Google Tag Manager and verify that it is working","trigger_phrases":["add google tag manager to a wordpress site","how to add google tag manager to a wordpress site"],"runnable":false,"markdown":"\r\nSOP 004: Add Google Tag Manager to a WordPress Site\r\n\r\nPerfectly add Google Analytics to a site to measure website data and gather visitor insights, using Google Tag Manager and verify that it is working properly.\r\n\r\n__Last Updated / Reviewed:__ 06/09/2025\r\n\r\n__Execution Time:__ 10-15 minutes\r\n\r\n__🚀 Goal:__ To add Google Tag Manager to a WordPress site.\r\n\r\n__🤞 Ideal Outcome:__ Google Tag Manager is properly installed without any technical issues.\r\n\r\n__🤔 Why this is important:__ Google Tag Manager is a great tool to add and manage multiple pixels and tracking codes without needing to edit the code of a site.\r\n\r\n__🧐 Where this is done__ In your WordPress install and Google Tag Manager.\r\n\r\n__🗓️ When this is done:__ Only once, the first time you install Google Tag Manager. \r\n\r\n__👨 Who does this:__ The person responsible for website management or analytics.\r\n\r\n__⚠️Prerequisites or requirements: __This exact process only applies to WordPress.org sites.\r\n\r\n[__Click here to get the most up-to-date version of this SOP__](https://members.clickminded.com/sop/004)\r\n\r\n## Environment setup\r\n\r\n__Important:__ This SOP works only for self-hosted WordPress sites, aka WordPress.org and not WordPress.com\r\n\r\n### 01▸ Download the [Google Tag Assistant Companion ](https://chromewebstore.google.com/detail/tag-assistant-companion/jmekfmbnaedfebfnmakmokmlfpblbfdm)(Free).\r\n\r\n### 02▸ To sign up for [Google Tag Manager ](https://www.google.com/analytics/tag-manager/)(Free), you’ll need to log in to your Google account.\r\n\r\n### 03▸ If this is your first time creating a Google Tag Manager Account, you’ll be redirected to the account creation page.\r\n\r\n### 04▸ Fill in the following information:\r\n\r\n- __Account Name__ — The name you use to identify this account.\r\n- __Country__ — Country origin.\r\n- __Container name__ — Insert the URL of your website\r\n- __Target platform__ — Where do you plan to add Google Tag Manager (e.g. on your website, mobile, etc)\r\n- __(Optional)__ Share data anonymously with Google.\r\n\r\n\r\n### 05▸ Once finished. Click “Create”.\r\n\r\n### 06▸ You’ll see a Google Tag Manager Terms of Service pop-up. Select the checkbox and click “Yes”.\r\n\r\n\r\n### 07▸ You will see the code for installing Google Tag Manager. Ignore this since you won’t be manually adding code to your WordPress site. Click “OK”.\r\n\r\nOnce you are in your Workspace, make a note of your Google Tag Manager ID.\r\n\r\n\r\n### 08▸ Click on \"Submit\" > \"Publish\" > Continue to publish your Google Tag Manager container and that’s it!\r\n\r\n\r\n## Install and configure the Google Tag Manager WordPress plugin\r\n\r\n### 01▸ Log into your WordPress site.\r\n\r\n### 02▸ In the WordPress sidebar, go to \"Plugins\" > \"Add New\".\r\n\r\n### 03▸ Enter “Google Tag Manager for WordPress” in the search box.\r\n\r\n### 04▸ Install the [GTM4WP ](https://wordpress.org/plugins/duracelltomi-google-tag-manager/)plugin (the image may vary).\r\n\r\n\r\n### 05▸ To activate the plugin, go to the WordPress sidebar and click \"Settings\" > \"Google Tag Manager\".\r\n\r\n### 06▸ Paste your Google Tag Manager ID (the one you got from the Google Tag Manager dashboard) in the available field.\r\n\r\n\r\n### 07▸ The plugin offers several ways to install the container code on your site. Before you implement any of these, we recommend you create a backup of your site.\r\n\r\n- __Option 1: Off__ — with this option, the plugin will try to figure out the right placement for the container for you. This is the easiest option but there’s a small risk it might break something on the front end of your site. If you decide to go with codeless injection, select this option from the list and click “Save changes”\r\n\r\n\r\nAfter selecting this, visit the website in a new tab or window and make sure everything looks right. If it does, you can move on to the next step of QA-ing the installation\r\n\r\n- __Option 2: Manually Coded__ — with this option, you will need to make a small edit to your theme files. If your WordPress theme allows you to make changes and you’re comfortable with the theme editor, you can use this option. Select the “Custom (needs a tweak in your template)” container code placement and click on “Save Changes.”\r\n\r\n\r\n### 08▸ Copy the PHP code provided by the plugin and click on “Save Changes”.\r\n\r\n\r\n### 09▸ In the WordPress sidebar, go to \"Appearance\" > \"Theme Editor\".\r\n\r\n### 10▸ Make sure that you are editing the theme that you currently have installed on your site (you can go to \"Appearance\" > \"Themes\" to check the name of the theme you are using).\r\n\r\n\r\n### 11▸ Select the “Theme Header” template from the list on the right.\r\n\r\n\r\n### 12▸ This template is different depending on the theme that you have installed. However, you will always be able to find an opening <body> tag in the code.\r\n\r\n\r\n### 13▸ Paste the PHP code provided by the plugin right below the opening <body> tag.\r\n\r\n\r\n### 14▸ Click on “Update File”.\r\n\r\n## QA your installation\r\n\r\n__Step 1: Confirm GTM Snippet Installation__\r\n\r\nBefore testing with Tag Assistant, confirm that the GTM container code is correctly embedded in your website.\r\n\r\n### 01▸ Open your website homepage using Chrome.\r\n\r\n### 02▸ Right-click on the page and select \"View Page Source\".\r\n\r\n### 03▸ Press Ctrl + F (or Command + F on Mac) and search for your GTM ID (e.g., GTM-XXXXXX).\r\n\r\n### 04▸ If you do not see the GTM ID in the source code:\r\n\r\n- The container is not properly installed.\r\n- Double-check that you've added the GTM snippet correctly in your site's header and body sections as outlined in SOP 004.\r\n- If using a CMS like WordPress, verify that your GTM plugin or theme settings include the correct ID.\r\n\r\n__Step 2: Use GTM's Native Preview Mode (Recommended)__\r\n\r\n### 05▸ Go to Google Tag Manager and open your container.\r\n\r\n### 06▸ Click the \"Preview\" button in the top right.\r\n\r\n### 07▸ Enter your website URL in the pop-up window and click \"Connect\".\r\n\r\n### 08▸ A new window will open showing your site with a debug console at the bottom.\r\n\r\nIf the GTM installation is correct, you’ll see tags being fired in the debug console. \r\n\r\n__Step 3: (Optional) Use Google Tag Assistant Companion Extension__\r\n\r\nIf you prefer or need to use the Chrome extension:\r\n\r\n### 09▸ Install and open the[ Google Tag Assistant Companion ](https://chromewebstore.google.com/detail/tag-assistant-companion/jmekfmbnaedfebfnmakmokmlfpblbfdm)icon on your browser.\r\n\r\n\r\n### 10▸ Click on “Add domain”.\r\n\r\n\r\n### 11▸ Enter your website URL, click “Connect” and reload the page.\r\n\r\n\r\n### 12▸ If successful, a message saying Tag Assistant Connected will appear.\r\n\r\n\r\n__Note: __If this fails, but Step 2 works, rely on GTM's built-in preview mode for debugging instead. If connection issues occur, you may refer to [this link here ](https://support.google.com/tagassistant/answer/10039345?hl=en#zippy=%2Cin-this-article)to troubleshoot.\r\n\r\n__Troubleshooting Tips:__\r\n\r\n- Still not seeing your GTM ID in your site’s source code? Revisit SOP 004 and ensure the container is added to the correct parts of your site.\r\n- Make sure your website isn’t cached (clear your browser cache or try an incognito window).\r\n- If using a CMS, confirm that third-party plugins or themes are not stripping scripts.","html":"<p>SOP 004: Add Google Tag Manager to a WordPress Site</p>\n<p>Perfectly add Google Analytics to a site to measure website data and gather visitor insights, using Google Tag Manager and verify that it is working properly.</p>\n<p><strong>Last Updated / Reviewed:</strong> 06/09/2025</p>\n<p><strong>Execution Time:</strong> 10-15 minutes</p>\n<p><strong>🚀 Goal:</strong> To add Google Tag Manager to a WordPress site.</p>\n<p><strong>🤞 Ideal Outcome:</strong> Google Tag Manager is properly installed without any technical issues.</p>\n<p><strong>🤔 Why this is important:</strong> Google Tag Manager is a great tool to add and manage multiple pixels and tracking codes without needing to edit the code of a site.</p>\n<p><strong>🧐 Where this is done</strong> In your WordPress install and Google Tag Manager.</p>\n<p><strong>🗓️ When this is done:</strong> Only once, the first time you install Google Tag Manager.</p>\n<p><strong>👨 Who does this:</strong> The person responsible for website management or analytics.</p>\n<p>__⚠️Prerequisites or requirements: __This exact process only applies to WordPress.org sites.</p>\n<p><a href=\"https://members.clickminded.com/sop/004\"><strong>Click here to get the most up-to-date version of this SOP</strong></a></p>\n<h2>Environment setup</h2>\n<p><strong>Important:</strong> This SOP works only for self-hosted WordPress sites, aka WordPress.org and not WordPress.com</p>\n<h3>01▸ Download the <a href=\"https://chromewebstore.google.com/detail/tag-assistant-companion/jmekfmbnaedfebfnmakmokmlfpblbfdm\">Google Tag Assistant Companion </a>(Free).</h3>\n<h3>02▸ To sign up for <a href=\"https://www.google.com/analytics/tag-manager/\">Google Tag Manager </a>(Free), you’ll need to log in to your Google account.</h3>\n<h3>03▸ If this is your first time creating a Google Tag Manager Account, you’ll be redirected to the account creation page.</h3>\n<h3>04▸ Fill in the following information:</h3>\n<ul>\n<li><strong>Account Name</strong> — The name you use to identify this account.</li>\n<li><strong>Country</strong> — Country origin.</li>\n<li><strong>Container name</strong> — Insert the URL of your website</li>\n<li><strong>Target platform</strong> — Where do you plan to add Google Tag Manager (e.g. on your website, mobile, etc)</li>\n<li><strong>(Optional)</strong> Share data anonymously with Google.</li>\n</ul>\n<h3>05▸ Once finished. Click “Create”.</h3>\n<h3>06▸ You’ll see a Google Tag Manager Terms of Service pop-up. Select the checkbox and click “Yes”.</h3>\n<h3>07▸ You will see the code for installing Google Tag Manager. Ignore this since you won’t be manually adding code to your WordPress site. Click “OK”.</h3>\n<p>Once you are in your Workspace, make a note of your Google Tag Manager ID.</p>\n<h3>08▸ Click on \"Submit\" > \"Publish\" > Continue to publish your Google Tag Manager container and that’s it!</h3>\n<h2>Install and configure the Google Tag Manager WordPress plugin</h2>\n<h3>01▸ Log into your WordPress site.</h3>\n<h3>02▸ In the WordPress sidebar, go to \"Plugins\" > \"Add New\".</h3>\n<h3>03▸ Enter “Google Tag Manager for WordPress” in the search box.</h3>\n<h3>04▸ Install the <a href=\"https://wordpress.org/plugins/duracelltomi-google-tag-manager/\">GTM4WP </a>plugin (the image may vary).</h3>\n<h3>05▸ To activate the plugin, go to the WordPress sidebar and click \"Settings\" > \"Google Tag Manager\".</h3>\n<h3>06▸ Paste your Google Tag Manager ID (the one you got from the Google Tag Manager dashboard) in the available field.</h3>\n<h3>07▸ The plugin offers several ways to install the container code on your site. Before you implement any of these, we recommend you create a backup of your site.</h3>\n<ul>\n<li><strong>Option 1: Off</strong> — with this option, the plugin will try to figure out the right placement for the container for you. This is the easiest option but there’s a small risk it might break something on the front end of your site. If you decide to go with codeless injection, select this option from the list and click “Save changes”</li>\n</ul>\n<p>After selecting this, visit the website in a new tab or window and make sure everything looks right. If it does, you can move on to the next step of QA-ing the installation</p>\n<ul>\n<li><strong>Option 2: Manually Coded</strong> — with this option, you will need to make a small edit to your theme files. If your WordPress theme allows you to make changes and you’re comfortable with the theme editor, you can use this option. Select the “Custom (needs a tweak in your template)” container code placement and click on “Save Changes.”</li>\n</ul>\n<h3>08▸ Copy the PHP code provided by the plugin and click on “Save Changes”.</h3>\n<h3>09▸ In the WordPress sidebar, go to \"Appearance\" > \"Theme Editor\".</h3>\n<h3>10▸ Make sure that you are editing the theme that you currently have installed on your site (you can go to \"Appearance\" > \"Themes\" to check the name of the theme you are using).</h3>\n<h3>11▸ Select the “Theme Header” template from the list on the right.</h3>\n<h3>12▸ This template is different depending on the theme that you have installed. However, you will always be able to find an opening <body> tag in the code.</h3>\n<h3>13▸ Paste the PHP code provided by the plugin right below the opening <body> tag.</h3>\n<h3>14▸ Click on “Update File”.</h3>\n<h2>QA your installation</h2>\n<p><strong>Step 1: Confirm GTM Snippet Installation</strong></p>\n<p>Before testing with Tag Assistant, confirm that the GTM container code is correctly embedded in your website.</p>\n<h3>01▸ Open your website homepage using Chrome.</h3>\n<h3>02▸ Right-click on the page and select \"View Page Source\".</h3>\n<h3>03▸ Press Ctrl + F (or Command + F on Mac) and search for your GTM ID (e.g., GTM-XXXXXX).</h3>\n<h3>04▸ If you do not see the GTM ID in the source code:</h3>\n<ul>\n<li>The container is not properly installed.</li>\n<li>Double-check that you've added the GTM snippet correctly in your site's header and body sections as outlined in SOP 004.</li>\n<li>If using a CMS like WordPress, verify that your GTM plugin or theme settings include the correct ID.</li>\n</ul>\n<p><strong>Step 2: Use GTM's Native Preview Mode (Recommended)</strong></p>\n<h3>05▸ Go to Google Tag Manager and open your container.</h3>\n<h3>06▸ Click the \"Preview\" button in the top right.</h3>\n<h3>07▸ Enter your website URL in the pop-up window and click \"Connect\".</h3>\n<h3>08▸ A new window will open showing your site with a debug console at the bottom.</h3>\n<p>If the GTM installation is correct, you’ll see tags being fired in the debug console.</p>\n<p><strong>Step 3: (Optional) Use Google Tag Assistant Companion Extension</strong></p>\n<p>If you prefer or need to use the Chrome extension:</p>\n<h3>09▸ Install and open the<a href=\"https://chromewebstore.google.com/detail/tag-assistant-companion/jmekfmbnaedfebfnmakmokmlfpblbfdm\"> Google Tag Assistant Companion </a>icon on your browser.</h3>\n<h3>10▸ Click on “Add domain”.</h3>\n<h3>11▸ Enter your website URL, click “Connect” and reload the page.</h3>\n<h3>12▸ If successful, a message saying Tag Assistant Connected will appear.</h3>\n<p>__Note: __If this fails, but Step 2 works, rely on GTM's built-in preview mode for debugging instead. If connection issues occur, you may refer to <a href=\"https://support.google.com/tagassistant/answer/10039345?hl=en#zippy=%2Cin-this-article\">this link here </a>to troubleshoot.</p>\n<p><strong>Troubleshooting Tips:</strong></p>\n<ul>\n<li>Still not seeing your GTM ID in your site’s source code? Revisit SOP 004 and ensure the container is added to the correct parts of your site.</li>\n<li>Make sure your website isn’t cached (clear your browser cache or try an incognito window).</li>\n<li>If using a CMS, confirm that third-party plugins or themes are not stripping scripts.</li>\n</ul>\n"}