I’ve adapted Affililink to work on Discourse, please let me know any feedback you may have.
I would really love to see something integrated into Discourse to strip out the affiliate codes.
Just figured out that one of my forum users has been sneaking Amazon affiliate codes into links and I didn’t notice until just now. I’m guessing there are others that I didn’t realize.
And my forum is tiny.
This will strip out and replace other users links. It’s automatically run client side rather than built into Discourse but does the job all the same.
Does it work for amzn.to links?
It will work with any link structured: domain.com/blah/?var=affcode
As long as you set it in the config, this means it’ll work with most affiliate schemes out there.
So… it won’t work with amzn.to links then.
Looks like it would, you may need to alter the universal codes to add amzn.to.
See lines 16-25
https://github.com/deanbarrow/discourse_affililink/blob/master/assets/javascripts/affililink.js
amzn.to is their custom link shortener. It’s not going to work.
amzn.to is operated by bit.ly. It can be done. The steps would be:
- Resolve amzn.to link into full link. (Using curl or some similar method.)
- Make adjustments to the url as necessary.
- (optional) Reshorten the link using bit.ly. Amazon.com links are automatically shortened into amzn.to links.
Was this user shortening to amzn.to links that included an affiliate code?
Yes, and that user has been yelled at and I am still mulling the idea of banning him.
Honestly, I think that adjusting affiliate links could be a core feature for offering non-intrusive advertising. It would be a good selling point.
I mean, it could be implemented as a plugin, but offered as part of your hosting service as a premium feature.
Yes of course it will. Check the config for for a better idea of how it works.
Alrighty then. Show me how it will replace the code in this affiliate link:
Right, I see what you mean. Just played around with it and it seems the tag is overwritten when converted.
The ideal way would be to expand each link server side and process the code there, and then it can be stored as an affiliate link in the database. I’m not really looking to pursue this though as my aim is to keep the affililink project as universal as possible without being locked into a specific platform.
I used to have a hosted version similar to viglink/skimlinks which would do this, however decided to abandon that project.
Another, related problem: How would you rewrite an adf.ly link?
Actually, that brings up the point of banning all links to a certain domain, even by trusted users. We have /admin/logs/screened_urls
, but judging from the screened_url_spec
and the UI, it’s mostly there to watch the spammers and know when we need to eventually implement something. (Basically, “it does nothing yet”.)
Yeah, I’d love to ban all short links and force people to post the real links. Or automatically expand short links.
And I’d love to ban known ad links.
It seems like this is the underlying feature request, and one I agree with because I have heard it before from multiple sources…
The underlying problem is that I don’t want users trying to make money by sneaking in advertising links or affiliate links, and I don’t want other users or readers having to wonder what they are clicking on.
And right now there’s no way for me to deal with this problem other than just seeing what people are linking to.
I made a plugin (alpha version): https://github.com/camilleroux/discourse-affiliate
Enjoy and feel free to send pull requests to improve it