Jump to content

Placing AdSense Ads Code


Recommended Posts

Thank you in advance folks.

So I have met all the qualifications and approvals by Google Adsense, and have my ads.txt in the root of my domain, and I copy pasted the code supplied by Adsense into the head tags of my "globalTemplate" file, thanks for all your help with that @David N.

I have read the Adsense help topics and it seems pretty convoluted for my simple mind and I am struggling with placing the actual AD code into a location on my website to display the Ad. It is script code, and I would like to create a block with the advertisement code in that block, and place the custom block in my community to display the ad.

I copy paste the code provided by Adsense into my custom block, and when I place my block, nothing ever appears.

This is what I am trying to place:

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-xxxxxxxxxxxxxxxx"
     crossorigin="anonymous"></script>
<!-- Forum Page Sidebar -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-xxxxxxxxxxxxx"
     data-ad-slot="xxxxxxxxxx"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>

Do I need to add anything before or after the script code for the ad to appear?

Thanks for any help!

Link to comment
Share on other sites

Two things… once you add the code you might need to clear the system cache for changes to show. View the page source and see if the code is actually there.  If not, that problem must be resolved  

If the code is there,but no ad… Google may not immediately show ads. They many times start profiling traffic before they deliver an actual ad. If that’s the case, the problem is with Google. 

Link to comment
Share on other sites

Marc Stridgen
This post was recognized by Marc Stridgen!

Randy Calvert was awarded the badge 'Helpful' and 5 points.

If you are using the auto ad code, do not put it in a block. Blocks don’t render in the header. You add the code to your site theme’s global template in the head section. 

Once it’s added to the theme, you need to make sure the code is showing when you view source. If not, it’s most likely cached to the old version still. If the code is actually there but not showing ads it’s a Google issue. 

If you are NOT using Google Auto Ads and are using manual ad blocks, just use the built in IPS advertising section of the ACP. (This only works with manual ads not auto ads.)

Edited by Randy Calvert
Link to comment
Share on other sites

Marc Stridgen
This post was recognized by Marc Stridgen!

David N. was awarded the badge 'Helpful' and 5 points.

Are you trying to do auto ads, or individual ad units? 

The code for auto ads goes in the header, like this: https://support.google.com/adsense/answer/9274516

The code for individual ad units goes in the body, like this: https://support.google.com/adsense/answer/9190028

To check that you've added the code correctly, view the source: https://support.google.com/adsense/answer/9189018

Then you may have to wait a few hours before Google actually publishes ads on your site. 

Link to comment
Share on other sites

2 minutes ago, JohnCourt said:

Ok Randy and David, the code was working all this time, I tried Chrome and Edge and I can see the ads, but in firefox I cannot, I don't have any ad blocker software on my firefox browser, I don't know why they don't display in firefox, hmmm.

Perhaps FireFox's privacy settings is blocking something from Google which it requires to show ads. You would need to contact Google about that. Regardless, sounds like our software is serving your advertisement so you did set it up correctly.

Link to comment
Share on other sites

2 minutes ago, Jim M said:

Perhaps FireFox's privacy settings is blocking something from Google which it requires to show ads. You would need to contact Google about that. Regardless, sounds like our software is serving your advertisement so you did set it up correctly.

Looks like Jim. IP is fine. I get the hint though Jim, move on move on, it's not an IP issue 😂

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...