How to use location-based personalization on your website

PersonalizationBy Juliana Amorim and Mariana Bonanomi

Let's assume you run a retail business in the US. Your website is entirely in English and priced in Dollar. One day, a person from Tokyo goes to your website and is interested in one of your products. They get frustrated because they don’t know the prices in Yen or can't understand what's written in product descriptions or delivery recommendations.

One could argue that it is not a relevant problem. Nowadays, many websites offer their content in more than one language option, or the user could use a translator pluginas a last resource. But what about opportunities that overcome language concerns?

New technologies aim to minimize the cultural distances between countries, products, and information, thus providing many opportunities for your business to go beyond geographic borders.

How to increase the conversion rate and the ARPUISZI increased the conversion rate by +39% and average ticket by +88% with personalization based on geolocation.
A image showing personalization based on geolocation

Creating geomarketing strategies to impact new audiences in a globalized context is necessary. Next, you'll learn how to implement content according to the user's location. We’ll also discuss APIs and other alternatives.

What is geomarketing?

Geomarketing, or marketing by geography, means considering users' geolocation in planning and implementing marketing initiatives. The most common use of geomarketing is offering different content depending on the user's location, which we call localized content.

For example: Geomarketing can be used in any aspect of the marketing mix — you can localize the product offer, price, or communication strategy.

Benefits of location-based personalization

The main benefit of localized content is dynamically offering discounts and pricing plans for specific regions and displaying prices in the users' local currencies. Users can also see personalized banners and culturally-related hero images.

It also facilitates the business' internationalization and helps you save the time and effort required in managing different domains or different versions of pages for each country, state, or city you want to target specifically.

Delivering personalized experiences means offering products and services that your customers need. In another blog post, personalization has proven to be a strong ally in building unique experiences for achieving high ROI. A McKinsey study shows that personalization could reduce CAC by up to 50%, increase revenue from 5% to 15%, and improve marketing efficiency from 10% to 30%.

Geo redirect vs. geo content

There are two practical alternatives when discussing localized content: geo redirect and geo content.

You should use geo redirect when your website has multiple versions of the same page, one for each previously determined location. All you need to do is configure your CDN server to redirect the HTTP request to the right page.

On the other hand, using geo content requires dynamically modifying your page's content. You can use an API or a CMS compatible with personalization. That would enable you to capture the location data and implement the content directly in the source code. Either way, you would have a unique URL, and users would see different content.

This post focuses on geo content strategies since it is more powerful and opens up more significant opportunities.

Why you shouldn't use an IP geolocation API

Using the user's IP address to discover their geolocation is not new. Plenty of free and paid services in the market can help you with that.

This strategy uses the IP address to map the geographic location from where the device is connecting to the internet. If further fine-tuned, it can provide the user's device location details such as country, state, city, latitude/longitude, zip code, time zone, and even street name. Some services also provide more detailed information, such as the organization name, ISP, local currency, etc.

The usual request response for a JSON is like this:

2 "ip": "",
3 "hostname": "dns.example",
4 "continent_code": "NA",
5 "continent_name": "North America",
6 "country_code2": "US",
7 "country_code3": "USA",
8 "country_name": "United States",
9 "country_capital": "Washington, D.C.",
10 "state_prov": "California",
11 "district": "Santa Clara",
12 "city": "Mountain View",
13 "zipcode": "00000-0000",
14 "latitude": "37.42240",
15 "longitude": "-122.08421",
16 "geoname_id": "0000000",
17 "isp": "Google LLC",
18 "organization": "Google LLC",
19 "currency": {
20 "code": "USD",
21 "name": "US Dollar",
22 "symbol": "$"
23 },
24 "time_zone": {
25 "name": "America/Los_Angeles",
26 "offset": -8,
27 "current_time": "2022-01-01 01:02:03.456-0800",
28 "current_time_unix": 0000000000.000,
29 "is_dst": false,
30 "dst_savings": 1
31 }

The drawbacks of IP geolocation APIs

Using IP geolocation APIs can be an excellent solution to specific problems. However, it is not a silver bullet, and you should consider some technical matters when using it. Depending on your goal, we suggest evaluating other alternatives.


The first issue is imprecision. The user's IP address location may not always detect the exact location but within a 60 km to 80 km precision radius.

Japan map showing Tokyo and Yokohama. The geolocation APIs are detecting the users' location.
Example of location accuracy range detected by user IP address

Let's take the examples of Jersey City and New York City, or Tokyo and Yokohama. These cities are all very close to each other, so the result for users browsing from metropolitan regions can be mistakenly displayed.

Not knowing the exact user's location is desirable since it guarantees their privacy. However, you should evaluate if this goes for or against the company's marketing strategy.

Limited growth speed

Using IP geolocation APIs means that marketing teams need to rely on developers testing small changes on copies and images. That, of course, may limit the growth speed. Besides, it keeps developers from exploiting their full potential by working on technology backlogs filled with unchallenging demands.

Imagine receiving weekly requests to change the content of a page for a given city instead of focusing on more critical projects. Chances are they will either delay the project delivery or take longer to implement content. There are definitely other alternatives to help you manage situations like this.

Alternatives for IP geolocation APIs

There are no alternatives for solving the localization inaccuracy problem when working on IP addresses. But if you don't want your marketing team to depend entirely on devs, you should rely on a CMS serving personalized content. At Croct, we've developed the Personalization Management System (PMS).

It allows marketers to provide dynamic content to predefined slots on websites without depending on you for frequent changes. Once you integrate it into your page, you'll make sure dev sprints are dedicated to critical projects, while marketers can easily tweak the content for each location independently.

We currently use the user's IP address to estimate the user's location, but we'll soon release a new segmentation feature that will rely on GPS coordinates. The best news is that our customers won't need to change a single line of code: the PMS implementation does not change at all.

Using the PMS for location-based personalization

The following example shows you how to use the PMS to provide different content based on the user's location. There are two possible versions for the following banner: one for users from a known city and one for users from an unknown city.

Example of personalized image asking visitors what is their favorite place in New York city. Location API was used to segment users from New York.
An example of personalization based on users location

The following steps guide you on installing the library and integrating it into your application


We currently provide two SDKs: one for Javascript implementation and another for React applications. In this post, we focus on the React implementation but you can also check the Javascript example here. If you wish to test this in a local environment, you can do so by using our sandbox app ID, which is 00000000-0000-0000-0000-000000000000.


A slot represents a personalizable element of the interface.

When the content changes too often, slot components allow your team to change personalization rules whenever needed without touching the code.

To render a slot, you only need to provide the ID you configured in your Croct workspace. Based on the slot's personalization rules and the user's location, the component will decide which content to show that user.

We have already defined a slot with id location-banner in the sandbox workspace with the following structure:

1type HomeBannerContent = {
2 title: string,
3 subtitle: string,
4 cta: {
5 label: string,
6 link: string,
7 }

To render the content of the slot, you should use the <Slot /> component. The code snippet below shows how to use it, but you can also use the useContent hook (check out our documentation for further details).

1import {ReactElement, Suspense} from 'react';
2import {Slot} from '@croct/plug-react';
4type HomeBannerContent = {
5 title: string,
6 subtitle: string,
7 cta: {
8 label: string,
9 link: string,
10 }
13export default function OnboardingPage(): ReactElement {
14 return (
15 <Suspense fallback="✨ Personalizing content...">
16 <Slot id="home-banner">
17 {({title, subtitle, cta}: HomeBannerContent) => (
18 <div>
19 <strong>{title}</strong>
20 <p>{subtitle}</p>
21 <a href={}>{cta.label}</a>
22 </div>
23 )}
24 </Slot>
25 </Suspense>
26 )

Notice that there's no logic on the client side, meaning that your marketing team can freely change the slot content as needed without requiring an update to your React app.

One of our most outstanding advantages is the time it takes for the entire team to benefit from our tools. We work hard to improve our product daily and make it as user-friendly as possible.

Our codes and documentation are open, so you can read more about our plug features and APIs here :)

Wrapping up

Here is a summary of what we discussed:

  • Geomarketing can be used in any aspect of the marketing mix
  • There are two practical alternatives when discussing localized content: geo redirect and geo content. Geo redirect consists of having several versions of the same page to redirect users to its corresponding version. On the other hand, the geo content consists of a single page where different changes occur dynamically for each user
  • There are some drawbacks to IP geolocation APIs you must consider
  • The imprecision of user's location is a common issue in all tools using IP for this purpose
  • Using APIs usually means developers must spend time testing modifications instead of dedicating their time to other projects. The PMS is a great alternative for that.

We hope this blog post was useful to you. If you want to personalize the user experience based on their location, create a free account in our platform and start today!

Let's grow together!

Learn practical tactics our customers use to grow by 20% or more.