Creating multiple location affiliate site, amazon geo ip links TechzAround

Creating multiple location affiliate site, amazon geo ip links TechzAround

There are many worldwide stores which have good partner programs. One of well known store is Amazon. Problem is that most of such stores doesn’t provide autodetection of buyer’s location. Instead of this, stores have different domains (example,, So, if you have world wide site, you can lose money if you promote offers for one location. For example, users from Europe don’t like to buy in USA stores, because they must pay additional VAT for each product. How can you solve this? I will show some technics

First of all, you need to have geo ip base and plugin which can detect user country. I tested many plugins and currently I choose GeoIP Detection plugin which is most powerfull as I think. This is because this plugin provides not only shortcodes, but also additional functions for developers. And my favorite functions of plugin is that it has option to add user country and continent to body class. This is very usefull for my tips which I will write now. Also plugin use Maxmind GeoIP Lite City free base and has option to use paid version of base.

Let’s start to do multi location amazon links. You can use such tips also for any shop.

Multi locale dynamic links

One of feature of amazon is that most of products have the same position across all locales. This means that, for example, will be available also in,, etc. So, you need only to check user location and show him correct locale of amazon.

I wrote early, that GeoIP Detection plugin can add class to body tag. Plugin adds two classes, for example, geoip-country-CY and geoip-continent-EU

geoip-country-CY shows country code of user

geoip-continent-EU shows continent code of user

Full list of continents

Code Continent name
AF Africa
AN Antarctica
AS Asia
EU Europe
NA North america
OC Oceania
SA South america

So, for USA, continent class will be geoip-continent-NA

For country code, you can see all codes from Maxmind base page

Now, we can add simple jquery code on your site which will change default domain to domain of country of user.

For example, our main url of offers will be from Now, you want to send all users from Europe to Place such code in your theme

Many themes have field where you can add different scripts, for example, for ads, etc. In my themes, you can place this code in theme option – Analytics/js code

Place in domainforchange your default domain of links. As you see, we use geoip-continent-EU to detect users from Europe and if script find such class, all links which have on your pages will be changed to You can do the same for other continents, just place such peaces of codes

Ok, but what about different countries which have own store locale. For example, it would be bad if you send german users to when they have In this case, you can use country code of GeoIp plugin. So, full code will be

Such code will change links to for europe, and change to for german users or to for users from Spain. Last thing I forgot to add is affiliate ID. Most of multylocation stores use the same affiliate ID for all locations. But Amazon requires separate registration for each locale and you have separate affiliate ID. So, you need to change also a affiliate ID. Code for this will be


Ajax call and links changing

Problem with code above is that it’s working only on current page. But many sites have ajax call of links and content parts, so, you can try to change links on click event. Sometimes can be buggy, but you can try. Code above will have next look

Check one important thing. In first line I used a.re_track_btn, because “re_track_btn” is class in my theme for all affiliate links. Maybe you have another common class for such links. Also, you can try to use just “a” without any class to handle all links, but this is not recommended.

Multiple offers for different localizations

This was easy way to change links. But such method is not universal. Sometimes, you can’t just change domain to get correct links, because offers for different locations have different links and you need to create different offers.

In this case you can use similar plugin GeoTargeting Lite

This plugin has some shortcode to show and hide content to specific countries. For example,

So, you need to create different offers and then wrap each offer for specific country shortcode.

Plugin also supports setting several countries in shortcode

Another way is to use previous plugin but wrap each offer to own div. For this, enable text view of wordpress editor and wrap your offers.


According to such code, your js code will be

Caching issues and how to make cache compatibility geo ip detection

There is one problem with most of plugins. They didn’t support cache, because if you cache page, this page will show the same code to all users and will be static.

But some of cache systems have it’s own Geo Ip extension. One of such system is CloudFlare.

If you use it, you can use it’s geo ip detection instead of Geoip plugins. But you need to add some functions to your theme.

This is code which will do the same as GeoIp detection plugin to add special class to body tag. We will use the same classes, so, other codes which I wrote above will work.

Add such code to functions.php



How to create multiple location affiliate site

5 (100%)
1 vote

Leave a Reply

Your email address will not be published. Required fields are marked *

Better perfomance for BuddyPress TechzAround

Better perfomance for BuddyPress TechzAround

Adding frontend submit form with paid packages wordpress TechzAround

Adding frontend submit form with paid packages wordpress TechzAround