News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Google Adnsense banner doesn't load

Started by Sono, December 01, 2020, 11:30:45 PM

Previous topic - Next topic

Sono

I inserted a few Google Adsense banners into my forum pages using the code Google provides when you create campaings. I added it to the footer and to the  header of the forum board. The problem is: very often, the ads do not load. Either the block does not appear at all, or the block appears, but it is blank. I noticed that it happens in case I visit a page that I have not visited before. If I go back to that same page time by time, then after a while the ads start appearing on that page. The symptom appears in Firefox and Safari, no matter I use my default or mobile forum theme, and regardless of what device I am visiting the site with. However in case I use the default theme and visit the site in desktop mode in full screen in Chrome, it does work. All the time. However, even in this circumstance, in case I resize the browser window to, for example half size, then the problem starts also in desktop mode. I do not seem to find any logical reason for this problem. I am using the HTML code from my adsense profile, that I call with echo from the php files of my forum theme. I wonder in case I would rewrite the code to load in different would the banners load properly?

This is my code at the moment:


echo '
<div  style="text-align:center;margin-top:1.3em;margin-bottom:5px;">Advertisement</div>
<div style="margin-bottom:1.3em;text-align:center;">



<ins class="adsbygoogle"
   style="display:inline-block;width:98%;height:110px;margin-bottom:10px;text-align:center;"
   data-ad-client="ca-pub-xxxxxxxxxxxxxxxxxxxx"
   data-ad-slot="xxxxxxxxxxxxxxxx"</ins>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>



</div> ' ;



This is that I insterted into indextemplate.php, for exaple, in the footer code, before an echo command.

vbgamer45

That's normal google behavior.  For new sites/pages takes a while for ads to be displayed. If nothing can be found that matches the content then it is blank.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Aleksi "Lex" Kilpinen

For new sites it can take anywhere from a few minutes, to days, even if nothing is wrong. Also, this can happen again later on just as well. Temporarily.
Google used to fill blanks with alternative content, like text ads, but doesn't really do that anymore, and so you may end up seeing nothing if there's no actual ad campaign available to show.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Samuel2339

Quote from: Sono on December 01, 2020, 11:30:45 PM
I inserted a few Google Adsense banners into my forum pages using the code Google provides when you create campaings. I added it to the footer and to the  header of the forum board. The problem is: very often, the ads do not load. Either the block does not appear at all, or the block appears, but it is blank. I noticed that it happens in case I visit a page that I have not visited before. If I go back to that same page time by time, then after a while the ads start appearing on that page. The symptom appears in Firefox and Safari, no matter I use my default or mobile forum theme, and regardless of what device I am visiting the site with. However in case I use the default theme and visit the site in desktop mode in full screen in Chrome, it does work. All the time. However, even in this circumstance, in case I resize the browser window to, for example half size, then the problem starts also in desktop mode. I do not seem to find any logical reason for this problem. I am using the HTML code from my adsense profile, that I call with echo from the php files of my forum theme. I wonder in case I would rewrite the code to load in different would the banners load properly?

This is my code at the moment:


echo '
<div  style="text-align:center;margin-top:1.3em;margin-bottom:5px;">Advertisement</div>
<div style="margin-bottom:1.3em;text-align:center;">



<ins class="adsbygoogle"
   style="display:inline-block;width:98%;height:110px;margin-bottom:10px;text-align:center;"
   data-ad-client="ca-pub-xxxxxxxxxxxxxxxxxxxx"
   data-ad-slot="xxxxxxxxxxxxxxxx"</ins>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>



</div> ' ;



This is that I insterted into indextemplate.php, for exaple, in the footer code, before an echo command.

Did you have a fix on this issue? I have the same problem with.

Aleksi "Lex" Kilpinen

The exact described problem, is not a problem - but a feature of Google AdSense.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Advertisement: