If you have landed on this website, chances are that you noticed this error: GTM no-script code not found: either missing or not in <body>.
In this blog post, I will explain what this error message is and what should you do about it.
Two Google Tag Manager code snippets
When you want to install Google Tag Manager, you are asked to add two code snippets to your website:
the script should be added to the <head> of your website
noscript should be added directly after the opening <body> tag in your website’s HTML
The most important code snippet is the first one, script. It is responsible for your web GTM container’s functionality. Without it, your tags will not fire.
The second one, on the other hand, is optional. It is needed ONLY if you plan:
or you want to verify your Google Search Console property ownership with GTM. But there are many other verification methods for this.
So if you don’t plan to do any of these things, you don’t need the noscript code. Feel free to remove it from your site’s source code and ignore warnings in the Tag Assistant Legacy Chrome extension.
Solutions for this error
Anyway, if you have decided that you still need the GTM noscript code in your website, check the following things (if you fix them, that should solve your problem).
Reason #1: the noscript code is not added
Open your website, do the right-click and then choose View page source. Then open the search function (on Windows, that is CTRL + F). Then enter “noscript” (without quotation marks).
See what search results are showing. If you cannot find any <noscript> codes that contain “googletagmanager.com”, this means that you or your developer (or maybe a plugin that you’re using to install GTM) did not add the code.
Investigate this further and try to identify the reason why this issue occurred. Websites are coded in different ways thus there is no single universal solution here. You will need to find the reason for this by yourself. If you have a developer, the best way would be to contact him/her.
But again, I want to emphasize that in many cases, that noscript code is not needed at all. Consider just not using it and ignoring the warning in Tag Assistant Legacy.
Reason #2: code is added but not in the body (but probably in the head instead)
Another reason might be that both GTM code snippets (script and noscript) are added to the <head> of the website. That should not happen.
Open View page source once again, do the search for “noscript” and check if the noscript is added somewhere between <head> and </head>.
If yes, ask a developer of the website to move the “noscript” from the head of the website to the <body>. Ideally, it should go immediately after the opening <body> tag in the code. Or, as I have said before, just don’t use the noscript at all.
In all other cases, the noscript code is not needed. Feel free to not use it (and ignore the warnings in Tag Assistant).
If you are still determined to use it and you don’t want to see the error (GTM no-script code not found: either missing or not in body), make sure that it is in the <body> of the web site’s code and not in <head>.
If none of these tips solved your issue, post a comment and I’ll try to help.
The post GTM no-script code not found: either missing or not in body appeared first on Analytics Mania.
Read MoreAnalytics Mania