Discourse Affiliate

: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.
:open_book: Install Guide This plugin is bundled with Discourse core. There is no need to install the plugin separately.

Features

List of countries where the Amazon Associates program is operational

Amazon.co.uk Associates Program
http://associates.amazon.co.uk/gp/associates/join/main.html

Amazon.de Associates Program
Amazon Sign In

Amazon.fr Associates Program
http://partenaires.amazon.fr/gp/associates/join/main.html

Amazon.it Associates Program
https://programma-affiliazione.amazon.it/

Amazon.ca Associates Program
Amazon Sign-In

Amazon.co.jp Associates Program
アソシエイト・セントラル

Amazon.es Associates Program
https://afiliados.amazon.es/

Amazon.in Associates Program
Amazon Sign-In

Amazon.br Associates Program
https://associados.amazon.com.br/

Amazon.com.mx Associates Program
https://afiliados.amazon.com.mx/

Amazon.cn Associates Program
https://associates.amazon.cn/join

Sign up and read more about the Amazon Associates program at 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.

:mega: 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 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 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

Last edited by @david 2025-07-22T13:13:11Z

Check documentPerform check on document:
35개의 좋아요

Is it possible to add support for amzn.eu links to this? :thinking:

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

2개의 좋아요

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:

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.

1개의 좋아요

Hi, did you manage to get this working?

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

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?

1개의 좋아요

Sorry my mistake! Thanks

2개의 좋아요

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
:backhand_index_pointing_down::backhand_index_pointing_down::backhand_index_pointing_down:
https://affiliate-program.amazon.com/resource-center/onelink-launch

:partying_face: This plugin is now bundled with Discourse core as part of Bundling more popular plugins with Discourse core. If you are self-hosting and use the plugin, you need to remove it from your app.yml before your next upgrade.

1개의 좋아요

Can we add this in the processor rules?

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

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

어필리에이트 플러그인에 대해 관심이 있는 몇 가지 사항이 있습니다.

어필리에이트 링크가 포함된 게시물 하단에 알림 문구를 자동으로 삽입하도록 하는 것이 가능할까요? 미국과 캐나다(그리고 다른 많은 국가에서도)에서는 어필리에이트 링크 근처에 눈에 띄는 고지를 의무적으로 표시해야 합니다.

재배키(rebake)가 진행되는 동안, 게시물 하단에 다음과 같은 명확한 메시지를 자동으로 삽입하는 것이 합리적이라고 생각합니다:

이 게시물에는 어필리에이트 링크가 포함되어 있을 수 있으며, 이는 추가 비용 없이 저희 사이트를 지원하는 데 도움이 됩니다.

이렇게 하면 사이트가 현지 법률을 준수할 수 있습니다.

또 다른 고려 사항은 기존 Amazon 어필리에이트 링크를 제거하고 새 버전으로 대체하는 기능을 추가하는 것입니다. Amazon에는 공식 링크 클로커가 많이 있으며, 가장 흔한 것은 amzn.to입니다. amzn.to URL 끝에 태그를 단순히 추가할 수는 없으며, amzn.to 사이트가 이를 제거하고 대체하기 때문입니다.

하지만 Discourse가 리다이렉트를 추적하여 최종 링크에 도달할 수 있는 기능이 있다고 생각합니다. 시스템이 이러한 amzn.to 링크를 찾아 리다이렉트되는 최종 Amazon 제품 링크를 확인한 뒤, 백킹 과정을 거치며 전체 링크를 새 태그가 내장된 직접적인 Amazon 링크로 변경하는 것은 충분히 가능해 보입니다.

결론적으로, 한 사용자가 자신의 어필리에이트 링크가 포함된 여러 기사를 게시한 것을 발견하고, 이제 그들을 찾아 대체하는 방법을 모색하고 있습니다. :areyoukiddingme:

기존 플러그인의 기능을 확장하는 데 기꺼이 도움을 드릴 수 있습니다!

수정:

기능을 테스트하기 위해 개인용 플러그인을 작성했습니다. 이제 의도한 대로 작동합니다. 보시는 것처럼 원래 플러그인(또는 다른什么东西)이 amzn.to URL에 태그를 추가했지만, 실제로는 작동하지 않았습니다.

변경 전:

변경 후:

실제 Amazon 링크로 대체되고, 짧게 된 것이 풀리며 새(하지만 동일한) 어필리에이트 태그가 추가되었습니다.

방금 확인해 보니, 어필리에이트 링크가 있던 사용자의 게시물들은 모두 삭제되고, 사용자를 부유하게 만드는 대신 실제로 사이트를 지원하는 링크로 대체되었습니다.

2개의 좋아요