You can totally run ads on your Discourse forum thanks to the official plugin provided by Discourse team. It allows you to run in-house ads, Adsense ads, DFP ads and more. This tutorial teaches you how to put ads on Discourse forums.
If you have a Discourse forum with substantial active members and traffic, you might want to monetize it. One of the many ways you can monetize your forum is by running ads on it.
You can run Google’s Adsense or DFP ads or you can run your own custom ads to display banners for affiliate products. In this tutorial, I’ll show you how to run ads on Discourse forums.
Running ads on Discourse forum
Here are the steps you can follow for displaying ads on Discourse forum.
Step 1: Install the official ad plugin in Discourse
Discourse team provides an official plugin for displaying ads on Discourse forum. I recommend using this plugin over any other unofficial third party plugin.
I believe you have some knowledge of installing plugins on Discourse. If not, just follow the instructions.
You need to edit your container’s app.yml file. It’s usually located in /var/discourse/containers directory. You can use a graphical tool like FileZilla to connect to your server and access files graphically. You can do it in command line as well.
In the app.yml file, under the hook section, you should see the option for adding plugins. that section of your file should look like this:
- mkdir -p plugins
- git clone https://github.com/discourse/discourse-adplugin.git
If you already have some plugins listed in the app.yml file, add the git clone line after those plugins.
Once you have added the plugin information, you must rebuild your Discourse container. Your actual Discourse forum will experience downtime while it’s being rebuilt. There is no other way. Your forum must go offline.
Use the following command to rebuild Discourse forum:
./launcher rebuild app
It should take like five minutes at most.
Step 2: Using the ad plugin on Discourse
Once the rebuild is complete, you can start putting ads on your Discourse forum.
There are two kinds of ads available:
- In house ads: Your own custom ads, suitable for affiliate product display
- Advertisement platforms: You can run codes from Adsense, DFP, CodeFund and Carbon ads
Running Google adsense on Discourse forum
Go to Admin->Settings area. Scroll down to the bottom and in the left sidebar, you should see the options to run Google Adsense, DFP, Amazon, CodeFund and Carbon Ads.
Click on the ad service you want and fill the required details. You can also select where to display the ads, whom to show the ads (based on trust level), what categories to display or hide ads.
Running house ads (custom ads) on Discourse
Go to your forum’s admin area and choose the Plugins tab. You should see the installed plugins here. On the left sidebar, you should see the House Ads tab.
Note that if House Ads doesn’t load and it just keeps on waiting, you have the ad-blocker enabled. You must turn the ad-blocker off.
When you click on “Start by creating a new ad”, it will display a text field where you can add the HTML code for your custom ad. For example, my HTML code looks like this:
<a target="_blank" href="https://shareasale.com/r.cfm?b=1214297&u=747593&m=59485&urllink=&afftrack="><img src="https://static.shareasale.com/image/59485/TrainingAffiliateAds_728x90-LFS301.png" border="0" /></a>
It is basically displaying an image that has affiliate link to it. If anyone clicks on the image, it will be tracked thanks to affiliate link.
You can add as many ads as you want. When you have added at least one house ad, you’ll see a setting option now. This setting gives you the option to select a suitable place to display your ads.
As you can see, you can display ads:
- on top of topic list
- on topics above post stream
- on topics above suggested
- between posts
If you click on “More Settings” in the bottom, it will provide you additional options like displaying ads only after certain seconds or ads frequency if you have multiple ads in the same position.
You can also configure to display or hide ads from a certain group or a certain category here.
That’s all you need to add ads on Discourse forum. You can configure the ads as you like. You can choose if you want to show ads only to users below a trust level or on certain categories only. The tweaking is up to you.
I hope this tutorial helped you in putting ads on Discourse forums. If you have any questions or suggestions, please leave a comment below.