# Discourse Affiliate

**URL:** https://meta.discourse.org/t/discourse-affiliate/101937
**Category:** Plugin
**Tags:** official, affiliate, included-in-core
**Created:** [November 15, 2018, 7:06am UTC](https://meta.discourse.org/t/discourse-affiliate/101937 "2018-11-15T07:06:08Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [November 15, 2018, 7:06am UTC](https://meta.discourse.org/t/discourse-affiliate/101937/1 "2018-11-15T07:06:08Z")

</div>

| | | |
| --- | --- | --- |
| :discourse2: | **Summary** | **Discourse Affiliate** Allows the creation of Amazon affiliate links, and can help you monetize your Discourse forum. When users create links and other users click through those links and buy products from Amazon (or another supported affiliate), they earn referral fees. |
| 📖 | **Install Guide** | **This plugin is bundled with Discourse core**. There is no need to install the plugin separately. |

> [@](#):
>
> :discourse2: As this is an #official plugin maintained by the Discourse team, #Support, #Contribute > Bug, #Contribute > UX, and #Contribute > Feature requests can be made in the respective categories here on Meta, and tagged with the appropriate plugin tag. Click on a link below to get one started. 👍
> 
> [❓&nbsp; **Support**](https://meta.discourse.org/new-topic?category_id=6&body=%3E%20Before%20asking,%20did%20you%20search%20first%3F%20Press%20%F0%9F%94%8D%20at%20the%20upper%20right%20to%20search.&tags=affiliate "Ask for support on configuring and using Discourse Affiliate") [🐛&nbsp; **Bug**](https://meta.discourse.org/new-topic?category_id=1&tags=affiliate "A bug report means something is broken, preventing normal/typical use of the plugin") [👀&nbsp; **UX**](https://meta.discourse.org/new-topic?category_id=9&tags=affiliate "Discussion about the user interface of Discourse Affiliate, and how features are presented (including language and UI elements)") [💡&nbsp; **Feature**](https://meta.discourse.org/new-topic?category_id=2&tags=affiliate "Discussion about how existing Discourse Affiliate features can be improved or enhanced, and how proposed new features could work")

### Features

> **List of countries where the Amazon Associates program is operational**
>
> [Amazon.co.uk](http://Amazon.co.uk) Associates Program  
> [http://associates.amazon.co.uk/gp/associates/join/main.html](http://associates.amazon.co.uk/gp/associates/join/main.html)
> 
> [Amazon.de](http://Amazon.de) Associates Program  
> [Amazon Sign In](http://partnernet.amazon.de/gp/associates/join/main.html)
> 
> [Amazon.fr](http://Amazon.fr) Associates Program  
> [http://partenaires.amazon.fr/gp/associates/join/main.html](http://partenaires.amazon.fr/gp/associates/join/main.html)
> 
> Amazon.it Associates Program  
> [https://programma-affiliazione.amazon.it/](https://programma-affiliazione.amazon.it/)
> 
> Amazon.ca Associates Program  
> [Amazon Sign-In](http://associates.amazon.ca/gp/associates/join/)
> 
> Amazon.co.jp Associates Program  
> [アソシエイト・セントラル](http://affiliate.amazon.co.jp/gp/associates/join/main.html)
> 
> Amazon.es Associates Program  
> [https://afiliados.amazon.es/](https://afiliados.amazon.es/)
> 
> Amazon.in Associates Program  
> [Amazon Sign-In](https://affiliate-program.amazon.in/gp/associates/apply/main.html)
> 
> Amazon.br Associates Program  
> [https://associados.amazon.com.br/](https://associados.amazon.com.br/)
> 
> Amazon.com.mx Associates Program  
> [https://afiliados.amazon.com.mx/](https://afiliados.amazon.com.mx/)
> 
> [Amazon.cn](http://Amazon.cn) Associates Program  
> [https://associates.amazon.cn/join](https://associates.amazon.cn/join)

Sign up and read more about the Amazon Associates program at [https://affiliate-program.amazon.com/](https://affiliate-program.amazon.com/)

### Configuration

This plugin strips out all referral links in posts and replaces them with your Amazon Associates ID or other supported affiliate ID.

> 📣 This change will only affect new and future posts. To have the change affect all existing posts, you will need to do a [full post rebake](https://meta.discourse.org/t/rebake-all-posts/69340) once you set your affiliate ID.

If you set the Site Setting **affiliate amazon com** to say `sams-shop`, when people link ANYTHING from [amazon.com](http://amazon.com) the plugin will auto append `tag=sams-shop` and strip out all the existing referral links.

So for example:

`https://www.amazon.com/Dragon-Quest-Echoes-Elusive-Age-PlayStation/dp/B07BP3J6RG/`

Will be auto converted to:

`https://www.amazon.com/Dragon-Quest-Echoes-Elusive-Age-PlayStation/dp/B07BP3J6RG/ref=br_asw_pdt-5?tag=sams-shop`

### Site Settings

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

- **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** , **affiliate amazon ca** , enter your Associate ID depending on which country programs you have registered for.

### Run Tests

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

### CHANGELOG

### TODO

### Extras

- Can be paired with [(Obsolete) Use Amazon OneLink to make affiliated links on global forums much easier](https://meta.discourse.org/t/incorporating-amazon-onelink-making-affiliated-links-on-global-forums-much-easier/93642) for global sites using Amazon affiliate links.

- This plugin also has support for the French site `ldlc.com` at [https://affiliation.groupe-ldlc.com/affiliates/](https://affiliation.groupe-ldlc.com/affiliates/) which can be configured via **affiliate ldlc com** : Your `ldlc.com` Affiliate ID (without the #).

> Last edited by @david 2025-07-22T13:13:11Z
> 
> > **Check document**
> >
> > Perform check on document:

---

<div class="post-metadata">

### Author: ![Richie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richie/32/115110_2.png) [@Richie](https://meta.discourse.org/u/Richie)
#### Post date: [April 29, 2024, 6:16pm UTC](https://meta.discourse.org/t/discourse-affiliate/101937/39 "2024-04-29T18:16:43Z")

</div>

Is it possible to add support for `amzn.eu` links to this? 🤔

Eg:

`https://amzn.eu/d/4c3852b`

Currently redirects to:

`https://www.amazon.co.uk/dp/B0CXJ9GM3G?ref_=cm_sw_r_cso_cp_apin_dp_CDAMFS1FPQXBQEWSKWVE&starsLeft=1`

It should be converted to something along the lines of:

`https://www.amazon.com/dp/B0CXJ9GM3G/?tag=sams-shop`

---

<div class="post-metadata">

### Author: ![PeakProsperity](https://avatars.discourse-cdn.com/v4/letter/p/c57346/32.png) [@PeakProsperity](https://meta.discourse.org/u/PeakProsperity)
#### Post date: [April 30, 2024, 7:10pm UTC](https://meta.discourse.org/t/discourse-affiliate/101937/40 "2024-04-30T19:10:31Z")

</div>

I recently installed this plugin on our site and it works great for new posts, but running the `rake posts:rebake` command did not cause historical posts to have their Amazon links updated. Is there some common mistake that my team may be making? What I find odd is that the output he received after running the command mentions a different plugin:

```plaintext
Plugin name is 'GroupInvitation', but plugin directory is named 'group-invitation'
Rebaking post markdown for 'default'
414610 / 414610 (100.0%)e
414610 posts done!

```

Thanks for any additional guidance you can offer.

---

<div class="post-metadata">

### Author: ![HeyAgain](https://avatars.discourse-cdn.com/v4/letter/h/b19c9b/32.png) [@HeyAgain](https://meta.discourse.org/u/HeyAgain)
#### Post date: [July 9, 2024, 7:42am UTC](https://meta.discourse.org/t/discourse-affiliate/101937/41 "2024-07-09T07:42:35Z")

</div>

Hi, did you manage to get this working?

---

<div class="post-metadata">

### Author: ![zuker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zuker/32/150026_2.png) [@zuker](https://meta.discourse.org/u/zuker)
#### Post date: [January 10, 2025, 5:35pm UTC](https://meta.discourse.org/t/discourse-affiliate/101937/42 "2025-01-10T17:35:29Z")

</div>

Im getting about.json does not exists or not valid error when trying to install

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [January 10, 2025, 5:38pm UTC](https://meta.discourse.org/t/discourse-affiliate/101937/43 "2025-01-10T17:38:28Z")

</div>

How are you trying to install?

Usually that error is shown when you try to install a #Customization > Plugin like you would install a #Customization > Theme or #Customization > Theme component. Did you follow the instructions in the install guide linked in the first post?

> [@Discourse](#):
>
> | | | |
> | --- | --- | --- |
> | 📖 | **Install Guide** | [How to install plugins in Discourse](https://meta.discourse.org/t/install-plugins-in-discourse/19157) |

---

<div class="post-metadata">

### Author: ![zuker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zuker/32/150026_2.png) [@zuker](https://meta.discourse.org/u/zuker)
#### Post date: [January 10, 2025, 5:38pm UTC](https://meta.discourse.org/t/discourse-affiliate/101937/44 "2025-01-10T17:38:52Z")

</div>

Sorry my mistake! Thanks

---

<div class="post-metadata">

### Author: ![mediaex](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mediaex/32/489652_2.png) [@mediaex](https://meta.discourse.org/u/mediaex)
#### Post date: [February 25, 2025, 12:33am UTC](https://meta.discourse.org/t/discourse-affiliate/101937/45 "2025-02-25T00:33:58Z")

</div>

Hello, I’m using the Discourse Affiliate plugin and have Amazon OneLink enabled for my affiliate ID `XXXXXX-20`. Since OneLink automatically redirects users to their local Amazon stores, should I enter my affiliate ID only for `affiliate amazon com` (USA), or do I need to add it for each country separately?

Thanks for your help!

More info about OneLink  
👇👇👇  
[https://affiliate-program.amazon.com/resource-center/onelink-launch](https://affiliate-program.amazon.com/resource-center/onelink-launch)

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [July 22, 2025, 1:13pm UTC](https://meta.discourse.org/t/discourse-affiliate/101937/46 "2025-07-22T13:13:16Z")

</div>

🥳 This plugin is now bundled with Discourse core as part of [Bundling more popular plugins with Discourse core](https://meta.discourse.org/t/bundling-more-popular-plugins-with-discourse-core/373574). If you are self-hosting and use the plugin, you need to remove it from your `app.yml` before your next upgrade.

---

<div class="post-metadata">

### Author: ![SubStrider](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/substrider/32/512604_2.png) [@SubStrider](https://meta.discourse.org/u/SubStrider)
#### Post date: [September 18, 2025, 3:09pm UTC](https://meta.discourse.org/t/discourse-affiliate/101937/47 "2025-09-18T15:09:53Z")

</div>

Can we add this in the processor rules?

```plaintext
rules["amzn.in"] = create_amazon_rule("in") if postfix == "in"

```

---

<div class="post-metadata">

### Author: ![hipp0](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hipp0/32/537433_2.png) [@hipp0](https://meta.discourse.org/u/hipp0)
#### Post date: [February 8, 2026, 3:46am UTC](https://meta.discourse.org/t/discourse-affiliate/101937/48 "2026-02-08T03:46:13Z")

</div>

Posting links directly into the Topic title doesn’t add the code into the link that is created.

---

<div class="post-metadata">

### Author: ![AJ\_Quick](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/aj_quick/32/569383_2.png) [@AJ\_Quick](https://meta.discourse.org/u/AJ_Quick)
#### Post date: [August 28, 2026, 5:42pm UTC](https://meta.discourse.org/t/discourse-affiliate/101937/49 "2026-08-28T17:42:51Z")

</div>

A few things I am interested in about the affiliate plugin.

Would it be possible to also make the plugin inject a notice at the bottom of the post in which Affiliate links appear? In the US and Canada (and I’m sure elsewhere) you are required to have a conspicuous notice near the affiliate link.

I think while it is doing the rebake, it would make sense to automatically insert a distinct message at the bottom of the post that says something to the effect of:

_Links in this post may contain affiliate links, which help support our site at no additional cost to you._

That way the site can remain in compliance with local laws.

Another thing I would consider is adding the ability to actually remove existing affiliate links to Amazon and replace them with new versions. There are lots of official link cloakers for Amazon, the most common one is amzn.to It is not possible to just add your tag to the end of an amzn.to url as it is stripped away and replaced by the amzn.to site.

But I believe Discourse has the ability to travel through redirects and actually get to the final link? It would be within the ability of the system to look for these Amzn.to links, get the final Amazon product link it redirects to and then work backwards on the bake to change the overall link to be a direct Amazon link with your new tag built in.

Basically I just found a user had posted several articles with their own affiliate links in them and am now trying to locate them and replace them. :areyoukiddingme:

I’d be happy to help extend the existing plugin’s functionality!

EDIT:

Wrote a private plugin to test the feature. It now works as I intended. As you can see the original plugin (or something else) appended the tag to the amzn.to url, but that doesn’t actually work.

Before:

 ![image](https://global.discourse-cdn.com/meta/original/4X/c/e/9/ce97ab352f66f609139b116324b4703d72f4a05b.jpeg)

After:

 ![image](https://global.discourse-cdn.com/meta/original/4X/e/c/9/ec92e2423ffa1ff7218d700e55e1aaa65fa1f6eb.jpeg)

It replaced it with the actual Amazon link, un-shortened and added the new (though same) affiliate tag.

And I just checked, the user’s posts that had affiliate links have all been removed and replaced with ones that actually support the site rather than enrich the user.

---

<div class="post-metadata">

### Author: ![TroyTime](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/troytime/32/553220_2.png) [@TroyTime](https://meta.discourse.org/u/TroyTime)
#### Post date: [September 17, 2026, 1:10am UTC](https://meta.discourse.org/t/discourse-affiliate/101937/50 "2026-09-17T01:10:21Z")

</div>

This plugin would be **immensely more valuable** if it worked with custom urls (more than just amazon)

Most forums are niche and most niches have a handful of small businesses with affiliate programs.

I’d be happy to provide affiliate knowledge as assistance, but I don’t code anymore
