
January 1, 2022
What is Google Tag Manager Noscript?
Updated: January 1st, 2022. After you create a new Google Tag Manager container, the interface asks to place two codes on your website, one in the <head> and the after right after the opening <body> tag. But have you ever wondered why are there two codes instead of one?
Usually tracking tools, like Google Analytics, Mixpanel, or others require placing one code on all pages, so how come GTM is different?
In this blog post, I’ll explain what Google Tag Manager Noscript is and why you might need it (or not, after all).
Two codes
This view looks familiar, doesn’t it?
The top one ( a.k.a. the <script> part) is the essence of the Google Tag Manager. The higher you place it in the code, the sooner it will load, therefore your marketing and tracking tags will capture the data sooner. As a result, your data will be more accurate.
This code responsible for all the tracking magic that’s happening on a website. It creates the Data Layer, initiates triggers to fire, dispatches tags, etc.
The <script> part a heavy lifter which does A LOT. Without it, your GTM implementation would be simply worthless.
Now, there is a totally different story behind the 2nd code, <noscript>. What if I told you it’s unnecessary? After looking at countless numbers of Google Tag Manager containers, I can say that 95% of regular everyday marketers (#madeUpStatistics) just don’t need it (maybe even more). But they still use it (because Google’s instructions say so).
Why?
Google Tag Manager noscript works only in browsers when JavaScript is off
Unfortunately, I haven’t found any relevant statistics regarding how many people browse the web without JavaScript, but I don’t think that there are many of them (even though I’ve seen others saying different things). Just try to disable JavaScript for a while and browse your favorite websites. Take a closer look at what happens.
Spoiler alert: a lot of things will not work at all. And I’m not talking only about fancy animations. I’m talking about actual functionality, like cookies, etc. There are some serious limitations on the web without JS, therefore not many should be choosing this option.
Anyway, now it probably makes sense to you, why that 2nd code is surrounded by <noscript>. Because it functions only when JavaScript is disabled.
How Google Tag Manager Noscript works?
When JS is off and the page is loaded, the <noscript> initiates an iFrame. An iFrame is an inline frame used inside a webpage to load another HTML document inside it (for example, a webpage within a webpage).
They are used for lots of things, like web analytics, ad targeting, and embedded 3rd party content. Adsense banners? iFrame. Embedded generation form? Probably iFrame. There are many things online that utilize iFrames.
Anyway, back to the <noscript>. When the page loads, an iFrame loads as well, and tags are fired through it. That’s like a workaround for the non-JavaScript environment. If JavaScript is enabled, the contents of the <noscript> tag are ignored and all tags are fired normally based on their standard rules.
However, there’s one BUT. Only one tag type is supported when JS is off, a Custom Image Tag. I’ve written an extensive guide about it but here’s a quick recap.
Custom Image Tag in a Nushell
The custom image tag requests an image from a particular URL. The interesting part is that by making the request you’re actually transmitting information to a server.
For example, if you request an image via URL https://www.example.com/something?parameter1=good¶meter2=123, the receiving server processes parameter1 and parameter2 and acts accordingly (e.g. registers those parameters as an event).
In other words, when the page loads, a Custom Image tag fires that contains particular parameters (for example, Page URL). Those parameters are your data points that are transferred to the receiving server, like Google Analytics.
However, not everything is that simple. There are many limitations.
Google Tag Manager Limitations when JavaScript is off
Forget all triggers, like Form Submission, Youtube Tracking, Scroll, Tracking, etc. Only Pageview triggers (Pageview, DOM Ready, and Window Loaded) work when JS is off and there’s nothing we can do about it.
As for variables, the majority are also useless in this context. I’ve prepared a cheat sheet of all GTM variables + which ones require JavaScript while others can properly function without it.
Built-in Variables | Works without JS? | Comment |
Click Element | No | |
Click ID | No | |
Click Target | No | |
Click Text | No | |
Click URL | No | |
Container ID | Yes | |
Container Version | Yes | |
Debug Mode | Yes | |
Environment Name | Yes | |
Error Line | No | |
Error Message | No | |
Error URL | No | |
Event | Partially | Returns values of pageview-related events only |
Form Classes | No | |
Form Element | No | |
Form ID | No | |
Form Target | No | |
Form Text | No | |
Form URL | No | |
History Source | No | |
HTML ID | No | |
New History Fragment | No | |
New History State | No | |
Old History Fragment | No | |
Old History State | No | |
On-Screen Duration | No | |
Page Hostname | Yes | |
Page Path | Yes | |
Page URL | Yes | |
Percent Visible | No | |
Random Number | Yes | |
Referrer | No | |
Scroll Depth Threshold | No | |
Scroll Depth Units | No | |
Scroll Direction | No | |
Video Current Time | No | |
Video Percent | No | |
Video Provider | No | |
Video Status | No | |
Video Title | No | |
Video URL | No | |
Video Visible | No | |
User-defined Variables | ||
HTTP Referrer | No | |
URL | Yes | |
1st Party Cookie | No | |
Custom JavaScript | No | |
Data Layer Variable | Partially | They need to be added as query parameters. Read more. |
JavaScript Variable | No | |
Auto-Event Variable | No | |
DOM Element | No | |
Element Visibility | No | |
Constant | Yes | |
Custom Event | Partially | Returns values of pageview-related events only |
Environment Name | Yes | |
Google Analytics Settings | No | |
Lookup Table | Partially | Works only with those variables which do not depend on JS |
Random Number | Yes | |
RegEx Table | No | |
Container ID | Yes | |
Container Version Number | Yes | |
Debug Mode | Yes |
So, when exactly do I need to use Google Tag Manager noscript?
You need to place <noscript> code on a website, if:
- You plan to track visitors who have disabled JavaScript on their browser.
- Or you wish to verify the ownership of the website in the Google Search Console by choosing the “Verify with Google Tag Manager” option.
- Or you don’t plan do to the aforementioned activities right now, but maybe it will become a priority in the future.
In all other cases (as far as I know), Google Tag Manager noscript is unnecessary so feel free to ignore it. If you think that I’m wrong, I’ll be more than happy to hear your opinion and learn something new.

Further reading
This is not my first blog post related to Google Tag Manager noscript, so if you want to learn more on how to use it, here are a couple of guides:
Google Tag Manager Noscript: FAQ + conclusion
This section is for those who are in a hurry and want to learn everything quickly. I’ve put a list of most common questions related to Google Tag Manager noscript with a hope that you’ll find the needed answer. This also works as a conclusion of this post:
#1. Is <noscript> part of the GTM snippet required to be placed on a page. No, it’s not. Feel free to leave it out if you’re not interested in:
- tracking of visitors with JavaScript disabled
- website verification in Google Search Console via Google Tag Manager.
#2. Should I place <noscript> only in the <body> part of the website? Yes. <noscript> should be either placed in the <body> or not be placed on a website at all. Since <noscript> initiates an iFrame and iFrame is not supported in the <head>, your website’s code will become invalid.
#3. Do all tags work when JavaScript is disabled in the browser? Almost no tags will work then, except Custom Image Tag.
#4. What about Data Layer? What happens when JavaScript is off? Since Data Layer fully relies on JavaScript, it will not work when JS is disabled, unless a developer decorates the iframe link with query parameters. Read more about that here.
#5. So no Data Layer variables in the Custom Image Tag? If you just simply pasted the <noscript> part to the website, Data Layer variables will not work. However, if you know how to code or have access to a developer, you can ask him/her to decorate the iframe link inside the <noscript> with query parameters. GTM will then fetch those query parameters if your container contains data layer variables. Read more about it there.
#6. If JavaScript is enabled in the browser, is <noscript> snippet active? No. It remains inactive as long as JavaScript is on.
#7. So Custom Image tag works only when JavaScript is disabled? Custom Image tag works in both JS and non-JS environments. When JavaScript is enabled, Custom Image tag is fired via <script> snippet, and via <nosript> when JS is off.
#8. Which triggers work when JS is disabled and <noscript> is active? Only Pageview-based triggers like Page view, DOM Ready, and Window Loaded. All other triggers CANNOT properly function.
#9. Which GTM variables can still function when JavaScript is disabled? In short, all Page-related variables, like Page Path, Page URL, etc. Also, utilities, like Contained ID, Debug mode. Also a constant variable and a random number. The full list is available in the chapter Google Tag Manager limitations when JavaScript is off.
#10. Wait, what about GTM preview mode? Isn’t it also based on JavaScript? How can I debug my tracking then? Yes, Preview mode will not work too. Browser’s Network Tab will be your best friend. I’ve explained the issue in this guide.
#11. In Google Tag Assistant, I get this error: gtm no-script code not found: either missing or not in <body>. What should I do? As you already know after reading this blog post, GTM noscript is not essential for GTM to work. You need it only if you plan to track users who have JavaScript disabled or if you want to verify your Search Console property.
For Search Console verification to work it is crucial to have the noscript part placed RIGHT AFTER the opening <body> tag of your website.
In order to track visitors who have disabled JavaScript, it’s completely enough to have the noscript code placed anywhere in the <body>.

13 COMMENTS
Is there a reason why they say put the noscript snippet immediately after the body tag, other than that is the earliest it can load? A while back when V2 code required both snippets to be placed after the opening body tag, it seemed that there would be issues if the code was a child of another element, e.g. a div element. Would there still be an issue if the noscript code was not a direct child of the body tag? I know this is quite an esoteric question, but curious to know if the same still applies.
The main reason why GTM asks you to add the noscript part immediately after the opening body tag is Search Console property verification. If you don't plan to use it, then you can add the noscript anywhere you want in the body.
Hi Julius,
What if I just have the noscript on the website, no script part. What will be the difference?
Your regular tags will not work if the script part is missing. The script part is a must-have.
Hi Julius,
what do you think of using GTM-noscript in context of GDPR? From my point of view no tracking should start without cookie consent from the user. No Javascript -> No cookie consent -> No tracking! What do you think?
If you pass PII via custom image tag, then yes, you need a consent for that.
GDPR is not only about cookies, it's about PII.
Julius, I am not a digital marketer or a data analyst though I've been tasked to understand and evaluate the efficiency of our current GA implementation. It's a bit of a mess I'll tell ya but I'm really learning a lot from your site, thank you!
So I don't think we need the part on our site, however, is there any benefit in removing it? Can I justify by any means that removing it will have some sort of efficiency improvement, vs, removing it for the sake of removing it. I see some pushback on this immediately if I can't justify removing it, nor can I really justify having it, but it's already there now so it will be harder to justify its removal.
If there is an improvement in performance (after removing the noscript), most likely, it will be very minimal.
I have a web property that, due to extenuating circumstances, we haven't the ability to insert anything into the body tag. As a result, preview mode doesn't work on that site at all. The window loads blank, and then it just keeps trying and trying to load. I can't say for sure if this happens to everyone, so I'd love to hear if others are experiencing something different.
It is caused either by Content Security Policy on your site (you'd need to talk with your developers) or some of your code on the site is conflicting with the Preview mode. In that case, you'd need to log in to your GTM interface and in the top right corner click "Send feedback" and provide all the details about the issue.
But isn't it correct that display:none makes some browsers ignore the image and never load it? So then noscript tracking wouldn't work!?
What "some browsers"? display:none hides the element from the viewport (but the element is still loaded)
I work for County government and would like to add my GTM code to my section of my website. The problem is, the only place I can update the site is through the WYSIWYG editor. Which is fine with me, I don't really use it, I open it and then go straight through the source code in the editor and update there. When I hit save though, it filters out the JS. The latest upgrade to the editor filters out any JS when it used to work, so now GTM doesn't work. I tried using just the iframe without the noscript, but it still doesn't work. Is there any way I can trick the WYSIWYG editor in allowing me to update my site with the GTM code?