February 16, 2021
Cannot Verify Google Search Console with Google Tag Manager? Read this.
Google Search Console (previously known as Google Webmaster Tools) is a free tool by Google. Among all of its other features, it lets you better understand how people are finding your website through Google’s search. It displays keywords, their volume, click-through-rate, etc. But in order to get access to such data, you need to verify the ownership of that particular website.
For your convenience, there is a whole bunch of options to do that: you can upload an HTML file, you can add a little piece of code to website’s source code, etc.
In 2013, Google added yet another way how to verify the site ownership in Google Search Console, with Google Tag Manager. Apparently, things are not that easy here because I see a lot of people complaining online that they cannot verify Google Search Console with Google Tag Manager.
If you are one of them, continue reading because in this quick post I’ll show you how to solve that.
Official Requirements How to Verify Search Console with GTM
On their official support page, Google states the following requirements in order to verify SC with GTM:
- You must have View, Edit, and Manage container-level permissions in Google Tag Manager.
- Place the <noscript> part of the GTM container code immediately after the opening <body> tag of your page.
- DO NOT insert the data layer or anything else between the <body> tag and the tag manager container code.
- Use the code EXACTLY as provided, do not modify it.
All these conditions must be met in order to successfully verify the ownership. All.
Reasons Why You Cannot Verify Google Search Console with Google Tag Manager
Here are the most common mistakes that I see when people ask for help with the verification of Search Console via GTM.
#1. You don’t have all the necessary access to the GTM container
In order to verify your Search Console ownership with Google Tag Manager, you must have the following permissions on the container level:
Keep in mind that there is no “Manage” permissions in GTM, only View, Edit, Approve, and Publish. From what I’ve seen, it looks like the Publish permission stands for that mysterious “Manage” permission. If you managed to verify the ownership by having the Approve permission, let me know and I’ll update this guide.
Also, you must use the same Google account for that GTM container AND for Search Console.
#2. You did not place the <noscript> GTM code right after the <body> tag
When you need to install Google Tag Manager on a website, you’re asked to add two codes, one into the <head> and the other one right after the <body> of the website. In this context, the 2nd code (and its placement) is important.
Why? Because of Google Search Console verification, that’s pretty much the main reason why Google specifically asks you to add it directly after the <body>.
When Google’s crawler lands on a website, it looks for the <noscript> code snippet added immediately after the opening <body> tag. You cannot add it somewhere in the middle of at the end of the website’s body. It must be immediately after the opening <body> tag.
Here are two examples. A good one:
<body> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KCBRBKM" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager (noscript) --> .... .... .... </body>
And a bad one (because there is some additional code between the opening <body> and the opening <noscript> tags:
<body> <script> //some script </script> ...... <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KCBRBKM" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager (noscript) --> .... </body>
So if you want to successfully verify the Google Search Console ownership with Google Tag Manager, make sure that there is nothing between the <body> and <noscript>.
Not sure how to check that? Open your website > Right-click (somewhere on the background) and choose View Page Source. Use the “Search” feature (on Windows, that’s CTRL + F) and enter “<body” (without quotation marks).
That opening body tag might look like this:
It does not matter. What matters is that your <noscript> part of the GTM code snippet must be added IMMEDIATELY below that <body> tag. Like this:
and NOT like this:
If you indeed identified that this is your issue, you are probably wondering how to fix this. Well, the answer is “talk to your developers”. Every website is different and there is not silver bullet for everyone, therefore, I cannot give you more precise tips.
If you don’t have a developer and you are using some popular content management system, check if there is a forum/community for developers/users of that system. Maybe they can help you (or give some tips).
#3. You chose the wrong verification method
The default SC verification method that is offered to the user is to add a meta tag directly into the website’s code.
All you need to do is to add that one line of code anywhere in the website’s <head> and you’re good to go. And that’s where many of you get stuck as well.
Since Google Tag Manager is so awesome, you can do wonders with it, like install tracking codes or inject some other codes directly into the website. The aforementioned meta tag is also a code, right? So there should be no problem to add this code directly via GTM?
See the problem? Your injected Site Verification meta tag will never be seen by the crawler.
So if you decide to verify the ownership with GTM, make sure that you use a designated verification method for that.
To sum up, this method will work with GTM (just make sure that you follow all the requirements mentioned above):
And this method will not work with Google Tag Manager.
Still Cannot Verify Google Search Console with Google Tag Manager?
This is not the only way how to verify your Google Search ownership. Try a different one then.
Sometimes people contact me regarding this post and they claim that they followed the guide 100% and the verification still does not work. In ~90% of those cases, the problem is in reason #2. That’s why I highly recommend that you re-read that part and very carefully check your setup.
What a clearly idiotic group of geniuses they are - Google.
So, you have to have, "View", "Edit" or "Manage". But the choices in GTM are "Read", Edit", "Approve" and "Publish".
So only if you are lucky enough now to have previously set "Edit" will you be able to verify your properties.
I have always had the highest level of approval, "Publish", but because this dialog is now looking for a different string, my verifications have gone incomplete.
You would think that the geniuses at GTM and Console would be notifying each other about this screwed up set of issues.
The struggle is real :) However, you might want to consider the latest option how to verify ownership - directly with Google Analytics. That's a much faster and more seamless way.
Peoplessss......Easy Solve! Go into your header.php file and just input the second GTM code directly under the body tag or body class tag! Search Console ATE IT UP WHEN I TRIED AGAIN!
Only downside will it be able to see my Posts, Projects, etc?
Yeah....no, it's not always that easy. Just because that solved YOUR problem, doesn't mean it solves everyone's problems. For example, it didn't solve mine.
Alright, I checked off the list and I still can't figure out why it's not working. Have look at docs.easydita.com.
The noscript code that you have there is modified. It has some unnecessary attributes like xmlns:jcm-link-man. Your CMS is probably adding them. ask a developer to add the EXACT noscript code that GTM provides you with.
Thanks! I can't believe I missed that.
Hi there, thanks for the extensive article! We still can't figure it out though :)
Maybe you can help? Thanks!
I'm not sure but try this: in your noscript code include the comments that surround it
< !-- Google Tag Manager (noscript) -->
< !-- End Google Tag Manager (noscript) -->
In this case, I'm just guessing :) I've never added the noscript without those comments so I'm not sure whether they are causing your issues. Try it and see what happens.
Also, are you sure regarding other requirements (like GTM container permissions) in order for verification to work? I mean, have you checked other requirements too? Because ALL of them must be met.
Head's up: WP Minify can mess this up from time to time.
Argh! This is extremely frustrating. Before I ask our developers for a deployment, would you mind taking a look at https://www.miway.co.za/? I think there may be too much whitespace before the tag...
Man, I may just not be understanding all/any of this correctly. I setup GTM myself, and it's working. Google Analytics is working. But for the life of me, Google Search Console - i just can't get it to Verify.. Same user account; "Publish" permissions set.. Your opinion would be greatly appreciated!
Have you placed the noscript code immediately after the opening body tag? Please share the link of the website that you try to verify
Do I loose my GSC historical data If I verify web property at my end which was already verified by someone else?
There is no historical data in the web property if you haven't verified it yet. So once you verify it, only then it starts collecting data. Think of it as a new view in GA.
i can not understand how to verify my website please help, i built it with webs.com and i have tried to verify my site with google master but it returns Failure reason:
Could not find your verification file in the required location. i am using the recommended way but not sure what i am doing wrong any help is greatly appreciated
Looking at your error message, it looks like you've chosen another verification method, not GTM verification.
Are you able to assist. I am trying and failing to get it verified via GTM. Website is https://schoolhire.co.uk/
Thanks for your help!
Hey, your website does not meet requirement #2. The noscript code must be placed IMMEDIATELY after the opening body tag. In your website, there are some other HTML elements in-between. If you don't know how to solve this code-wise, consult with the developers who coded the site.
Thanks for your reply. Sorry if I am being stupid, can you confirm which lines I need to move the code as I am not sure I am following what needs to chabge exactly.
I currently have GTM code in lines 24-39 and then 60-62
Thanks for your help!
You must move the code from 60-62 lines and place it after the Line 42.