Country Specific Redirection

manatarms
Shopify Partner
44 0 2

Hey Everyone,

Is there a best practice when it comes to redirecting a user to a particular shop. I have a US and non US shop, I would like to redirect the customer accordingly. I'm assuming IP is the best way to do this, but it doesn't work so well for the phone.

Any help is appreciated.

Thank you for your time

0 Likes
manatarms
Shopify Partner
44 0 2

Anyone have an answer? Any help is appreciated.

Thanks

0 Likes
adam_bn
Shopify Partner
58 2 10

A great app for this is Country and Currency Redirect

 

You can easily set up redirects based on a users location or what currency they use

0 Likes
Ramiz
Tourist
21 0 3

Hi Manatarms,

 

You can redirect your user according to his location by using IP Geolocation API services such as IPGeolocation very easily. IP Geolocation is the technique of finding the approximate physical location of an internet-connected device through an IP address and IP Geolocation API is the availability of this technique in the form of an API.

 

 To redirect the US and non-US users to their specific shop, you have to follow these two steps:

 

  • First, you have to find the location of the user by using the IP Geolocation API service. (For details visit IP Geolocation API documentation)
  • Secondly, after that, redirect him on the basis of his location by using the following code.
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (4 === this.readyState && 200 === this.status) {
var json = JSON.parse(this.responseText);
if (json.country_code2 == "US" && window.location.hostname !== "http://us.exmaple.com"{
    window.location.href = "https://us.exmaple.com";
} else if (window.location.hostname !== "http://exmaple.com"
{
    window.location.href = "https://exmaple.com";
}
}
}
request.open("GET", "https://api.ipgeolocation.io/ipgeo?apiKey=YOUR_API_KEY&fields=country_code2", false);
request.setRequestHeader("Accept", "application/json");
request.send();

For more information, you can contact support@ipgeolocation.io.

0 Likes
MichaelGeo
Explorer
191 3 13

Hi you are right, IP geolocation services are the best way to redirect a user to specific websites. IP geolocation service can identify the locations of your website's visitors by IP, matching their larger database.

 

When it comes to phone,  the accuracy is not as good as PC. If the phone is on wifi, the accuracy is the same as PC. If it is on mobile network, the tracked physical location will point to the celluar tower the phone connects to, not the phone's physical location. In other words, it works better for broader areas. Generally, it you want to direct your customers at county level, like exampleshop.com, or exampleshop.ca, IP geolocation services usually work well.

 

Here is a great tool you could check: GEORedirect

It auto directs your website's visitors to location-specified webpage URLs, for example, your US and non US shop. The accuracy is 99% on country level, 90% on state level, 80% on city level. The tool is easy to set up. No coding is necessary.

 

Hope it helps.

 

 

0 Likes
SteveHelm
New Member
3 0 0

Hi

The best and simple solution with no hassle at all would be to use an app to set up GeoIP-based redirects. Our app offers a seamless redirect setup that would help you with your objective. We use a service provider with high accuracy rates that detect the visitor’s country even on mobile networks very well.

Also, if you are using Shopify Payments on your Non-US Store and planning to set it up as an International Store, our app also offers a currency switcher which will change the currency based on the customer’s location.

Check out our app: Cozy Country Redirect

Best regards

Steve

Steve Helm | Support Executive @ Cozy Addons
0 Likes