How to prevent Ads Plugin from Displaying Ads on the forum homepage

Hello, how can I configure the ads plugin so that it doesn’t show ads on the homepage of the forum.

2 Likes

Hey, I don’t think there is a setting for that, but you can hide it with some CSS:

Don't use it
.navigation-topics .adsense-topic-list-top {
    display: none;
}
1 Like

I’m not sure if Google is happy with ads being hidden with CSS… that is probably a TOS violation.

4 Likes

Thanks correcting me. I was not aware of it, but it makes sense.
I asked IA about it:

For an AdSense publisher, the policy on hiding ads is nuanced. Generally, you’re allowed to hide specific ad units for legitimate design or user experience reasons, as long as you’re not manipulating clicks or impressions.

If you want to hide one specific ad placement while keeping others visible, this is typically acceptable if:

  1. You’re doing it for legitimate reasons (like responsive design or specific page layouts)
  2. You’re not using deceptive methods to encourage clicks on other ads
  3. You’re not implementing the hiding in a way that violates Google’s policies

Google’s main concern is preventing practices like:

  • Hiding ads but making them still clickable
  • Creating invisible overlays that generate accidental clicks
  • Implementing “ad stuffing” where ads load but aren’t visible

A setting to provide what route to allow/disallow would be handy.

2 Likes

Yeah @RGJ that’s right, they assume every impression is being served on a page, viewable for a user.

Also, this doesn’t target the homepage only right @Arkshine ?

1 Like

@Arkshine that’s right, a simple setting that says ‘Don’t show ads on the discourse homepage’ would be useful, I assume more users also would want this.

2 Likes

Any other ideas here? I have to assume 99% of the people don’t want a huge ad on the homepage of their forum…has anyone figured out a way around this?

@Arkshine is there any CSS trick to suppress the ads on the homepage/root page only? We’d be willing to risk that - it’s better than having a terrible user experience from the first impression.

1 Like

Here is some JS that removes the ad HTML from the homepage (not hidden with CSS).
Let me know if it works for you.

You can put it in your theme JS tab:

import { apiInitializer } from "discourse/lib/api";

export default apiInitializer((api) => {
  api.onPageChange((path) => {
    if (path === "/") {
      document.querySelector(".adsense-topic-list-top")?.remove();
    }
  })
});

3 Likes

Worked like a charm @Arkshine

2 Likes