Add Google Adsense Code

Dominik L Posted in Technical Support 1 year ago

Hello everyone!

I've tried to add Google Adsense to my website, for that I became a code which I've to add in my html code between tags <head> and </head>.

I tried to use custom code component and tried to add it to JS frontend first, but that failed and then I tried to add to JS Backend, but google always tells me that the verification has failed

the code looks like this:

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-XXXXX"
crossorigin="anonymous"></script>

I added it WITHOUT the <script></script> tags.

like that:

async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-XXXXX"
crossorigin="anonymous">

Replies
ma Melo lobo Replied 1 year ago

As I have noticed, for the website be approved by Google Adscence, it must comply with some conditions, like the consistency of the content and access to all the pages of the website. The google robots must be able to access to all the pages of the website to check the contents, so we have to temporarily deactivate the connection form that's why I wonder if there is a way to make the newfeed page accessible without login

German Michael Zülsdorff Replied 1 year ago

"I added it WITHOUT the <script></script> tags.
like that:async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-XXXXX" crossorigin="anonymous">"

Yes, and if you press F12 to inspect your site's head in the developer console, you'll notice the result is not what google told you to insert, but

<script>
async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-XXXXX"
crossorigin="anonymous">
</script>

So, how to achieve what's requested?

Since the component insists on inserting a fixed skeleton like

<script>
</script>

you have to close the opening tag first, then add your google code completely, and re-open the component's script part again.
Thus the complete code to be inserted in the component editor has to be

</script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-XXXXX"
crossorigin="anonymous"></script>
<script>
German Dominik L Replied 1 year ago

OSSNAds is useless, you need to upload a picture, don’t know why..

gb TalkToAi Online Replied 1 year ago

Try the ads component and put the code in there, also custom code, and custom footer, all components should work to achieve your aim.

Try:
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-XXXXX"
crossorigin="anonymous">