Archived topic
Paste HTML code
13 replies · Started by Luke on April 13, 2022
Hi
Today I received a notification from Google Adsense to "Copy and paste this code in the HTML of your site, between the <head> and </head> tags."
Can you tell me how I can quickly do it? Where do I find these tags?
Hi there,
1. in Appearance > GeneratePress enable the Elements module.
2. Now create a new Hook element in Appearance > Elements -> Add New >> Hook
https://docs.generatepress.com/article/hooks-element-overview/
2.1 in the Hook Element text area add your Google Adsense script.
2.2 Select the Hook: wp_head
2.3 Set the Display Rules > Locations to Entire Site or just the places you want the code to fire.
Thanks for the answer. I've already done it. I'd like to send a screenshot but I don't know how to do it.
Save your screenshot on a share drive and send us the link to it. Or upload it to your WP Media Library and share the URL.
Screenshot below.
Thats correct, and if thats the site you added it to - i checked its source code and i can see the script.
OK, great. Thank you! I understand that when I set Locations to Entire Site it means that the code will be active on each page of the site?
Thats correct.
If you don't want the entire site then you can add individual locations or you can use exclusions for example:
Location: Entire Site
Exclude: Page > A Page
Exclude: Page > Another page
I resubmitted my site to Google Adsense and today they sent me the same reply which says:
We couldn’t find the code on your site. This is because the code is either missing or incomplete, or because the URL of your site is incorrect. Learn more.
Copy and paste this code in the HTML of your site, between the <head> and </head> tags.
Your AdSense code:
Can you check once again if I did it correctly because it looks like something is still wrong according to Google Adsense.
Hi Luke,
I can see this script added inside the <head> of your site: https://share.getcloudapp.com/04uE6dXk
You could try double checking if the script really is being added through the hook element be adding another element below the script.
For instance, try adding <style class=“check-if-script-is-added”></style> and/or a comment tag like <!-- my google script --> before your script.
Kindly let us know once you’ve added this and we’ll take a look once more.
OK, I added the extra lines of code from your message. You may check now if it's there.
Thank you for adding it. I can’t see it.
To confirm, is this the correct site to look at?: https://meditationbrainwaves.com/
Can you try clearing all caching mechanisms set in your website?
Hope to hear from you soon. :)
I cleared cache. Check screenshot showing the line of code which I added.
Thank you for clearing your cache.
Upon checking, I can confirm that it has indeed been added, and the Hook Element is indeed hooking its content to the <head>: https://share.getcloudapp.com/xQuqRQgO
You can further test this by setting a different priority in your hook. The two should still be found together.
With that said, perhaps you could reach out to Google Adsense support and see why the script isn’t working?
Moreover, I also found this which might also be helpful: https://support.google.com/adsense/thread/76254958/we-couldn%E2%80%99t-find-the-code-on-your-site?hl=en
Hope this clarifies. :)