Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Show Table of Contents

How to assign your affiliate products to a country

In this article you will learn how to display the offers of your product per an assigned country. For this function you need the geolocation extension of affiliate-toolkit. Also, affiliate-toolkit must have at least version 3.3.0.

Installation

You need to download the extension from our website under Add-Ons. Look for the geo-targeting extension. If you have an Extended Pass or higher, this extension is already included there. Otherwise, you will need to purchase this extension.

After the download you will receive a zip file. You can easily install this file as a plugin in the WordPress backend.

Then you can enter your license under affiliate-toolkit -> Settings -> Licenses and activate the extension.

Establishment

You will now find a new tab "GeoIP" under Settings. Under this tab you will find all relevant settings for this extension.

You need a free MaxMind license key to use it. If you do not have an account yet, please click on the following link: https://dev.maxmind.com/geoip/geolite2-free-geolocation-data?lang=en

Now create an account and follow the necessary steps.

Once you are logged in, you can create a new license key:

Assign a name and select "No":

After that you will see the license key which you can use:

The license key is only fully visible at this point. Also, it may take a few minutes before it becomes active.

Now paste the license key into the text box at affiliate-toolkit and click "Save Changes".

With the save, the database is now downloaded from MaxMind in the background and imported into an internal table.

It can happen that the import stops at this point (timeout). However, this does not matter, because the import from the cronjob is also updated regularly.

If nothing happens when saving, it is possible that the license key of MaxMind is not yet active. Here you usually just have to wait.

A table "{prefix}_atkp_geo_ip_country" is created in the database. This is generated anew with each import. However, is necessary for the assignment of visitors to a country.

Configuration

Once the IP address and countries are loaded, you will get a list of countries. Now you have to select the countries for which you want to play out products. It is not necessary (and recommended) to select all countries.

For example, if you want to play other products only for Austria, then select only Austria. If you want to play other products for Austria and Switzerland, select these countries.

You can also see which country was detected for your current IP and can thus validate whether the assignment works correctly.

Store assignment

Now that we have selected Austria, we can go to the stores and select our store for Austria.

In this example, we now create a new Geizhals store for Austria:

As soon as you create a product with this store or a product is found automatically in the price comparison, it will be assigned to the country Austria.

In this example, this means that the two products are displayed in Austria and all other products are displayed in all other countries.

There is nothing more to configure for this. The only thing you need to consider is the correct country-shop assignment.

Privacy

We made a conscious decision to use a local database. That is, we regularly import a list of IP addresses per country. We then take this list and check which country is assigned to the visitor.

We do not set a cookie for the visitor's current country, nor do we access an API and transmit to it the IP address for country determination.

Hints when using a cache

For the mapping to work even if you use a cache on your page, you need to enable AJAX product boxes. This ensures that the products are played out per visitor and do not lie in the cache.

Hooks

If you want to test the function for other countries, you can use the following hook. However, be sure to deactivate it after the test, otherwise the IP will be overwritten everywhere.

function atkp_geo_ipaddress_x($ip) {
	//dallas
	$ip = '69.162.81.155';
	//miami
	$ip = '162.254.206.227';
	//australia
	$ip = '197.221.23.194';
	return $ip;
}

add_filter('atkp_geo_ipaddress', 'atkp_geo_ipaddress_x');
Updated: 6. February 2023
Still not using affiliate-toolkit?
Setup takes less than 5 minutes and you can start to import first products!
Learn more about the packagesDownload FREE Version
Still need help?
Submit Your Question
Please give us the details, our support team will get back to you.
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram