Discourse Affiliate Plugin

The official Discourse Affiliate plugin can help you monetize your Discourse forum. When users create links and other users click through those links and buy products from Amazon, they earn referral fees.

List of countries where the Amazon Associates program is operational

Amazon.co.uk Associates Program

Amazon.de Associates Program

Amazon.fr Associates Program

Amazon.it Associates Program

Amazon.ca Associates Program

Amazon.co.jp Associates Program

Amazon.es Associates Program

Amazon.in Associates Program

Amazon.br Associates Program

Amazon.com.mx Associates Program

Amazon.cn Associates Program

Sign up and read more about the Amazon Associates program here: https://affiliate-program.amazon.com/
This plugin also has support for the French site ldlc.com: Affiliation Groupe LDLC


Follow the instructions at Install a Plugin using https://github.com/discourse/discourse-affiliate.git as the repository URL. After that, head over to /admin/plugins and enable the Discourse Affiliate plugin.

How it works

This plugin strips out all referral links in posts and replaces them with your Amazon Associates ID or ldlc.com Affiliate ID.

If you set the Site Setting affiliate amazon com to say sams-shop, when people link ANYTHING from amazon.com the plugin will auto append tag=sams-shop and strip out all the existing referral links.

So for example:

Would be auto converted to:


Site Settings

affiliate enabled: Enable the Affiliate plugin.
If you change this, you must rebake all posts with: rake posts:rebake.

affiliate amazon ca: Your amazon.ca (Canada) Associates ID. The links will be transformed only for all amazon.com links using the value entered here.
affiliate amazon com: Your amazon.com (United States) Associates ID. The links will be transformed only for all amazon.ca links using the value entered here.

You will see many more settings such as affiliate amazon co jp, affiliate amazon com au, enter your Associate ID depending on which country’s program you have registered for.
affiliate ldlc com: Your ldlc.com Affiliate ID (without the #). The links will be transformed only for all ldlc.com links using the value entered here.

Run Tests

Run bundle exec rake plugin:spec["discourse-affiliate"]


If you are just concerned about Amazon, it’s also worth considering just the Theme Component option I outline here because it leverages Amazon’s OneLink system which automatically redirects users to their local Amazon site.


Any chance we will see implementation of eBay?

That would be a great addition!

it would be nice to also integrate banggood.com

@rishabh Do I need to rebake the posts after installing the plugin and filling out my affiliate ID’s?

I have installed affiliate plugin for testing purpose, but currently I am not using this plugin.

Can anyone help me, how to uninstall discourse affiliate plugin and remove all there cache files from servers? @rishabh

When posting an Amazon search result link, the plugin strips out the search part of the url and links to the Amazon home page instead. Example:

Search Amazon for teddy bear and the url will be this:

The posted link is oneboxed like this:

But the link is actually this:

And that only goes to the Amazon home page.

Any way to avoid this?

1 Like