# Other websites in the Official Discourse Affiliate plugin

**URL:** <https://meta.discourse.org/t/other-websites-in-the-official-discourse-affiliate-plugin/47819>\
**Category:** Feature\
**Tags:** affiliate\
**Created:** [Juillet 26, 2016, 1:01 UTC](https://meta.discourse.org/t/other-websites-in-the-official-discourse-affiliate-plugin/47819 "2016-07-26T13:01:59Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)\
**Post date:** [Juillet 26, 2016, 1:01 UTC](https://meta.discourse.org/t/other-websites-in-the-official-discourse-affiliate-plugin/47819/1 "2016-07-26T13:01:59Z")

</div>

For everyone, there is an [**Official Discourse affiliate plugin**](https://github.com/discourse/discourse-affiliate) allowing you to automatically add your amazon ID in each links that will be published on your forum.

I want to use this plugin to add other websites that offer Affiliate program. I tried [another one](https://meta.discourse.org/t/discourse-affiliate-insert-affiliate-code-amazon-automatically-to-links/19585) few weeks ago but it broke the polls in preview for some reason.

Anyway, I tried working on the official one tonight even if I don’t have a lot of knowloedge.

Here is my example : I want to add the french website LDLC. The tag to add on each page is something like this : `#52325a32` (this is not my real tag)

There is three links that we usually share :

- `http://ldlc.com/#52325a32` (homepage, I can live without this one)
- `http://www.ldlc.com/b-06b841d7761b563e.html#52325a32` (a cart - useful when we “build” a PC for our users)
- `http://www.ldlc.com/fiche/PB00200087.html#52325a32` (a product page)

I managed to make the easy one work (the product page) with a clever copy/paste because it looked a lot like the amazon one (all caps and numbers, 10 characters). Here is my take on this : [https://github.com/iunctis/discourse-affiliate/blob/master/assets/javascripts/lib/discourse-markdown/affiliate.js.es6](https://github.com/iunctis/discourse-affiliate/blob/master/assets/javascripts/lib/discourse-markdown/affiliate.js.es6)

But when I tried something else to make all three types of links work, it didn’t work.

I tried multie things like this one : `const LDLC_ASIN_EXTRACTOR_REGEX = /\/[A-Za-z0-9/+]/i;` to allow different characters even slash (and I deleted the `/fiche` part in the href). It added the tag but the link was broken.

If anyone has a solution, it’d be great 😚

There is nothing urgent here, I can wait.

Thanks for reading ✌

(edit : I deleted and re-fork the officiel plugin, I had too many messed up commits, I wanted to start from scratch again. So I had to edit some parts of my post)

---

_[View the full topic](https://meta.discourse.org/t/other-websites-in-the-official-discourse-affiliate-plugin/47819)._
