Archived topic
How do I add Google Adsense code?
8 replies · Started by Theodore on August 20, 2020
Please, I want to add the google adsense code between the <head> and </head> tags of my site, but i can't figure out how to do that.
I was supposed to use the "Insert Headers & Footers" plugin, but I've already used that to add the Google Analytics code.
Please, how else can I add adsense code?
Thanks.
Hi there,
you can use the Hook Element:
https://docs.generatepress.com/article/hooks-element-overview/
Common Hooks for adding code
Inside <head>: wp_header
After opening body tag: wp_body_open
In the site footer: wp_footer
And do we have to check "execute PHP"?
Hi Raul,
And do we have to check “execute PHP”?
No, you don't have to as Google Adsense scripts are JavaScript.
Thank you.
No problem. :)
Created a hook for Adsense as shown in the video: wp_head, priority:1
Google Adsense can't find it (although I can find it in the source code). Is there any common error / recommended troubleshooting?
Thanks for your help!
Hi there,
can you raise a new topic where you can share a link to your site so we can see if there are any obvious issues.
Sure. Done. Thanks.
Title: "Google can’t find Adsense code"