In this article and the embedded video I demonstrate how I am able to send traffic to 3 or more different Amazon online stores as an affiliate, with just one link. More than that, the script that I use (that is shared below) is dynamic in the sense that it could be used for virtually any product that exists in the Amazon stores. I’ll explain further below.

Check out the video to see how this all works, then I’ll explain it all in more detail in the article below, and provide the necessary PHP logic.

Why Would I Want To Create Dynamic Links?

It’s a fair question to ask why you would want to create a dynamic link. In terms of promoting multiple Amazon stores with just one link, I think that it is an obvious answer. I know that people from all over the world have ordered from (the U.S. store) but I think that is only for one of three reasons:

  • a) they don’t know of their country’s Amazon store (or their country doesn’t have one)
  • b) their country’s Amazon store doesn’t have the product that they are after
  • c) they don’t know of any other way to get the product (locally or otherwise)

Well, in a lot of cases, and more and more all the time, the same product is available in the Amazon store of a different country. But still, why does that matter? Well, for starters, if the product is being shipped domestically the shipping will most likely be cheaper, and there won’t be any duty charged from International purchases.

Just like it increases coversions to link someone to a specific product page (or even category or search results) page, I think it increases conversions to link someone to a site that is within their geographic location (whether it be city, region or country… whatever is available).

As far as using just one file (or script) to redirect users based on a search query… it’s just easier than creating multiple files. I know that the URL is still different for each link (because you are passing the search term in the query string), but there is only one redirect script.

That has it’s advantages. For example, I only recently added the ability to redirect to the UK Amazon store. Had I created multiple files I would have needed to make several changes rather than just one. Plus, what if Amazon suddenly changes the linking structure? I would either have to hunt down all the posts that I created direct links in, or modify multiple redirect files. But now I would just have to modify one. I have also practiced this with other affiliate merchants who allow search links and it has saved me a bunch of time when they switched platforms. Thankfully the new platform allowed search links as well.

How Is It Possible To Create Dynamic Links?

dynamic Amazon search results

I implemented geo targeting technology (my own) that allowed me to determine the country of each visitor. That is stored in a global variable and is available to me in the background as the visitor navigates through the site. It is ultimately stored in a cookie for about two weeks.

Then I created a redirect script that I filtered all Amazon links through. That script is actually what makes the quick check to read the “country” variable (using an include file).

Knowing that (and the search query which is pulled in from the query string) I am able to dynamically generate a redirect affiliate link for the appropriate Amazon store with the proper search term.

Here is the code below. You must implement a way to store the visitor’s country into the $GEO_COUNTRY variable for the code to work. There are free and paid solutions which you can locate by Googling.


$search_term = $_GET['st']; // this comes from the query string
$GEO_COUNTRY = 'get this value dynamically using an IP address based geo targeting solution';

if ($GEO_COUNTRY == 'CA') {
     $redirecturl = ''.$search_term.'&linkCode=ur2&tag=YOUR-ID-20';
} elseif ($GEO_COUNTRY == 'GB') {
     $redirecturl = ''.$search_term.'&linkCode=ur2&tag=YOUR-ID-21';
} else {
     $redirecturl = ''.$search_term.'&linkCode=ur2&tag=YOUR-ID-20';

header('location: '.$redirecturl);

Now, if you save the file as amazon-search.php for example, and you wanted to link to a listing of all Tony Robbins books on Amazon, you would use the URL of /amazon-search.php?tony+robbins in your link. Make sure that you “nofollow” the link like you would any affiliate link.


The Results


The resulting recirect URLs for the above search would be (depending on the visitor’s country as determined by the geo targeting tool):

Canada >>

United States (and other countries) >>

UK (Great Britian) >>