Most users start working with the Magento 2 GeoIP Redirect module after looking through the user guide and FAQ. However, some questions still remain open. In this article, we will explain how to tackle 6 common issues and help you better understand the extension capabilities.
By the way, the tips below perfectly apply to Magento 1 GeoIP Redirect as well, so feel free to read on even if you haven’t switched to Magento 2 yet.
- #1. How to correctly configure the ‘Сountry to store view redirect’?
- #2. How to prevent redirection of the search engine crawler?
- #3. How does the module switch stores?
- #4. Is it possible to use the GeoIP Redirect when you run only a subsite on Magento 2?
- #5. Everything seems right. Why are store visitors still redirected wrongly?
- #6. How does Google Analytics track redirected traffic?
#1. How to correctly configure the ‘Сountry to store view redirect’?
Many users tend to misconfigure the Country to store view redirect setting because they give priority to the country attribute instead of the store view, as they should do. To set things right, let’s configure this feature together right now.
First, log in to the Admin Panel and navigate to Stores -> Configuration -> Amasty Extensions -> GeoIP Redirect and expand the Country to Store View Redirect section. Now you need to select the store view to which you want to redirect your customers. Say, you would like to redirect visitors from Greece and Iceland to the English store view. First, you need to select the English store view in the upper left corner. Then in the Country to Store View Redirect section, choose Greece and Iceland and hit the Save Config button, as shown in the screenshot below:
This way, customers from Greece and Iceland will be redirected to the English store view. Also, beware of selecting countries more than in one store view. For example, if you pick Austria in both German and English store views, the system will redirect users to stores at random.
#2. How to prevent redirection of the search engine crawler?
For the sake of SEO and accurate web indexing, search engine crawlers shouldn’t be redirected to any store view. The GeoIP Redirect for Magento 2 module allows you to easily exclude certain user agents from redirection.
For this, please go to the Magento 2 Admin Panel (if you are not logged in yet) and navigate to Stores -> Configuration -> Amasty Extensions -> GeoIP Redirect. Then in the User Agent to Ignore field, you need to specify user agents that you want to skip. For example, googlebot, msnbot or others and save the changes:
#3. How does the module switch stores?
Typical Magento 2 multistore configuration implies that countries are stores and languages are store views.
In this regard, there is some misunderstanding of the GeoIP Redirect functionality. In fact, the extension doesn’t influence the frontend so you won’t see new switchers on your store pages. The module just redirects store visitors based on your backend configurations. The only way to add clickable switchers to your store pages is to modify the store theme and update the Magento 2 configuration.
#4. Is it possible to use the GeoIP Redirect when you run only a subsite on Magento 2?
When your Magento 2 installation is located inside another CMS or is used as a subsite in addition to the main one (say, the WordPress-based blog), then the redirect functionality will be unavailable.
Likewise, the GeoIP Redirect can fail if you redirect users to your web store from an external IP via a proxy, CDN, your own web server or something else. The module understands that some redirecting server is used and tries to find a real IP of a visitor in one of the following web server headers:
After the module finds a visitor’s real IP, it uses this info to redirect the customer to a relevant store view. Yet, if the web server hides the IP completely, the GeoIP Redirect module won’t be able to get the visitor’s information and consequently won’t work correctly.
#5. Everything seems right. Why are store visitors still redirected wrongly?
One can face issues with incorrect redirection when several stores are located on different domains and there is no full stop in the Cookie Domain field. Different domains use various cookie files and the module should be configured with this in mind.
Let’s check it over together. Please, go to Stores -> Configuration -> General -> Web -> Default Cookie Settings.
In our case, .example.com is correct while example.com is not. See below how an accurate setting looks like in Magento 2.
#6. How does Google Analytics track redirected traffic?
After the system redirects a visitor from another store view, it is impossible to correctly track the first visit. As a result, in Google Analytics, you will see visitors with the IP address of your own server.
Well, that’s it for today. Hope we answered your questions. If not, don’t hesitate to read the extension user guide and FAQ, contact our support team for detailed information, or leave your comments below.