Archived topic
Where to place Google Search Console HTML file?
12 replies · Started by Sharon Brodin on January 5, 2023
I've done this with my other websites, but they use GP Hooks. For my newest WordPress site there isn't GP Hooks, but Elements. I can't figure out where to place the HTML file so it doesn't display and so Google verifies it.
Hi Sharon,
A hook element is essentially the same as the previous GP Hooks:
https://docs.generatepress.com/article/hooks-element-overview/
Let me know if this helps :)
Thank you, Leo. I created a Hook for Google Analytics [wp_head] with display Location on Front Page. But when I do the same for Google Search Console, I can see the code on my header (I can't see the code for Google Analytics). What am I doing wrong?
Does Google Search Console provide any instructions on where to place the code?
Can you link me to the page in question?
I guess my Google Analytics code isn't working either, now that I went back and checked. Here's where Google says to place the Analytics code:
"The Google Analytics tag should be added near the top of the <head> tag and before any other script or CSS tags"
If I can get that working, it looks like I can verify my site with Google that way and I won't need a separate Search Console code...
Then the wp_head hook is correct.
Any caching plugins? Make sure it's cleared after making the change.
The theme has no ability to make the code not work.
I cleared the cache on my browser...do I need to also clear specifically on the website? I do not have a caching plugin.
When I just tried to verify Google Analytics again I got this failure message: "We could not find any Google Analytics tracking codes on the index page of your site." Any ideas?
Thank you!
Just to confirm that your element looks like this?
https://www.screencast.com/t/iFJYTbaoLK5W
If so it should definitely work - make sure any server or hosting cache is cleared. It's unrelated to your browser cache.
Yes, the Google Analytics code is longer, but generally the same. I don't know how to clear the server or hosting cache. Maybe I can get on with my host's tech support for that.
Can you link me to the site in question?
I actually figured it out! I got the W3 Total Cache plugin, just went thru the steps and got Google to verify my site ownership. It worked, so I'm in. Thank you for your help, Leo!
Resolved.
Glad to hear.