# How can I set different website content (not language) based on geolocation?

**URL:** <https://forum.wixstudio.com/t/how-can-i-set-different-website-content-not-language-based-on-geolocation/20266>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [June 2, 2020, 11:40pm UTC](https://forum.wixstudio.com/t/how-can-i-set-different-website-content-not-language-based-on-geolocation/20266 "2020-06-02T23:40:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![contezaezza](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/contezaezza/32/20023_2.png) [@contezaezza](https://forum.wixstudio.com/u/contezaezza)\
**Post date:** [June 2, 2020, 11:40pm UTC](https://forum.wixstudio.com/t/how-can-i-set-different-website-content-not-language-based-on-geolocation/20266/1 "2020-06-02T23:40:27Z")

</div>

I want to restrict the pages being visited depending on the country visiting my site.  
I want a different content for US and Australia sites. US visitors are my clients, while my Australia site is for recruiting purposes.

---

<div class="post-metadata">

**Author:** ![givemeawhisky](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/givemeawhisky/32/5383_2.png) [@givemeawhisky](https://forum.wixstudio.com/u/givemeawhisky)\
**Post date:** [June 3, 2020, 12:03am UTC](https://forum.wixstudio.com/t/how-can-i-set-different-website-content-not-language-based-on-geolocation/20266/2 "2020-06-03T00:03:10Z")

</div>

[https://www.wix.com/corvid/forum/community-discussion/customized-content-based-on-visitor-s-geo-location](https://www.wix.com/corvid/forum/community-discussion/customized-content-based-on-visitor-s-geo-location)  
[https://www.wix.com/corvid/reference/wix-window.html#getCurrentGeolocation](https://www.wix.com/corvid/reference/wix-window.html#getCurrentGeolocation)  
[https://www.wix.com/corvid/reference/wix-window.html#browserLocale](https://www.wix.com/corvid/reference/wix-window.html#browserLocale)

---

<div class="post-metadata">

**Author:** ![jose-kizhakedathu](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/jose-kizhakedathu/32/2418_2.png) [@jose-kizhakedathu](https://forum.wixstudio.com/u/jose-kizhakedathu)\
**Post date:** [April 21, 2021, 8:23am UTC](https://forum.wixstudio.com/t/how-can-i-set-different-website-content-not-language-based-on-geolocation/20266/3 "2021-04-21T08:23:37Z")

</div>

Hey, so I had a similar problem where I wanted to display a pricing page based on the visitor’s geolocation.

If you are proficient with [Velo](https://learn-code.wix.com/en/) coding then you can use [Routers](https://support.wix.com/en/article/velo-about-routers) . If you don’t come from a coding background like me you can use a workaround as I did.

In my scenario, I have two pricing pages, one for Indian visitors and another for international visitors. I wanted the site visitors to automatically be redirected to their respective pricing page.

* * *

**The step-by-step article is** [**here**](https://josesibik.medium.com/using-geolocation-code-to-redirect-site-visitors-to-another-page-on-your-wix-website-instead-of-cb47d491e2d2) **along with the required code that you can copy.**

_The code was originally used to geo-block visitors from certain countries and redirect them to a page but I tweaked it to my requirement._

**You can see the code in action on my website** [**here**](https://www.josesibik.com/pricing) **.**

You will notice the URL stay at www.josesibik.com **/pricing** if you are NOT from India but if your location is from India, you will be redirected to www.josesibik.com **/pricing-in**

Note: While this may help solve your issue, it has a con. The code I use loads the first page before redirecting to the final page. Whereas, with [Routers](https://support.wix.com/en/article/velo-about-routers) , the visitor is redirected before the first page loads.

Hope this helps. Thank you.

---

<div class="post-metadata">

**Author:** ![eugeniagarat](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/eugeniagarat/32/10225_2.png) [@eugeniagarat](https://forum.wixstudio.com/u/eugeniagarat)\
**Post date:** [May 17, 2022, 8:42pm UTC](https://forum.wixstudio.com/t/how-can-i-set-different-website-content-not-language-based-on-geolocation/20266/4 "2022-05-17T20:42:18Z")

</div>

Hey Jose! Thank you for sharing your code. I tried it out and I can’t understand why it’s not working.  
I’m in Argentina and I want the “international” lightbox to open only of you are outside Argentina.

This is the code, same as yours

```javascript

import wixWindow from 'wix-window';
import {fetch} from 'wix-fetch';

$w.onReady(function () { // Fetch the user's location details
     fetch('https://extreme-ip-lookup.com/json', {
        method: 'get'
     }) // Check if the request was successful
     .then((httpResponse) => {
if (httpResponse.ok) {
return httpResponse.json();
        }
     })     
     .then((json) => {
        // Set the user's countryCode as a const
const loc = json.countryCode; /* Check if location is India, and check if the visitor is not on Pricing-in page */        
if(loc !== "AR"){
           // Redirect to "pricing-in" page
          wixWindow.openLightbox("international");
        }
     });
     })

```

The thing is, the code as it is does show the lightbox in Argentina and everywhere. And if it’s

```javascript
if(loc === "AR") 

```

then it shows nowhere

What I’m I missing?  
thanks!  
Euge

---

<div class="post-metadata">

**Author:** ![jose-kizhakedathu](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/jose-kizhakedathu/32/2418_2.png) [@jose-kizhakedathu](https://forum.wixstudio.com/u/jose-kizhakedathu)\
**Post date:** [June 1, 2022, 1:00pm UTC](https://forum.wixstudio.com/t/how-can-i-set-different-website-content-not-language-based-on-geolocation/20266/5 "2022-06-01T13:00:30Z")

</div>

@eugeniagarat Hi Euge,  
Hope you’re doing well!

Please share a link to the page with the code. Also, recently ‘Extreme IP Lookup’ has made small changes that require an account with their site to generate a key to use their service. That could also be the problem.

Looking forward to your response. Thank you.

---

<div class="post-metadata">

**Author:** ![eugeniagarat](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/eugeniagarat/32/10225_2.png) [@eugeniagarat](https://forum.wixstudio.com/u/eugeniagarat)\
**Post date:** [June 2, 2022, 12:46pm UTC](https://forum.wixstudio.com/t/how-can-i-set-different-website-content-not-language-based-on-geolocation/20266/6 "2022-06-02T12:46:30Z")

</div>

Hey Jose! So glad you answered! Thank you for taking the time!  
This is the page with the code [https://www.azziworldwide.com](https://www.azziworldwide.com/)u[/u]  
Right now there is no lightbox name between brackets as I erased it cause it doesn’t work properly. I just made an account with “Extreme IP Lookup”. Is there anywhere in the code I should add that key for using their service?

Thank you!  
Euge
