Official Discourse ad plugin: Where to get AdSense topic list top code?

I can’t for the life of me figure out what to put under ’ adsense topic list top code’

The only code or info given by adsense is the tag, which is this:

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

My adsense account is currently being activated so there’s no other information in the adsense console to dig through. Anyone help?

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
  (adsbygoogle = window.adsbygoogle || []).push({
    google_ad_client: "ca-pub-deleted_by_me",
    enable_page_level_ads: true
  });
</script>

You will need to create an ad unit for that position in AdSense and get the code for it:

Then get the data-ad-slot value from the code:

and enter it as described in the documentation:

3 Likes

Ah I can’t see that in my dropdown menu. I think it’s because my account is still ‘activating’. Thanks for the help, I’ll check back in a few hours…

For anyone waiting for their adsense account to activate, I heard the list is 4-5 weeks, not ‘a day’ as it says on the site…

1 Like

Sorry for dragging this up again but my site was rejected, I am trying (again) to ensure I have everything correct for when it’s reviewed by Google and still have a problem:

  • I have added my publisher ID to the adsense plugin
  • Code supposed to be between the head tags isn’t showing up (have also tried with separate theme component)
  • Does it need an ad unit to be entered to display properly? As my site has NOT yet been approved, I cannot create an ad unit so it’s a chicken and egg situation

So why isn’t the code showing up in between the head tags?

If you’re looking at the page source, it won’t be between the head tags. Do a search for your adsense publisher code in the page source and see if shows up - it should be about 3/4 of the way down.

Yes, it will need an ad to have something to display on your site, but if the domain hasn’t been approved yet by Google, I doubt you will see anything except a blank spot.

You do not need a theme component for AdSense or Google Ads (DFP) to work.

4 Likes

Thank you @omarfilip