News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Error with Google AdManager tags

Started by guiller_mote, February 01, 2023, 12:18:58 PM

Previous topic - Next topic

guiller_mote

SMF 2.0.19
PHP 8.0

Hi all.
Much apreciated if somebody can help me.

I created a tag in google AdManager that works because I have also WordPress in the same domain and works fine. However in SMF it doesn't work neither with SMFPacks Ads Manager Mod (Adsense tags withot problems) nor manually insert. With this last option I get an error that sais, "template main_above cannot be load" (Adsense manually in the same location also works without any problems).
Any idea about this issue?

Thanks in advanced and best regards.

Kindred

well, from the error, it would appear that you probably just pasted the google code into the index.template.php file without actually parsing it into the template/php...  You can't just randomly paste code into a php file.

you have to have it in an echo statement and you have to escape single quotes.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

guiller_mote

Hi Kindred.

Thanks for your quick response.
As you see I'm not a php expert, only did the same as with the Adsense tag that works without any echo statement, I thought that will be the same :).
Please, tell me what exactly I have to write before and after AdManager tag.

The tag is something like this
<!-- /21632378801/300x250 -->
<div id='div-gpt-ad-16753456786-0' style='min-width: 300px; min-height: 90px;'>
  <script>
    googletag.cmd.push(function() { googletag.display('div-gpt-ad-16753456786-0'); });
  </script>
</div>

Thanks for your help.

vbgamer45

There should be more to the code than just that. Some kind of javsacript file include too
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

guiller_mote

Hi Vbgamer.

Yes, that's right but the other part of the code that you say goes in head section and I have no issues with it using Global Headers and Footers mod, I suppose that this mod is internally responsible for doing things well not like me  ;D .

vbgamer45

If you can see the code on the page that means it is ok.
Other than that google takes some time for ads to appear.
And you must have updated your ads.txt with the google publisher information
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

guiller_mote

Thanks for your help Vbgamer but that's not the issue. As I said in the first post I get a blank screen when just right enter to the forum an an error "template main_above cannot be load", it is clear that some code is missing to put from my side but the person that don't know is like the one that don't see (as we say in Spain  ;) ).
In the other hand I have "hundreds" of Adsense tags delivered for the rest of the web and work fine, it is only when I use ADM.

vbgamer45

I would talk to the mod author in that case.
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

guiller_mote

It is complicated, it is not a mod it is SAINT GOOGLE  :laugh:

guiller_mote

 :o  :o  :o  :o
I had not seen the logo banner on this website, it is just my case and I could have explained it better, sorry.
I have an equal 468x60 Adsense one embedded by hand in the indextemplate.php and works without problems, but now I want to use Google Ad Manager to rotate banners from other agencies and not just from Adsense but the code provided by ADM makes the web break.
I hope that now I have understood better.

Kindred

You have single quotes... they need to be replaced with double quotes or escaped
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

guiller_mote

Many thanks Kindred !!!

Now I don't get blank screen and the banner is shown perfect with rotation after change all ' by ". Until there good but all the text in the web is center instead of left ¿?¿?
Please, help again.
Or tell me what did you mean by "they need to be replaced with double quotes or escaped", let me know please this second posibility to see if work better.

Kindred

<!-- /21632378801/300x250 -->
<div id="div-gpt-ad-16753456786-0" style="min-width: 300px; min-height: 90px;">
  <script>
    googletag.cmd.push(function() { googletag.display(/'div-gpt-ad-16753456786-0/'); });
  </script>
</div>
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

guiller_mote

Yes Kindred, it is that I did but still center text

Kindred

oh. that has nothing at all to do with the quotes or code....  that's just CSS.
try adding text-align: left; to the style declaration.

If not... then that's a problem with Google's output, not the included code -- and you'll have to drill down into the google output css
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

guiller_mote

Sorry for not having answered sooner but I have been fighting with this last thing that you told me all these days at times and I have not achieved anything, I leave it as impossible but thank you very much anyway. I will not bother you with this matter anymore because it is evident that my knowledge is scarce. I'll try to find another way to do it.

Thanks and regards.

Advertisement: