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

AI-generated summary

User WaitroseCarpark is having trouble with the Official Discourse ad plugin, specifically with the ‘AdSense topic list top code’. They provided the code given by AdSense, but it doesn’t seem to be enough.

omarfilip explained that an ad unit needs to be created in AdSense to get the required code, which includes the data-ad-slot value. However, WaitroseCarpark couldn’t see the option to create an ad unit because their AdSense account was still ‘activating’.

Later, WaitroseCarpark mentioned that their site was rejected and they’re trying to ensure everything is correct for the next review. They’re having trouble with the AdSense code not showing up between the head tags and are unsure if an ad unit is needed to display it properly.

omarfilip clarified that the code won’t be between the head tags in the page source, but rather about 3/4 of the way down. They also explained that an ad unit is needed to display ads, but it’s unlikely to work without domain approval from Google.

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:

https://github.com/discourse/discourse-adplugin#adsense-advertisement-tag-to-discourses-site-settings

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…

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.

Thank you @omarfilip