2

I'm trying to get an Amazon affiliate link set up that directs the visitor to their local store, rather than being fixed to one particular store. I know I could set up individual links for each country and let the user choose the right one, but ideally I only want to show the one Amazon link.

Essentially what I'm looking for is a Drupal version of this Amazon Affiliate Link Localizer Wordpress plugin, or a combination of modules/tweaks that will let me do the same thing.

  • 2
    It looks like the Amazon Affiliate Link Localizer is mostly javascript and a standalone php script (that responds to ajax calls). It probably wouldn't be very much work to adapt it to work as a Drupal module. – David L Jun 23 '11 at 21:36
5
+50

I wrote that plugin, so should be able to help!

There is a Javascript-only version of the Amazon Link Localiser. I don't know Drupal, but I can't see any reason why you wouldn't be able to use this - you'd just insert the JavaScript link into your template.

Cheers

Pete

  • I tried your code but it breaks some other JavaScript elements on the page. What could cause this conflict? – Matthew Hui Jun 27 '11 at 6:58
  • Pete, I've tried setting that up, and it seems like it should work, but I'm getting a JS error. It can't read the address property because location is null. Any suggestions? – Paul Jones Jun 27 '11 at 20:50
  • Update: Looks like it was because Google doesn't have a location for my IP. Will your script localise links that already contain affiliate links? Would be nice to fall back to an affiliate URL rather than a plain Amazon link. – Paul Jones Jun 27 '11 at 21:20
  • Sorry, the Javascript-only version isn't as up-to-date as the Wordpress version so there's an old bug in there. As you've found, if Google can't get a location it'll give an error. I'll add the fix to this tonight if I get a chance. – Pete Williams Jun 28 '11 at 10:16
  • 1
    OK, try the link again, I've now fixed the error if Google can't get a location. – Pete Williams Jun 28 '11 at 22:15
1

You can easily use client side JavaScript to check the PCs time zone setting and then set different links accordingly. There is an examples of how to do this at http://www.tomcoote.net/code-examples.html

0

If you don't want Javascript or a custom Plugin, I'd suggest to have a look at A-FWD. It's a web site that lets you build a custom link that will forward the user based on the IP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.