Choose your country.

By Filippo Conforti on March 07, 2023

Multi-country is often confused with multi-language by developers. Selling internationally isn't just about translating an ecommerce website in different languages, but also about localizing its business settings for different countries and regions. When a customer picks a flag from a country selector, they’re selecting the country of their shipping address, which determines the website price list and currency, available payment methods, shipping options, promotions, etc.

There is generally a default language associated with each country, which is used for translations. In countries where there is more than one language spoken, some country selectors allow you to select more country/language combinations. In Canada, for instance, they speak English and French; in Switzerland, they speak German, French, and Italian.

A country selector with a list of country/language combinations.

Ideally, the country selector should be the website homepage and each country/language combination should be a subpath of the root URL.

The country selector should be the website root page.

This sitemap structure is optimal for SEO, but customers could have a negative experience unless you add some logic that helps them get to their preferred country more quickly. A technique involves guessing the customer's location based on their IP address. Most CDNs provide you with this information as an HTTP header that you can use in your website code. By using the IP address, the customer can be suggested to choose a particular shipping country.

The customer IP address can be used to suggest a shipping country.

Keep in mind, however, that the customer should never be automatically redirected based on their IP address. The reason is that this information is not always accurate. Suppose your website is being accessed by a laptop behind a proxy, for example. The proxy IP address would be different from the customer's, and it could possibly redirect the customer to the wrong country. In addition, Googlebots would be redirected based on their IP address as well, affecting the quality of your website crawling and indexing.

When the customer selects a country, you can store the country code in a cookie or the browser's local storage. The next time the customer visits your website, you can use that cookie to automatically redirect them to a country homepage. In the end, the user only sees the country selector the first time they visit the site, which is totally tolerable. The fact that Googlebots do not accept cookies means that SEO won't be impacted.

How to redirect customers to their country/language homepage.

A website structure like this is great in many ways, but presents a challenge when you want to link product pages or category listings from external channels, such as your social media pages or third party websites. In those situations, you cannot predict upfront a link's country/language subpath as you don't know the visitor's location.

A possible solution to this problem is to build a service that accepts vanity URLs, for example under a brand subdomain, and redirects clients based on their IP addresses. Although that's not ideal for the reasons described above, it's the only alternative you have unless you want to send all visitors to the same subpath. Keep in mind that an application like this might also serve as a URL shortener, making it easy for your marketing department to share pretty URLs.

Vanity URLs can be used to redirect customers based on their IP address.

The use of subpaths is not the only method of creating multi-regional and multilingual URLs. The Google developer docs provide you with valid alternative options. In any case, all my considerations are still relevant and can be used as best practices for most situations.

Enjoy the reading?

Subscribe to the newsletter and get a new article delivered to your inbox every week.