{"id":7706,"date":"2025-10-19T13:32:30","date_gmt":"2025-10-19T13:32:30","guid":{"rendered":"https:\/\/hishamghanayem.com\/?p=7706"},"modified":"2025-10-19T13:32:33","modified_gmt":"2025-10-19T13:32:33","slug":"gtm-preview-mode-not-working-on-wp","status":"publish","type":"post","link":"https:\/\/hishamghanayem.com\/en\/data-analysis\/tracking\/gtm-preview-mode-not-working-on-wp","title":{"rendered":"Fix GTM Preview Mode Not Working on WordPress website"},"content":{"rendered":"\n<p>As a digital analyst and web data enthusiast, I recently ran into a classic but frustrating issue that many web analysts face: my Google Tag Manager (GTM) container wasn&#8217;t showing up in Preview Mode. What made it more confusing? The GTM snippet was clearly present in my page source, but Tag Assistant kept saying: <strong>&#8220;Google Tag: GTM-MHJSPLWM not found.&#8221;<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"554\" data-id=\"7709\" src=\"https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/e9045996-0af1-40a5-8ce7-343489d055d1-1024x554.png\" alt=\"\" class=\"wp-image-7709\" srcset=\"https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/e9045996-0af1-40a5-8ce7-343489d055d1-1024x554.png 1024w, https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/e9045996-0af1-40a5-8ce7-343489d055d1-300x162.png 300w, https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/e9045996-0af1-40a5-8ce7-343489d055d1-768x415.png 768w, https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/e9045996-0af1-40a5-8ce7-343489d055d1-1536x831.png 1536w, https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/e9045996-0af1-40a5-8ce7-343489d055d1-18x10.png 18w, https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/e9045996-0af1-40a5-8ce7-343489d055d1.png 1836w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"548\" data-id=\"7710\" src=\"https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/7be83ee1-d54d-46df-9d42-2ab479b46c96-1024x548.png\" alt=\"\" class=\"wp-image-7710\" srcset=\"https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/7be83ee1-d54d-46df-9d42-2ab479b46c96-1024x548.png 1024w, https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/7be83ee1-d54d-46df-9d42-2ab479b46c96-300x160.png 300w, https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/7be83ee1-d54d-46df-9d42-2ab479b46c96-768x411.png 768w, https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/7be83ee1-d54d-46df-9d42-2ab479b46c96-1536x821.png 1536w, https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/7be83ee1-d54d-46df-9d42-2ab479b46c96-18x10.png 18w, https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/7be83ee1-d54d-46df-9d42-2ab479b46c96.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"283\" data-id=\"7708\" src=\"https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/a653fd49-bda0-4ecb-89ca-39010862aa74-1-1024x283.png\" alt=\"\" class=\"wp-image-7708\" srcset=\"https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/a653fd49-bda0-4ecb-89ca-39010862aa74-1-1024x283.png 1024w, https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/a653fd49-bda0-4ecb-89ca-39010862aa74-1-300x83.png 300w, https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/a653fd49-bda0-4ecb-89ca-39010862aa74-1-768x212.png 768w, https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/a653fd49-bda0-4ecb-89ca-39010862aa74-1-1536x424.png 1536w, https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/a653fd49-bda0-4ecb-89ca-39010862aa74-1-18x5.png 18w, https:\/\/hishamghanayem.com\/wp-content\/uploads\/2025\/10\/a653fd49-bda0-4ecb-89ca-39010862aa74-1.png 1810w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/figure>\n\n\n\n<p>Here&#8217;s a step-by-step breakdown of the problem, how I investigated it, and what finally fix GTM preview mode not working on WordPress website. If you&#8217;re working in GTM, especially in WordPress or eCommerce environments, this could save you hours of head-scratching.<\/p>\n\n\n\n<p><strong>The Problem: GTM Installed but Not Found<\/strong> I was auditing my own course site (courses.hishamghanayem.com) to test event tracking using GTM&#8217;s Preview Mode. The container ID was correct. I even verified that the GTM code was present in the page using Chrome DevTools under the Elements tab. But Preview Mode refused to connect.<\/p>\n\n\n\n<p>The error message was:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>&#8220;Google Tag: GTM-MHJSPLWM not found.&#8221;<\/p>\n\n\n\n<p><strong>Investigation Phase: Putting on the Debugger Hat<\/strong> I approached this like a senior analyst would\u2014hypothesis-driven and methodical.<\/p>\n\n\n\n<p><strong>Step 1: Confirm GTM Code Exists in the DOM<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2705 Yes, GTM ID &#8220;GTM-MHJSPLWM&#8221; was found in both the <code>&lt;head><\/code> and <code>&lt;noscript><\/code> sections.<\/li>\n<\/ul>\n\n\n\n<p><strong>Step 2: Check Network Requests<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>I filtered the Network tab in Chrome DevTools using &#8220;gtm.js&#8221;<\/li>\n\n\n\n<li>\u2705 The request was visible, but marked as: <code>ERR_BLOCKED_BY_CLIENT<\/code><\/li>\n<\/ul>\n\n\n\n<p><strong>Step 3: Console Errors<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Errors confirmed the issue:<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code><\/code><\/pre>\n\n\n\nGET https:\/\/www.googletagmanager.com\/gtm.js?id=GTM-MHJSPLWM net::ERR_BLOCKED_BY_CLIENT\n\n\n\n<p>This was the smoking gun: something on my browser was actively blocking the GTM script.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>The Real Culprit: Ad Blockers &amp; Privacy Extensions<\/strong> After testing in Incognito mode (with all extensions disabled), GTM Preview worked perfectly.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>The issue wasn\u2019t my GTM implementation. It was <strong>my browser environment<\/strong>.<\/p>\n<\/blockquote>\n\n\n\n<p>I had privacy-focused extensions running that were blocking GTM:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ghostery<\/li>\n\n\n\n<li>uBlock Origin<\/li>\n<\/ul>\n\n\n\n<p>Once I paused those extensions on my site and refreshed, GTM loaded correctly, and Preview Mode connected instantly.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>What I Learned &amp; What You Can Apply<\/strong><\/p>\n\n\n\n<p><strong>1. Always Test in Incognito or Clean Profile First<\/strong> You need a clean testing environment without extensions interfering. I now use a Chrome profile named &#8220;GTM QA&#8221; with no add-ons installed.<\/p>\n\n\n\n<p><strong>2. ERR_BLOCKED_BY_CLIENT = Blocker Issue<\/strong> This error means the script was blocked by a browser extension, not that it&#8217;s missing.<\/p>\n\n\n\n<p><strong>3. Validate Using DevTools<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Network tab: Look for gtm.js loading.<\/li>\n\n\n\n<li>Console tab: Check for red errors.<\/li>\n\n\n\n<li><code>window.google_tag_manager<\/code> in Console: Useful GTM presence check.<\/li>\n<\/ul>\n\n\n\n<p><strong>4. Bookmarklet to Check GTM Status<\/strong> Here&#8217;s a handy snippet:<\/p>\n\n\n<p>javascript:(function(){<\/p>\n<p>varid = &#8216;GTM-MHJSPLWM&#8217;;<\/p>\n<p>if (window.google_tag_manager &#038;&#038; google_tag_manager[id]) {<\/p>\n<p>alert(&#8216;\u2705 GTM is loaded and active: &#8216; + id);<\/p>\n<p>} else {<\/p>\n<p>alert(&#8216;\u274c GTM not found or blocked.&#8217;);<\/p>\n<p>}<\/p>\n<p>})();<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>Conclusion: From Problem to Portfolio-Worthy Lesson<\/strong> This issue reminded me that technical issues aren&#8217;t always about &#8220;bad code&#8221; or &#8220;wrong tags.&#8221; Sometimes, it&#8217;s the test environment. Documenting this not only solved my problem\u2014it gave me material for my blog, LinkedIn, and a reusable SOP for future GTM audits.<\/p>\n\n\n\n<p>If you&#8217;re in digital analytics, especially in airline, retail, or WordPress ecosystems, build a clean testing process and always rule out browser interference before blaming the tag setup.<\/p>\n\n\n\n<p>Want to avoid this issue again? Create your own QA browser profile and save this checklist.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>Stay curious. Debug deeper. And always ask: is it the code, or is it the context? As a data analyst you should be curious and question the obvious sometime to reach the truth. Thats why it is recommended to try to reproduce the issue on different enviroment or browsers this will help a lot.<\/p>\n\n\n\n<p>Note: This article was written by chatgpt to simplify the topic and make it easier to dyjast. Furthermore, the above issue was not there a month ago before writing the blog. However, do to adding new ad blockers the issue appeared. <\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>As a digital analyst and web data enthusiast, I recently ran into a classic but frustrating issue that many web analysts face: my Google Tag Manager (GTM) container wasn&#8217;t showing up in Preview Mode. What made it more confusing? The GTM snippet was clearly present in my page source, but Tag Assistant kept saying: &#8220;Google [&hellip;]<\/p>","protected":false},"author":1,"featured_media":7712,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"postBodyCss":"","postBodyMargin":[],"postBodyPadding":[],"postBodyBackground":{"backgroundType":"classic","gradient":""},"footnotes":""},"categories":[37],"tags":[130,65,63,66,131],"class_list":["post-7706","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tracking","tag-debugging","tag-google-tag-manager","tag-gtm","tag-wordpress","tag-wp"],"_links":{"self":[{"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/posts\/7706","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/comments?post=7706"}],"version-history":[{"count":1,"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/posts\/7706\/revisions"}],"predecessor-version":[{"id":7713,"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/posts\/7706\/revisions\/7713"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/media\/7712"}],"wp:attachment":[{"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/media?parent=7706"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/categories?post=7706"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/tags?post=7706"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}