(Obsolete) Use Amazon OneLink to make affiliated links on global forums much easier

This guide is deprecated. OneLink is supposed to work without additional scripts now (I say ‘supposed to’ because for many months now it has failed to work for me and others as proven by the number of posts on the subject on a popular user forum)

Anyway, as such you no longer need this. Let’s hope they fix the non-script solution!!



Here was my problem. I have a global forum and wanted to direct people to the right Amazon locale for my affiliate links. I ideally wanted one amazon link that serves all my clients globally within the supported list of territories. I originally had a cludge - one link for US, one for UK … for every darn product link I have …

Possible solutions:

  • the official discourse-affiliate plugin? Haven’t tried tbh
  • The new kid in town: Amazon’s OneLink available seemingly exclusively from the US affiliate domain website, but don’t let that put you off if you are from elsewhere …

Advantages of using OneLink:

  • To install, it’s only a necessary to add a Theme Component, which makes it nice and simple & low impact in that respect

Using OneLink on Discourse:

  • You need to add a Theme component for the OneLink script before the closing body tag in the /body section. Ignore the error due to the ‘&’ - if you change that to %26 it will break the script oddly. Something like:
    <!DOCTYPE html><div id="amzn-assoc-ad-blah-blah-code"></div><script async src="https://z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US&adInstanceId=blah-blah-code"></script>
  • Add that theme component to all your user selectable Themes
  • IMPORTANT: to prevent you breaking your affiliate agreement which bars you from using Amazon trademarks locally (except when sourced live from their servers), blacklist one-boxing for all amazon links using the setting onebox domains blacklist. The links will still work but will be less pretty obviously - however, you can replace them with official affiliate links.
  • Read the agreement thoroughly. Make the required disclaimers visible and obvious as per the agreement “As an Amazon Assoc …”
  • Also consider blacklisting the Amazon image url’s that are included in the affiliate links to prevent those images being uploaded locally - this may break terms of your Affiliate agreement. Use setting disabled image download domains

The link contains your ID & account keys, so please get the real code from the OneLink webpage.

Once done, anytime you click on an amazon link on your website, it should do two things:

  • register that it came via your affiliation
  • open a new tab on the clients browser in the locale of the last Amazon website they logged onto, hopefully their home shop.

Now you need to read the OneLink website and make sure you have registered for an ID at each of the supported locales and linked them to your US account.

I believe you still get ‘credited’ in each locale - Amazon is a bit unclear about this - I will update this guide once I’ve had more experience with it.


  • Clearly it only supports Amazon …
  • Doesn’t gross up your credits in one place, they still accrue to each region
  • Annoyingly it seems to leave the primary link (say US) open too, so you have go back from that to get back to your forum …
  • May not work for users with adblocking in place

Hope this helps!

Any questions or feedback on this guide welcome…


So just an update. After a little bit of experience and having my account closed once, I’ve done the following:

  • Amazon one-boxing remains blacklisted so as not to generate unauthorised trademarked images locally.
  • I’ve been very careful to make the required disclaimers visible and obvious as per the agreement “As an Amazon Assoc …”
  • I’ve also ‘blacklisted’ Amazon’s image sources to prevent local uploading of images from Amazon to prevent any rule transgression. This has the added benefit of saving you server space and leveraging their CDN presumably :slight_smile:

Added this to the guide above.


Hi Robert,

Now we’re working on Amazon OneLink, and have some questions for you.
Q1: Do you mean we need to create our own Theme component for the OneLink? Can you give me the Theme component template?

Q2: We got the error about the ‘Named entity expected. Got none.’ from the Amazon OneLink Script. And how to fix this error?

We tried many way with Amazon OneLink, but now it’s not working. We look forward to hearing from you soon. Thank you very much for your time.

Sorry to hear you are having some frustrations :slight_smile:

Yes, and you’ve already quoted it above, it’s just that single entry in /body making sure you update the id and InstanceId . Looks like you’ve done that. It’s so simple I’ve not even bothered to host it on GitHub. However …

You have not copied the example exactly. You are missing https:. I’m not sure if that’s the issue though, but just pointing that out. Try adding it. I get warning errors on the Theme editor but it still works, try ignoring them (so long as you can save).

Hope that helps! :slight_smile:

1 Like

Hi Robert,

Thanks for your reply. It’s a big help.

Let me come back to the first Question. I changed the ‘&’ to ‘&%26’, there is no error in this script. Is it correct for the component.

I have another question. Is the OneLink only for tracking the international advertising to link the US account, Not showing the advertising on the website, right? We still need to copy and paste the Amazon Advertising (Banners, Product Links etc) on our website.

Actually, I think this may be unnecessary, apologies I might remove it from the OP. Try it with just & - ie do not change it.

It is for tracking internationally (hence ‘one-link’) Remember to link your international amazon affiliate accounts on Amazon Affiliate .com. Follow their guide

Yes, this is manual with this approach, but you can automate with some home grown javascript. Experiment! I’ve used the Custom Layout Plugin and the html widget to rotate adverts on the side from a hand-picked list. Get the raw links from the Site Strip on Amazon by logging into it with your affiliate account. Be wary that some products are not available in all regions.



I got it. Thank you very much for your tips. I will try it on my website papasasa.com