House Ads in the official Ad Plugin

The CSS can be added to either your site’s active theme, or to a theme component that you include on all of your site’s active themes.


Hi neil,

What are the chances of this ‘ad after the first post then every N posts’ checkbox becoming a reality? Would be very useful, especially for quieter forums where some topics do not reach N posts!


1 Like

Is it possible to get delivery statistics on House Ads? I’m not sure that they are saved, but it would be good to be able to find this for my advertisers.


I’ve got a (hopefully not too dumb) question about how to test a prospective advert

What is the best way to trial a House Ad without displaying it to the whole Forum?

While they can be restricted by category and group, it is tricky to use this for testing purposes.

If I restrict it to just my private admin Category, it still shows up on /latest.
If I restrict it for everyone, nothing happens and everyone can see it.
If I restrict it for trust_level_0, I can’t see it but anon can.

The only three ways that I can see to do my testing of the Ads, and I don’t like any of them:

  1. Do it late at night when nobody is using the site (ugggh)
  2. Make a group which is everyone except me and restrict it from them (ok for a once-off but quite an admin burden) and still visible to anon
  3. Use a staging instance to test it on (overkill)

Am I missing something?


Sounds like what you want is a staging site for testing.


I see how a staging site will resolve all the needs here, but your comment also hints at a possible feature for previewing ads which may or may not be on the roadmap yet. Good stuff!


I’m often guilty of treating #feature as #support. I don’t know a lot about that code, but a version of the way that we can test plugins seems like it would be hard to do for ads. It would be cool though!


Should I put in a separate feature request?


Sure thing! It would be helpful to have that as a tracking tool, I can’t speak to if it will be developed though as it may be harder to implement.

1 Like

Is there a way that I can show only in-house ads to logged in users? I’ve excluded logged-in users from google ads, but I’d like to still show in-house ads to logged in users.

Additionally I’d like to hide in house ads from subscribers, but that can wait until I implement subscriptions

1 Like

Can we have a section in house ads for showing ads on the sidebar inside topics?


Just a heads up, it seems that the ad rotations aren’t evenly rotated. The first four ads (and particularly the first two) seem to consistently get significantly more impressions. With ad five and onward getting a fairly even split.

Ad 1 will get double the impressions of ad 5. Ad 5 and onward will get impressions evenly.

So for example, say you add 10 banners to all house ad slots. The first 4 assigned to the empty slot will get more impressions than any additional banners. Second slot seems to get ~75% of slot 1. Slot 3 gets ~65%, slot 4 gets ~60% and slot 5 and onward get roughly 50% of slot 1.


Ads.txt operates at the domain level. If you are running Discourse on a subdomain - e.g. - and you have a main website /, ads.txt for the entire domain should be at

I think you would only need a subdomain specific ads.txt file if the content would be different to to the main one.

1 Like

I have a suggestion about adding a similar “above header” display position.


It’s really a shame that this feature has no scripting support to work with other non-Google/Enterprise level adserver type software or programs out there. I have been running an independent ad server for 20 years on my sites, and this has really made it almost impossible for me to monetize my forums other than with Google ads. And there is seemingly no way to get it to work via the custom CSS/HTML options for Discourse as well because you have taken it upon yourselves to parse out all potentially harmful scripting from these custom fields. Just FYI some of us are developers as well, perhaps not Ruby, etc. but we still know how to implement 3rd party scripting from other servers/instances we manage and control the content on. Sorry but just frustrated because after 3 years and many updates of the current Ad server software I am using (AdAdmin) there is apparently still no version of the ad script call that will work within your code limitations. :frowning:

Maybe you just need your own theme component or plugin?

What code do you need to insert where?

1 Like

Assuming the script code looks something like this:

<div id="ABC"></div><script src="">/*300x250*/</script>

there’s a good chance that <div id="ABC"></div> is the target that the script at <script src=""></script> injects the ad into.

I’m guessing a bit here, but it’s likely that the exact same script tag is generated for all ads served from your adserver. If that’s the case, the approach outlined here might work for you: Is there a plugin for revive-adserver for discourse? - #3 by simon.

To test it out, create a theme component from the the Admin / Customize / Themes section of your site and add the script you’re seeing in the embed code to the head section of the theme component. Then include that theme component on all you site’s themes. After having done that, just add the embed code’s target div element to your house ads. For example <div id="ABC">.

If this doesn’t work, check your web inspector’s console for any errors. One thing to note is that there can be some unexpected issues with disabled ad blockers: Chrome adblock extension house ads issue.


I will try that. Thanks!

1 Like

Hmm… that suggestion didn’t work for me. The best I can seem to do with his newest version of AdAdmin is the fallback single script call which if put in the HEAD section of my theme does plop an ad from that zone at the very top of the site. With no formatting or sizing unfortunately. Try as I might by adding the DIV id to the url string it would not place the ad in the div assigned. Not sure why it would pass the id of the ad zone, but not the id of the div unless he just doesn’t have that part coded for this particular script request.

This is the call that worked in the HEAD section:
<script src=""></script>

As I said I tried to add “&t=AADIV29” to the string and then the <div id="AADIV29"></div> to the top of the “AFTER HEADER” section but no joy.

This is the full Script call that I assume Ember.js kills the crap out of if attempted.

<div id="AADIV29"></div><script>/* Leaderboard resp. */ var k=decodeURIComponent(document.cookie),ca=k.split(';'),psc="";for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ') c=c.substring(1);if (c.indexOf("adcapban")==0)psc+=(psc==""?"":",")+c.replace("adcapban","").replace("=",",");}var s = document.createElement("script");s.src = ""+String.fromCharCode(38)+"tm=0"+String.fromCharCode(38)+"tr=p+a%2C+nav+a%2C+h2+a"+String.fromCharCode(38)+"f=29"+String.fromCharCode(38)+"psc=" + psc;document.head.appendChild(s);</script>

Well, in my case the ads display well on the initial page load but if you navigate into another topic/category the ads do not display at all unless you manually refresh the page. How can this be fixed?